Skip to content

Commit

Permalink
Only change missile behavior in arenas
Browse files Browse the repository at this point in the history
  • Loading branch information
kphoenix137 committed Feb 26, 2024
1 parent b8d8e76 commit 1db35df
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
22 changes: 12 additions & 10 deletions Source/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -949,16 +949,18 @@ bool DoRangeAttack(Player &player)
arrows = 2;
}

// Obtain target position upon arrow shot, rather than when initiating the cast for accuracy
auto targetId = player.targetId;
if (player.hasPlayerTarget) {
assert(targetId >= 0 && targetId < Players.size());
auto &targetPlayer = Players[player.targetId];
player.position.temp = targetPlayer.position.future;
} else if (player.hasMonsterTarget) {
assert(targetId >= 0 && targetId < MaxMonsters);
auto &targetMonster = Monsters[player.targetId];
player.position.temp = targetMonster.position.future;
// PVP REBALANCE: Obtain target position upon arrow shot, rather than when initiating the cast for accuracy in arenas.
if (player.isOnArenaLevel()) {
auto targetId = player.targetId;
if (player.hasPlayerTarget) {
assert(targetId >= 0 && targetId < Players.size());
auto &targetPlayer = Players[player.targetId];
player.position.temp = targetPlayer.position.future;
} else if (player.hasMonsterTarget) {
assert(targetId >= 0 && targetId < MaxMonsters);
auto &targetMonster = Monsters[player.targetId];
player.position.temp = targetMonster.position.future;
}
}

for (int arrow = 0; arrow < arrows; arrow++) {
Expand Down
16 changes: 9 additions & 7 deletions Source/spells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,15 @@ void CastSpell(Player &player, SpellID spl, WorldTilePosition src, WorldTilePosi
dir = player.tempDirection;
}

// Obtain target position upon spell effect, rather than when initiating the cast for accuracy
if (hasPlayerTarget) {
assert(targetId >= 0 && targetId < Players.size());
dst = Players[targetId].position.future;
} else if (hasMonsterTarget) {
assert(targetId >= 0 && targetId < MaxMonsters);
dst = Monsters[targetId].position.future;
// PVP REBALANCE: Obtain target position upon spell effect, rather than when initiating the cast for accuracy in arenas.
if (player.isOnArenaLevel()) {
if (hasPlayerTarget) {
assert(targetId >= 0 && targetId < Players.size());
dst = Players[targetId].position.future;
} else if (hasMonsterTarget) {
assert(targetId >= 0 && targetId < MaxMonsters);
dst = Monsters[targetId].position.future;
}
}

bool fizzled = false;
Expand Down

0 comments on commit 1db35df

Please sign in to comment.