Skip to content

Commit

Permalink
Fixed missing S_Attack_Made in DealAttackDamage
Browse files Browse the repository at this point in the history
  • Loading branch information
DMD authored and DMD committed Sep 12, 2017
1 parent 9a56b87 commit b8b97c7
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
36 changes: 36 additions & 0 deletions TemplePlus/ability_fixes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
1 change: 1 addition & 0 deletions TemplePlus/condition.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions TemplePlus/damage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ int Damage::DealAttackDamage(objHndl attacker, objHndl tgt, int d20Data, D20CAF
temple::GetRef<void(__cdecl)(objHndl, DamageType, int)>(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)){
Expand Down

0 comments on commit b8b97c7

Please sign in to comment.