Skip to content

Commit

Permalink
Merge pull request #767 from dolio/fix/racial-saves
Browse files Browse the repository at this point in the history
Fix double stacking NPC save bonus
  • Loading branch information
doug1234 authored Feb 28, 2024
2 parents 5087db1 + 754e193 commit 23a33f0
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions TemplePlus/damage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ static struct DamageAddresses : temple::AddressTable {
int (__cdecl*HealSubdual)(objHndl target, int amount);

int (__cdecl*DoSpellDamage)(objHndl victim, objHndl attacker, uint32_t dmgDice, DamageType type, int attackPowerType, int reduction, int damageDescMesKey, int actionType, int spellId, int flags);

bool (__cdecl *SavingThrow)(objHndl obj, objHndl attacker, int dc, SavingThrowType type, int flags);

bool (__cdecl *SavingThrowSpell)(objHndl obj, objHndl attacker, int dc, SavingThrowType type, int flags, int spellId);

Expand Down Expand Up @@ -110,7 +108,6 @@ static struct DamageAddresses : temple::AddressTable {
rebase(HealSpell, 0x100B81D0);
rebase(DoSpellDamage, 0x100B7F80);
rebase(HealSubdual, 0x100B9030);
rebase(SavingThrow, 0x100B4F20);
rebase(SavingThrowSpell, 0x100B83C0);
rebase(ReflexSaveAndDamage, 0x100B9500);

Expand Down Expand Up @@ -161,6 +158,10 @@ class DamageHooks: TempleFix
replaceFunction<int(__cdecl)(objHndl, objHndl, int, D20CAF, D20ActionType)>(0x100B7950, [](objHndl attacker, objHndl tgt, int d20Data, D20CAF flags, D20ActionType actionType) {
return damage.DealAttackDamage(attacker, tgt, d20Data, flags, actionType);
});

replaceFunction<bool(__cdecl)(objHndl, objHndl, int, int, int)>(0x100B4F20, [](objHndl tgt, objHndl atk, int dc, int saveType, int flags) {
return damage.SavingThrow(tgt, atk, dc, static_cast<SavingThrowType>(saveType), flags);
});
}
} damageHooks;

Expand Down Expand Up @@ -891,8 +892,6 @@ bool Damage::SavingThrow(objHndl handle, objHndl attacker, int dc, SavingThrowTy
return false; // natural 1 - always fails
}
return saveThrowMod + diceResult >= dc;

// return addresses.SavingThrow(handle, attacker, dc, saveType, flags);
}

bool Damage::SavingThrowSpell(objHndl obj, objHndl attacker, int dc, SavingThrowType type, int flags, int spellId) {
Expand Down

0 comments on commit 23a33f0

Please sign in to comment.