void CAutomatonEntity::OnMobSkillFinished(CMobSkillState& state, action_t& action) { CMobEntity::OnMobSkillFinished(state, action); auto PSkill = state.GetSkill(); auto PTarget = static_cast<CBattleEntity*>(state.GetTarget()); // Ranged attack skill up if (PSkill->getID() == 1949 && !PSkill->hasMissMsg()) { puppetutils::TrySkillUP(this, SKILL_AUTOMATON_RANGED, PTarget->GetMLevel()); } }
void CMobEntity::OnMobSkillFinished(CMobSkillState& state, action_t& action) { auto PSkill = state.GetSkill(); auto PTarget = static_cast<CBattleEntity*>(state.GetTarget()); static_cast<CMobController*>(PAI->GetController())->TapDeaggroTime(); // store the skill used m_UsedSkillIds[PSkill->getID()] = GetMLevel(); PAI->TargetFind->reset(); float distance = PSkill->getDistance(); uint8 findFlags = 0; if (PSkill->getFlag() & SKILLFLAG_HIT_ALL) { findFlags |= FINDFLAGS_HIT_ALL; } // Mob buff abilities also hit monster's pets if (PSkill->getValidTargets() == TARGET_SELF) { findFlags |= FINDFLAGS_PET; } action.id = id; if (objtype == TYPE_PET && static_cast<CPetEntity*>(this)->getPetType() == PETTYPE_JUG_PET && static_cast<CPetEntity*>(this)->getPetType() == PETTYPE_AUTOMATON) action.actiontype = ACTION_PET_MOBABILITY_FINISH; else if (PSkill->getID() < 256) action.actiontype = ACTION_WEAPONSKILL_FINISH; else action.actiontype = ACTION_MOBABILITY_FINISH; action.actionid = PSkill->getID(); if (PTarget && PAI->TargetFind->isWithinRange(&PTarget->loc.p, distance)) { if (PSkill->isAoE()) { PAI->TargetFind->findWithinArea(PTarget, (AOERADIUS)PSkill->getAoe(), PSkill->getRadius(), findFlags); } else if (PSkill->isConal()) { float angle = 45.0f; PAI->TargetFind->findWithinCone(PTarget, distance, angle, findFlags); } else { PAI->TargetFind->findSingleTarget(PTarget, findFlags); } } else { action.actiontype = ACTION_MOBABILITY_INTERRUPT; actionList_t& actionList = action.getNewActionList(); actionList.ActionTargetID = id; actionTarget_t& actionTarget = actionList.getNewActionTarget(); actionTarget.animation = PSkill->getID(); return; } uint16 actionsLength = PAI->TargetFind->m_targets.size(); PSkill->setTotalTargets(actionsLength); PSkill->setTP(state.GetSpentTP()); PSkill->setHPP(GetHPP()); uint16 msg = 0; uint16 defaultMessage = PSkill->getMsg(); bool first {true}; for (auto&& PTarget : PAI->TargetFind->m_targets) { actionList_t& list = action.getNewActionList(); list.ActionTargetID = PTarget->id; actionTarget_t& target = list.getNewActionTarget(); list.ActionTargetID = PTarget->id; target.reaction = REACTION_HIT; target.speceffect = SPECEFFECT_HIT; target.animation = PSkill->getAnimationID(); target.messageID = PSkill->getMsg(); // reset the skill's message back to default PSkill->setMsg(defaultMessage); if (objtype == TYPE_PET && static_cast<CPetEntity*>(this)->getPetType() != PETTYPE_JUG_PET) { target.animation = PSkill->getPetAnimationID(); target.param = luautils::OnPetAbility(PTarget, this, PSkill, PMaster, &action); } else { target.param = luautils::OnMobWeaponSkill(PTarget, this, PSkill); } if (msg == 0) { msg = PSkill->getMsg(); } else { msg = PSkill->getAoEMsg(); } target.messageID = msg; if (PSkill->hasMissMsg()) { target.reaction = REACTION_MISS; target.speceffect = SPECEFFECT_NONE; if (msg = PSkill->getAoEMsg()) msg = 282; } else { target.reaction = REACTION_HIT; } if (target.speceffect & SPECEFFECT_HIT) { target.speceffect = SPECEFFECT_RECOIL; target.knockback = PSkill->getKnockback(); if (first && (PSkill->getSkillchain() != 0)) { CWeaponSkill* PWeaponSkill = battleutils::GetWeaponSkill(PSkill->getSkillchain()); if (PWeaponSkill) { SUBEFFECT effect = battleutils::GetSkillChainEffect(PTarget, PWeaponSkill); if (effect != SUBEFFECT_NONE) { int32 skillChainDamage = battleutils::TakeSkillchainDamage(this, PTarget, target.param); if (skillChainDamage < 0) { target.addEffectParam = -skillChainDamage; target.addEffectMessage = 384 + effect; } else { target.addEffectParam = skillChainDamage; target.addEffectMessage = 287 + effect; } target.additionalEffect = effect; } } first = false; } } PTarget->StatusEffectContainer->DelStatusEffectsByFlag(EFFECTFLAG_DETECTABLE); } }