Skip to content

Commit

Permalink
Merge pull request #4684 from WinterSolstice8/add_target_dead_players
Browse files Browse the repository at this point in the history
[core] Add ability for pet/player JA to target dead players
  • Loading branch information
TeoTwawki authored Nov 5, 2023
2 parents 95a3be0 + acea426 commit 063a69e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/map/entities/charentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1298,9 +1298,16 @@ void CCharEntity::OnAbility(CAbilityState& state, action_t& action)
return;
}

uint8 findFlags = 0;

if ((PAbility->getValidTarget() & TARGET_PLAYER_DEAD) == TARGET_PLAYER_DEAD)
{
findFlags |= FINDFLAGS_DEAD;
}

auto* PTarget = static_cast<CBattleEntity*>(state.GetTarget());
PAI->TargetFind->reset();
PAI->TargetFind->findSingleTarget(PTarget);
PAI->TargetFind->findSingleTarget(PTarget, findFlags);

// Check if target is untargetable
if (PAI->TargetFind->m_targets.size() == 0)
Expand Down Expand Up @@ -1527,7 +1534,7 @@ void CCharEntity::OnAbility(CAbilityState& state, action_t& action)

float distance = PAbility->getRange();

PAI->TargetFind->findWithinArea(this, AOE_RADIUS::ATTACKER, distance);
PAI->TargetFind->findWithinArea(this, AOE_RADIUS::ATTACKER, distance, findFlags);

uint16 prevMsg = 0;
for (auto&& PTargetFound : PAI->TargetFind->m_targets)
Expand Down
5 changes: 5 additions & 0 deletions src/map/entities/petentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,11 @@ void CPetEntity::OnPetSkillFinished(CPetSkillState& state, action_t& action)
findFlags |= FINDFLAGS_IGNORE_BATTLEID;
}

if ((PSkill->getValidTargets() & TARGET_PLAYER_DEAD) == TARGET_PLAYER_DEAD)
{
findFlags |= FINDFLAGS_DEAD;
}

action.id = id;
action.actiontype = (ACTIONTYPE)PSkill->getSkillFinishCategory();
action.actionid = PSkill->getID();
Expand Down

0 comments on commit 063a69e

Please sign in to comment.