Skip to content

Commit

Permalink
Add mypet check on area damage and capped MAX 250 on Reflec physical
Browse files Browse the repository at this point in the history
  • Loading branch information
Jhobean committed Oct 26, 2023
1 parent ab1404c commit 97c3f04
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/game/chars/CCharFight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,8 @@ int CChar::OnTakeDamage( int iDmg, CChar * pSrc, DAMAGE_TYPE uType, int iDmgPhys
// Preventing recurrent reflection with DAMAGE_REACTIVE.
if (!(uType & DAMAGE_REACTIVE))
{
int iReflectPhysical = GetPropNum(pCCPChar, PROPCH_REFLECTPHYSICALDAM, pBaseCCPChar);
int iReflectPhysical = minimum(GetPropNum(pCCPChar, PROPCH_REFLECTPHYSICALDAM, pBaseCCPChar),250); //Capped to 250

if (iReflectPhysical)
{
int iReflectPhysicalDam = (iDmg * iReflectPhysical) / 100;
Expand Down Expand Up @@ -1000,8 +1001,7 @@ void CChar::OnTakeDamageArea(int iDmg, CChar* pSrc, DAMAGE_TYPE uType, int iDmgP
ADDTOCALLSTACK("CChar::OnTakeDamageArea");

bool fMakeSound = false;
// Like this area damage touch everyone! Pet, NPC etc We should ignore pet and Criminal action?


int iDistance = 5;
if (IsAosFlagEnabled(FEATURE_AOS_DAMAGE))
iDistance=10; // 5 for ML and 10 for aos
Expand All @@ -1012,10 +1012,14 @@ void CChar::OnTakeDamageArea(int iDmg, CChar* pSrc, DAMAGE_TYPE uType, int iDmgP
CChar* pChar = AreaChars.GetChar();
if (!pChar)
break;
if (!pChar->CanSeeLOS(pSrc))
break;
if ((pChar == this) || (pChar == pSrc))
continue;
if (pChar->NPC_IsOwnedBy(pSrc,false)) // it's my pet?
continue;

if (!pChar->CanSeeLOS(pSrc)) //Avoid hit someone in nearby house
continue;
// FIXME. On UO guide damage occur to nearby targets the wielder can legally attack. How can add legaly check?

pChar->OnTakeDamage(iDmg, pSrc, uType, iDmgPhysical, iDmgFire, iDmgCold, iDmgPoison, iDmgEnergy);
pChar->Effect(EFFECT_OBJ, ITEMID_FX_SPARKLE_2, this, 1, 15, false, effectHue);
Expand Down

0 comments on commit 97c3f04

Please sign in to comment.