修复恐惧和变形术
Index: src/game/AIInterface.cpp ================================================== ================= --- src/game/AIInterface.cpp (revision 624) +++ src/game/AIInterface.cpp (working copy) @@ -307,6 +307,7 @@ case EVENT_UNFEAR: { // update speed + m_AIState = SATTE_UNFEAR_OR_UNCONFUSE; m_Unit->m_runSpeed *= 2; getMoveFlags(); }break; @@ -339,6 +340,7 @@ case EVENT_UNWANDER: { // update speed + m_AIState = SATTE_UNFEAR_OR_UNCONFUSE; m_Unit->m_runSpeed *= 2; getMoveFlags(); }break; @@ -2422,50 +2424,36 @@ }
//Fear Code - if(m_AIState == STATE_FEAR && UnitToFear != NULL && m_creatureState == STOPPED) + if(m_AIState == STATE_FEAR && m_creatureState == STOPPED) { - if(getMSTime() > m_FearTimer) // Wait at point for x ms + if(getMSTime() > m_FearTimer) { - float Fx; - float Fy; - float Fz; - // Calculate new angle to target. - float Fo = m_Unit->calcRadAngle(UnitToFear->GetPositionX(), UnitToFear->GetPositionY(), m_Unit->GetPositionX(), m_Unit->GetPositionY()); - - Fx = m_Unit->GetPositionX() + 10*cosf(Fo); - Fy = m_Unit->GetPositionY() + 10*sinf(Fo); - - // Check if this point is in water. - float wl = m_Unit->GetMapMgr()->GetWaterHeight(Fx, Fy); -// uint8 wt = m_Unit->GetMapMgr()->GetWaterType(Fx, Fy); - - Fz = m_Unit->GetMapMgr()->GetLandHeight(Fx, Fy); - if(!(fabs(m_Unit->GetPositionZ() - Fz) > 4 || Fz < (wl-2))/* && wt & 0x1*/) - { - MoveTo(Fx, Fy, Fz, Fo); - } - m_FearTimer = m_totalMoveTime + getMSTime() + 200; + float X = m_Unit->GetPositionX(); + float Y = m_Unit->GetPositionY(); + float Z = m_Unit->GetPositionZ(); + float randr = float(rand()%327)/327*10; + float randa = float(rand()%327)/327*2*M_PI; + float X1 = X+randr*cos(randa); + float Y1 = Y+randr*sin(randa); + m_Unit->GetAIInterface()->SendMoveToPacket(X1,Y1,Z,0,1000,0x100); + m_FearTimer = getMSTime() + 1000; } }
if(m_AIState == STATE_WANDER && m_creatureState == STOPPED) { - float wanderO = sRand.randInt(6); - float wanderX = m_Unit->GetPositionX() + cosf(wanderO); - float wanderY = m_Unit->GetPositionY() + sinf(wanderO); - float wanderZ; - - - - // Check if this point is in water. - float wl = m_Unit->GetMapMgr()->GetWaterHeight(wanderX, wanderY); -// uint8 wt = m_Unit->GetMapMgr()->GetWaterType(wanderX, wanderY); - - wanderZ = m_Unit->GetMapMgr()->GetLandHeight(wanderX, wanderY); - if(!(fabs(m_Unit->GetPositionZ() - wanderZ) > 4 || wanderZ < (wl-2))/* && wt & 0x1*/) + if(getMSTime() > m_FearTimer) { - MoveTo(wanderX,wanderY,wanderZ,wanderO); - } + float X = m_Unit->GetPositionX(); + float Y = m_Unit->GetPositionY(); + float Z = m_Unit->GetPositionZ(); + float randr = float(rand()%327)/327*6; + float randa = float(rand()%327)/327*2*M_PI; + float X1 = X+randr*cos(randa); + float Y1 = Y+randr*sin(randa); + m_Unit->GetAIInterface()->SendMoveToPacket(X1,Y1,Z,0,1500,0x000); + m_FearTimer = getMSTime() + 1500; + } }
//Unit Follow Code Index: src/game/AIInterface.h ================================================== ================= --- src/game/AIInterface.h (revision 624) +++ src/game/AIInterface.h (working copy) @@ -103,7 +103,8 @@ STATE_WANDER, STATE_STOPPED, STATE_SCRIPTMOVE, - STATE_SCRIPTIDLE + STATE_SCRIPTIDLE, + SATTE_UNFEAR_OR_UNCONFUSE };
enum MovementState Index: src/game/SpellAuras.cpp ================================================== ================= --- src/game/SpellAuras.cpp (revision 624) +++ src/game/SpellAuras.cpp (working copy) @@ -1492,7 +1492,7 @@ if(m_caster->isAlive()) { m_target->GetAIInterface()->AttackReaction(GetUnitCaster(), 1, 0); - //m_target->GetAIInterface()->HandleEvent(EVENT_ENTERCOM*AT, GetUnitCaster(), 0); + m_target->GetAIInterface()->HandleEvent(EVENT_ENTERCOM*AT, GetUnitCaster(), 0); } } }
|