From b8b97c745a9b9cdb3c92614f97d92a905ab94245 Mon Sep 17 00:00:00 2001 From: DMD Date: Tue, 12 Sep 2017 23:28:25 +0300 Subject: [PATCH] Fixed missing S_Attack_Made in DealAttackDamage --- TemplePlus/ability_fixes.cpp | 36 ++++++++++++++++++++++++++++++++++++ TemplePlus/condition.h | 1 + TemplePlus/damage.cpp | 1 + 3 files changed, 38 insertions(+) diff --git a/TemplePlus/ability_fixes.cpp b/TemplePlus/ability_fixes.cpp index b895ddb9c..912c0bf7f 100644 --- a/TemplePlus/ability_fixes.cpp +++ b/TemplePlus/ability_fixes.cpp @@ -28,8 +28,15 @@ class AbilityConditionFixes : public TempleFix { static int BootsOfSpeedNewday(DispatcherCallbackArgs args); static int BootsOfSpeedBeginRound(DispatcherCallbackArgs args); + static int CombatExpertiseAcBonus(DispatcherCallbackArgs args); + static int TacticalAbusePrevention(DispatcherCallbackArgs args); // Combat Expertise / Fight Defensively + + void apply() override { + replaceFunction(0x100F7ED0, TacticalAbusePrevention); + replaceFunction(0x100F7E70, CombatExpertiseAcBonus); + replaceFunction(0x100CB890, GrappledMoveSpeed); // fixed Grappled when the frog is dead { SubDispDefNew sdd; @@ -333,3 +340,32 @@ int AbilityConditionFixes::BootsOfSpeedBeginRound(DispatcherCallbackArgs args){ gameSystems->GetParticleSys().End(partsysId); return 0; } + +int AbilityConditionFixes::CombatExpertiseAcBonus(DispatcherCallbackArgs args){ + + auto expertiseAmt = args.GetCondArg(0); + if (!expertiseAmt){ + return 0; + } + + auto attackMade = args.GetCondArg(1); + if (!attackMade){ + return 0; + } + + GET_DISPIO(dispIOTypeAttackBonus, DispIoAttackBonus); + dispIo->bonlist.AddBonusFromFeat(expertiseAmt, 8, 114, FEAT_COMBAT_EXPERTISE); + + return 0; +} + +int AbilityConditionFixes::TacticalAbusePrevention(DispatcherCallbackArgs args) +{ + GET_DISPIO(dispIoTypeSendSignal, DispIoD20Signal); + auto damPkt = (DispIoDamage*)dispIo->data1; + if (damPkt->attackPacket.flags & D20CAF_RANGED){ + return 0; + } + args.SetCondArg(1, 1); + return 0; +} diff --git a/TemplePlus/condition.h b/TemplePlus/condition.h index 96f9c9c81..f2bc40108 100644 --- a/TemplePlus/condition.h +++ b/TemplePlus/condition.h @@ -332,6 +332,7 @@ int TacticalOptionAbusePrevention(DispatcherCallbackArgs args); int CombatExpertiseRadialMenu(DispatcherCallbackArgs args); int CombatExpertiseSet(DispatcherCallbackArgs args); + int BarbarianRageStatBonus(DispatcherCallbackArgs args); int BarbarianRageSaveBonus(DispatcherCallbackArgs args); int BarbarianDamageResistance(DispatcherCallbackArgs args); diff --git a/TemplePlus/damage.cpp b/TemplePlus/damage.cpp index 03079826a..a373b0a3e 100644 --- a/TemplePlus/damage.cpp +++ b/TemplePlus/damage.cpp @@ -407,6 +407,7 @@ int Damage::DealAttackDamage(objHndl attacker, objHndl tgt, int d20Data, D20CAF temple::GetRef(0x10016A90)(tgt, evtObjDam.damage.dice[i].type, evtObjDam.damage.dice[i].rolledDamage); } + d20Sys.d20SendSignal(attacker, DK_SIG_Attack_Made, (int)&evtObjDam, 0); // signal events if (!isUnconsciousAlready && critterSys.IsDeadOrUnconscious(tgt)){