Skip to content

Commit

Permalink
Exclude more invalid indices from damage_target
Browse files Browse the repository at this point in the history
  • Loading branch information
NQNStudios authored and CelticMinstrel committed Feb 24, 2025
1 parent b505dc5 commit 756324a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/game/boe.combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4022,10 +4022,14 @@ bool monst_cast_priest(cCreature *caster,short targ) {
}

short damage_target(short target,short dam,eDamageType type,short sound_type, bool do_print, short who_hit, eRace race) {
if(target == 6) return 0;
if(target < 6)
return damage_pc(univ.party[target],dam,type,race,sound_type, do_print);
else return damage_monst(univ.town.monst[target - 100], who_hit, dam, type,sound_type, do_print);
if(target >= 6 && target < 100) return 0;
if(target < 6){
return damage_pc(univ.party[target], dam, type, race, sound_type, do_print);
}else{
int monst_idx = target - 100;
if(monst_idx >= univ.town.monst.size()) return 0;
return damage_monst(univ.town.monst[monst_idx], who_hit, dam, type, sound_type, do_print);
}
}

short damage_target(iLiving& target,short dam,eDamageType type,short sound_type, bool do_print, short who_hit, eRace race) {
Expand Down

0 comments on commit 756324a

Please # to comment.