void CAICharCharm::CheckCurrentAction(uint32 tick) { m_Tick = tick; CBattleEntity* PSelf = m_PChar; switch (m_ActionType) { case ACTION_NONE: ActionRoaming(); break; case ACTION_ROAMING: ActionRoaming(); break; case ACTION_ATTACK: ActionAttack(); break; case ACTION_ENGAGE: ActionEngage(); break; case ACTION_DISENGAGE: ActionDisengage(); break; case ACTION_FALL: ActionFall(); break; case ACTION_SLEEP: ActionSleep(); break; case ACTION_MAGIC_START: TransitionBack(true); break; case ACTION_RANGED_START: TransitionBack(true); break; case ACTION_ITEM_START: TransitionBack(true); break; case ACTION_CHANGE_TARGET: TransitionBack(true); break; case ACTION_WEAPONSKILL_START: TransitionBack(true); break; case ACTION_JOBABILITY_START: TransitionBack(true); break; case ACTION_RAISE_MENU_SELECTION: TransitionBack(true); break; default: DSP_DEBUG_BREAK_IF(true); } if (m_PChar && PSelf->PBattleAI == this) { m_PChar->UpdateEntity(); } }
void CAIPetDummy::CheckCurrentAction(uint32 tick) { m_Tick = tick; //uncharm any pets if time is up if(tick > m_PPet->charmTime && m_PPet->isCharmed) { petutils::DespawnPet(m_PPet->PMaster); return; } switch(m_ActionType) { case ACTION_NONE: break; case ACTION_ROAMING: ActionRoaming(); break; case ACTION_DEATH: ActionDeath(); break; case ACTION_SPAWN: ActionSpawn(); break; case ACTION_FALL: ActionFall(); break; case ACTION_ENGAGE: ActionEngage(); break; case ACTION_ATTACK: ActionAttack(); break; case ACTION_SLEEP: ActionSleep(); break; case ACTION_DISENGAGE: ActionDisengage(); break; case ACTION_MOBABILITY_START: ActionAbilityStart(); break; case ACTION_MOBABILITY_USING: ActionAbilityUsing(); break; case ACTION_MOBABILITY_FINISH: ActionAbilityFinish(); break; case ACTION_MOBABILITY_INTERRUPT: ActionAbilityInterrupt(); break; case ACTION_MAGIC_START: ActionMagicStart(); break; case ACTION_MAGIC_CASTING: ActionMagicCasting(); break; case ACTION_MAGIC_FINISH: ActionMagicFinish(); break; default : DSP_DEBUG_BREAK_IF(true); } }
void CAIAutomatonDummy::CheckCurrentAction(uint32 tick) { m_Tick = tick; CBattleEntity* PSelf = m_PPet; switch (m_ActionType) { case ACTION_NONE: break; case ACTION_ROAMING: ActionRoaming(); break; case ACTION_DEATH: ActionDeath(); break; case ACTION_SPAWN: ActionSpawn(); break; case ACTION_FALL: ActionFall(); break; case ACTION_ENGAGE: ActionEngage(); break; case ACTION_ATTACK: ActionAttack(); break; case ACTION_SLEEP: ActionSleep(); break; case ACTION_DISENGAGE: ActionDisengage(); break; case ACTION_MOBABILITY_START: ActionAbilityStart(); break; case ACTION_MOBABILITY_USING: ActionAbilityUsing(); break; case ACTION_MOBABILITY_FINISH: ActionAbilityFinish(); break; case ACTION_MOBABILITY_INTERRUPT: ActionAbilityInterrupt(); break; case ACTION_MAGIC_START: ActionMagicStart(); break; case ACTION_MAGIC_CASTING: ActionMagicCasting(); break; case ACTION_MAGIC_FINISH: ActionMagicFinish(); break; default: DSP_DEBUG_BREAK_IF(true); } //check if this AI was replaced (the new AI will update if this is the case) if (m_PPet && PSelf->PBattleAI == this) { m_PPet->UpdateEntity(); } }
void CAIPetDummy::ActionRoaming() { if( m_PPet->PMaster==NULL || m_PPet->PMaster->isDead()){ m_ActionType = ACTION_FALL; ActionFall(); return; } //wyvern behaviour if(m_PPet->getPetType()==PETTYPE_WYVERN){ if(WyvernIsHealing()){ m_PPathFind->LookAt(m_PPet->PMaster->loc.p); m_PPet->loc.zone->PushPacket(m_PPet, CHAR_INRANGE, new CEntityUpdatePacket(m_PPet, ENTITY_UPDATE)); if(m_PPet->PMaster->objtype == TYPE_PC){ ((CCharEntity*)m_PPet->PMaster)->pushPacket(new CPetSyncPacket((CCharEntity*)m_PPet->PMaster)); } return; } } if(m_PBattleTarget!=NULL){ m_ActionType = ACTION_ENGAGE; ActionEngage(); return; } float currentDistance = distance(m_PPet->loc.p, m_PPet->PMaster->loc.p); // this is broken until pet / mob relationship gets fixed // pets need to extend mob or be a mob because pet has no spell list! if(m_PPet->getPetType() == PETTYPE_AVATAR && m_PPet->m_Family == 104 && m_Tick >= m_LastActionTime + 30000 && currentDistance < PET_ROAM_DISTANCE * 2) { int16 spellID = 108; // define this so action picks it up m_PSpell = spell::GetSpell(spellID); m_PBattleSubTarget = m_PPet->PMaster; m_ActionType = ACTION_MAGIC_START; ActionMagicStart(); return; } if (currentDistance > PET_ROAM_DISTANCE) { if(currentDistance < 35.0f && m_PPathFind->PathAround(m_PPet->PMaster->loc.p, 2.0f, PATHFLAG_RUN | PATHFLAG_WALLHACK)) { m_PPathFind->FollowPath(); } else { m_PPathFind->WarpTo(m_PPet->PMaster->loc.p, PET_ROAM_DISTANCE); } m_PPet->loc.zone->PushPacket(m_PPet, CHAR_INRANGE, new CEntityUpdatePacket(m_PPet, ENTITY_UPDATE)); } }
void CAIMobDummy::ActionRoaming() { if (m_PMob->PEnmityContainer->GetHighestEnmity() != NULL) { m_ActionType = ACTION_ENGAGE; ActionEngage(); } else if (m_PMob->m_OwnerID != 0) { uint16 TargID = m_PMob->m_OwnerID & 0x0FFF; m_PBattleTarget = (CBattleEntity*)m_PMob->loc.zone->GetEntity(TargID, TYPE_PC | TYPE_MOB | TYPE_PET); // TODO: возможно необходимо добавлять цели базовое количество ненависти m_ActionType = ACTION_ENGAGE; ActionEngage(); } else if ((m_Tick - m_LastActionTime) > 45000 && m_PMob->m_Type != MOBTYPE_EVENT) { m_LastActionTime = m_Tick - rand()%30000; position_t RoamingPoint; RoamingPoint.x = m_PMob->m_SpawnPoint.x - 1 + rand()%2; RoamingPoint.y = m_PMob->m_SpawnPoint.y; RoamingPoint.z = m_PMob->m_SpawnPoint.z - 1 + rand()%2; m_PMob->loc.p.rotation = getangle(m_PMob->loc.p, RoamingPoint); battleutils::MoveTo(m_PMob, RoamingPoint, 1); m_PMob->loc.zone->PushPacket(m_PMob,CHAR_INRANGE, new CEntityUpdatePacket(m_PMob,ENTITY_UPDATE)); } if (m_PMob->GetDespawnTimer() > 0 && m_PMob->GetDespawnTimer() < m_Tick) { m_LastActionTime = m_Tick - 12000; m_PMob->PBattleAI->SetCurrentAction(ACTION_DEATH); } }
void CAIPetDummy::ActionRoaming() { if (m_PPet->PMaster == nullptr || m_PPet->PMaster->isDead()){ m_ActionType = ACTION_FALL; ActionFall(); return; } //automaton, wyvern if (m_PPet->getPetType() == PETTYPE_WYVERN || m_PPet->getPetType() == PETTYPE_AUTOMATON){ if (PetIsHealing()){ return; } } if (m_PBattleTarget != nullptr){ m_ActionType = ACTION_ENGAGE; ActionEngage(); return; } float currentDistance = distance(m_PPet->loc.p, m_PPet->PMaster->loc.p); // this is broken until pet / mob relationship gets fixed // pets need to extend mob or be a mob because pet has no spell list! if (m_PPet->getPetType() == PETTYPE_AVATAR && m_PPet->m_Family == 104 && m_Tick >= m_LastActionTime + 30000 && currentDistance < PET_ROAM_DISTANCE * 2) { int16 spellID = 108; // define this so action picks it up SetCurrentSpell(spellID); m_PBattleSubTarget = m_PPet->PMaster; m_ActionType = ACTION_MAGIC_START; ActionMagicStart(); return; } if (currentDistance > PET_ROAM_DISTANCE) { if (currentDistance < 35.0f && m_PPathFind->PathAround(m_PPet->PMaster->loc.p, 2.0f, PATHFLAG_RUN | PATHFLAG_WALLHACK)) { m_PPathFind->FollowPath(); } else if (m_PPet->GetSpeed() > 0) { m_PPathFind->WarpTo(m_PPet->PMaster->loc.p, PET_ROAM_DISTANCE); } } }
void CAIPetDummy::ActionRoaming() { if( m_PPet->PMaster==NULL || m_PPet->PMaster->isDead()){ m_ActionType = ACTION_FALL; ActionFall(); return; } //wyvern behaviour if(m_PPet->getPetType()==PETTYPE_WYVERN){ //see if master is engaged on something, if so, help attack if(m_PPet->PMaster->PBattleAI->GetBattleTarget()!=NULL){ m_PBattleTarget = m_PPet->PMaster->PBattleAI->GetBattleTarget(); } if(WyvernIsHealing()){ m_PPathFind->LookAt(m_PPet->PMaster->loc.p); m_PPet->loc.zone->PushPacket(m_PPet, CHAR_INRANGE, new CEntityUpdatePacket(m_PPet, ENTITY_UPDATE)); if(m_PPet->PMaster->objtype == TYPE_PC){ ((CCharEntity*)m_PPet->PMaster)->pushPacket(new CPetSyncPacket((CCharEntity*)m_PPet->PMaster)); } return; } } if(m_PBattleTarget!=NULL){ m_ActionType = ACTION_ENGAGE; ActionEngage(); return; } float currentDistance = distance(m_PPet->loc.p, m_PPet->PMaster->loc.p); if (currentDistance > PET_ROAM_DISTANCE) { if(currentDistance < 35.0f && m_PPathFind->PathAround(m_PPet->PMaster->loc.p, 2.0f, PATHFLAG_RUN | PATHFLAG_WALLHACK)) { m_PPathFind->FollowPath(); } else { m_PPathFind->WarpTo(m_PPet->PMaster->loc.p, PET_ROAM_DISTANCE); } m_PPet->loc.zone->PushPacket(m_PPet, CHAR_INRANGE, new CEntityUpdatePacket(m_PPet, ENTITY_UPDATE)); } }
void CAIUltimateSummon::CheckCurrentAction(uint32 tick) { m_Tick = tick; switch(m_ActionType) { case ACTION_NONE: break; case ACTION_ROAMING: ActionRoaming(); break; case ACTION_DEATH: ActionDeath(); break; case ACTION_SPAWN: ActionSpawn(); break; case ACTION_FALL: ActionFall(); break; case ACTION_ENGAGE: ActionEngage(); break; case ACTION_ATTACK: ActionAttack(); break; case ACTION_SLEEP: ActionSleep(); break; case ACTION_MOBABILITY_START: ActionAbilityStart(); break; case ACTION_MOBABILITY_USING: ActionAbilityUsing(); break; case ACTION_MOBABILITY_FINISH: ActionAbilityFinish(); break; case ACTION_MOBABILITY_INTERRUPT: ActionAbilityInterrupt(); break; default : DSP_DEBUG_BREAK_IF(true); } }
void CAICharCharm::ActionRoaming() { if (m_PChar->PMaster->PBattleAI->GetBattleTarget() != nullptr){ m_PBattleTarget = m_PChar->PMaster->PBattleAI->GetBattleTarget(); m_ActionType = ACTION_ENGAGE; ActionEngage(); return; } m_PChar->m_TargID = m_PChar->PMaster->targid; float currentDistance = distance(m_PChar->loc.p, m_PChar->PMaster->loc.p); if (currentDistance > PET_ROAM_DISTANCE) { if (currentDistance < 35.0f && m_PPathFind->PathAround(m_PChar->PMaster->loc.p, 2.0f, PATHFLAG_RUN | PATHFLAG_WALLHACK)) { m_PPathFind->FollowPath(); } else if (m_PChar->GetSpeed() > 0) { m_PPathFind->WarpTo(m_PChar->PMaster->loc.p, PET_ROAM_DISTANCE); } } }
void CAIMobDummy::CheckCurrentAction(uint32 tick) { m_Tick = tick; switch(m_ActionType) { case ACTION_NONE: break; case ACTION_ROAMING: ActionRoaming(); break; case ACTION_ENGAGE: ActionEngage(); break; case ACTION_DISENGAGE: ActionDisengage(); break; case ACTION_FALL: ActionFall(); break; case ACTION_DROPITEMS: ActionDropItems(); break; case ACTION_DEATH: ActionDeath(); break; case ACTION_FADE_OUT: ActionFadeOut(); break; case ACTION_SPAWN: ActionSpawn(); break; case ACTION_ATTACK: ActionAttack(); break; case ACTION_MOBABILITY_START: ActionAbilityStart(); break; case ACTION_MOBABILITY_FINISH: ActionAbilityFinish(); break; case ACTION_MOBABILITY_INTERRUPT: ActionAbilityInterrupt(); break; default : DSP_DEBUG_BREAK_IF(true); } }