Update of /cvsroot/wpdev/wolfpack/ai
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21871/ai
Modified Files:
ai_mage.cpp
Log Message:
fixes
Index: ai_mage.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ai/ai_mage.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ai_mage.cpp 16 Oct 2004 19:42:56 -0000 1.4
--- ai_mage.cpp 16 Oct 2004 20:01:39 -0000 1.5
***************
*** 274,278 ****
}
! nextSpellTime = Server::instance()->time() + 5000; // Cast all 5 seconds
}
--- 274,286 ----
}
! // Calculate the next spell delay
! if (spell == 41) {
! nextSpellTime = Server::instance()->time() + m_npc->actionSpeed(); // Dispel gets special handling
! } else {
! float scale = m_npc->skillValue(MAGERY) * 0.003;
! unsigned int minDelay = 6000 - (scale * 750);
! unsigned int maxDelay = 6000 - (scale * 1250);
! nextSpellTime = Server::instance()->time() + RandomNum(minDelay, maxDelay);
! }
}
***************
*** 313,334 ****
return;
! unsigned int distance = m_npc->dist(currentVictim);
!
! if (distance >= 10 && distance <= 12) {
! return; // Right distance
! } else if (distance > 10) {
movePath(currentVictim->pos(), true);
! } else if (distance < 10) {
! // Calculate the opposing direction and get away (at least try it)
! unsigned char direction = (m_npc->pos().direction(currentVictim->pos()) + 4) % 8;
!
! if (direction != m_npc->direction()) {
! if (!Movement::instance()->Walking(m_npc, direction|0x80, 0xFF)) {
! return;
! }
! }
! if (!Movement::instance()->Walking(m_npc, direction|0x80, 0xFF)) {
! direction = (direction + 1) % 8;
if (direction != m_npc->direction()) {
--- 321,337 ----
return;
! // If we're not casting a spell and waiting for a new one, move toward the target
! if (!m_npc->hasScript("magic")) {
movePath(currentVictim->pos(), true);
! } else {
! unsigned int distance = m_npc->dist(currentVictim);
! if (distance >= 10 && distance <= 12) {
! return; // Right distance
! } else if (distance > 10) {
! movePath(currentVictim->pos(), true);
! } else if (distance < 10) {
! // Calculate the opposing direction and get away (at least try it)
! unsigned char direction = (m_npc->pos().direction(currentVictim->pos()) + 4) % 8;
if (direction != m_npc->direction()) {
***************
*** 339,343 ****
if (!Movement::instance()->Walking(m_npc, direction|0x80, 0xFF)) {
! direction = (direction == 1) ? 7 : (direction - 2);
if (direction != m_npc->direction()) {
--- 342,346 ----
if (!Movement::instance()->Walking(m_npc, direction|0x80, 0xFF)) {
! direction = (direction + 1) % 8;
if (direction != m_npc->direction()) {
***************
*** 348,352 ****
if (!Movement::instance()->Walking(m_npc, direction|0x80, 0xFF)) {
! return; // We tried everything but failed
}
}
--- 351,365 ----
if (!Movement::instance()->Walking(m_npc, direction|0x80, 0xFF)) {
! direction = (direction == 1) ? 7 : (direction - 2);
!
! if (direction != m_npc->direction()) {
! if (!Movement::instance()->Walking(m_npc, direction|0x80, 0xFF)) {
! return;
! }
! }
!
! if (!Movement::instance()->Walking(m_npc, direction|0x80, 0xFF)) {
! return; // We tried everything but failed
! }
}
}
|