Skip to content

Commit

Permalink
Reflect only physical damage
Browse files Browse the repository at this point in the history
  • Loading branch information
Jhobean committed Oct 16, 2023
1 parent 53f60e9 commit ab95a24
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 23 deletions.
40 changes: 28 additions & 12 deletions src/game/chars/CCharAct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,22 @@ void CChar::OnRemoveObj( CSObjContRec* pObRec ) // Override this = called when r
ModPropNum(pCCPChar, PROPCH_DAMPOISON, - pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMPOISON, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_DAMENERGY, - pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));

ModPropNum(pCCPChar, PROPCH_HITLEECHMANA, - pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITLEECHSTAM, - pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));

ModPropNum(pCCPChar, PROPCH_HITAREAPHYSICAL, - pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITAREAFIRE, - pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITAREACOLD, - pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITAREAPOISON, - pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITAREAENERGY, - pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));

ModPropNum(pCCPChar, PROPCH_HITFIREBALL, - pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITHARM, - pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITLIGHTNING, - pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITMAGICARROW, - pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));

ModPropNum(pCCPChar, PROPCH_REFLECTPHYSICALDAM, - pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));

if (pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_NIGHTSIGHT, pItemBaseCCPItemEquippable))
{
StatFlag_Mod(STATF_NIGHTSIGHT, 0);
Expand Down Expand Up @@ -2197,21 +2213,21 @@ bool CChar::ItemEquip( CItem * pItem, CChar * pCharMsg, bool fFromDClick )
ModPropNum(pCCPChar, PROPCH_DAMPOISON, + pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMPOISON, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_DAMENERGY, + pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));

ModPropNum(pCCPChar, PROPCH_HITLEECHMANA, +pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITLEECHSTAM, +pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITLEECHMANA, + pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITLEECHSTAM, + pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));

ModPropNum(pCCPChar, PROPCH_HITAREAPHYSICAL, +pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITAREAFIRE, +pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITAREACOLD, +pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITAREAPOISON, +pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITAREAENERGY, +pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITAREAPHYSICAL, + pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITAREAFIRE, + pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITAREACOLD, + pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITAREAPOISON, + pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITAREAENERGY, + pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));

ModPropNum(pCCPChar, PROPCH_HITFIREBALL, +pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITHARM, +pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITLIGHTNING, +pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITMAGICARROW, +pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITFIREBALL, + pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITHARM, + pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITLIGHTNING, + pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_HITMAGICARROW, + pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));

ModPropNum(pCCPChar, PROPCH_REFLECTPHYSICALDAM, +pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));
ModPropNum(pCCPChar, PROPCH_REFLECTPHYSICALDAM, + pItem->GetPropNum(pItemCCPItemEquippable, PROPIEQUIP_DAMENERGY, pItemBaseCCPItemEquippable));



Expand Down
21 changes: 10 additions & 11 deletions src/game/chars/CCharFight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2202,17 +2202,16 @@ WAR_SWING_TYPE CChar::Fight_Hit( CChar * pCharTarg )
int iTargReflectPhysicalDam =pCharTarg->GetPropNum(pCCPCharTarg, PROPCH_REFLECTPHYSICALDAM, pBaseCCPCharTarg);
if (iTargReflectPhysicalDam)
{
// REFLECTPHYSICALDAM suppose to reflect only physical? How we block other damage here?
OnTakeDamage(
iDmg * iTargReflectPhysicalDam / 100,
this,
iDmgType,
(int)GetPropNum(pCCPChar, PROPCH_DAMPHYSICAL, pBaseCCPChar),
(int)GetPropNum(pCCPChar, PROPCH_DAMFIRE, pBaseCCPChar),
(int)GetPropNum(pCCPChar, PROPCH_DAMCOLD, pBaseCCPChar),
(int)GetPropNum(pCCPChar, PROPCH_DAMPOISON, pBaseCCPChar),
(int)GetPropNum(pCCPChar, PROPCH_DAMENERGY, pBaseCCPChar)
);
// REFLECTPHYSICALDAM suppose to reflect only physical (A physical blow of some sort.)
if (iDmgType & (DAMAGE_HIT_BLUNT | DAMAGE_HIT_PIERCE | DAMAGE_HIT_SLASH))
{
OnTakeDamage(
iDmg * iTargReflectPhysicalDam / 100,
this,
iDmgType,
100,0,0,0,0
);
}
}

if (pWeapon)
Expand Down

0 comments on commit ab95a24

Please sign in to comment.