Skip to content

Commit

Permalink
Fix TakeSwipeLungeDamage, CalculateBaseTP parameter types
Browse files Browse the repository at this point in the history
TakeSwipeLungeDamage should be CBattleEntity type for Attacker, changed from CCharEntity.

CalculateBaseTP had signature mismatch between defined/declared (Defined: int, Declared: int32) for delay.  Changed all to int32.
  • Loading branch information
claywar committed Jan 5, 2025
1 parent 5ed8232 commit 0236b19
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/map/lua/lua_baseentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14770,8 +14770,8 @@ int32 CLuaBaseEntity::takeSwipeLungeDamage(CLuaBaseEntity* caster, int32 damage,
return 0;
}

auto* PChar = dynamic_cast<CCharEntity*>(caster->m_PBaseEntity);
if (!PChar)
auto* PBattleAttacker = dynamic_cast<CBattleEntity*>(caster->m_PBaseEntity);
if (!PBattleAttacker)
{
ShowWarning("Invalid entity type passed as Attacker (%s).", m_PBaseEntity->getName());
return 0;
Expand All @@ -14780,7 +14780,7 @@ int32 CLuaBaseEntity::takeSwipeLungeDamage(CLuaBaseEntity* caster, int32 damage,
ATTACK_TYPE attackType = static_cast<ATTACK_TYPE>(atkType);
DAMAGE_TYPE damageType = static_cast<DAMAGE_TYPE>(dmgType);

return battleutils::TakeSwipeLungeDamage(PBattleDefender, PChar, damage, attackType, damageType);
return battleutils::TakeSwipeLungeDamage(PBattleDefender, PBattleAttacker, damage, attackType, damageType);
}

/************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion src/map/utils/battleutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2611,7 +2611,7 @@ namespace battleutils
* *
************************************************************************/

int32 TakeSwipeLungeDamage(CBattleEntity* PDefender, CCharEntity* PAttacker, int32 damage, ATTACK_TYPE attackType, DAMAGE_TYPE damageType)
int32 TakeSwipeLungeDamage(CBattleEntity* PDefender, CBattleEntity* PAttacker, int32 damage, ATTACK_TYPE attackType, DAMAGE_TYPE damageType)
{
damage = CheckAndApplyDamageCap(damage, PDefender);

Expand Down
4 changes: 2 additions & 2 deletions src/map/utils/battleutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ namespace battleutils
bool primary, float tpMultiplier, uint16 bonusTP, float targetTPMultiplier);
int32 TakeSkillchainDamage(CBattleEntity* PAttacker, CBattleEntity* PDefender, int32 lastSkillDamage, CBattleEntity* taChar);
int32 TakeSpellDamage(CBattleEntity* PDefender, CBattleEntity* PAttacker, CSpell* PSpell, int32 damage, ATTACK_TYPE attackType, DAMAGE_TYPE damageType);
int32 TakeSwipeLungeDamage(CBattleEntity* PDefender, CCharEntity* PAttacker, int32 damage, ATTACK_TYPE attackType, DAMAGE_TYPE damageType);
int32 TakeSwipeLungeDamage(CBattleEntity* PDefender, CBattleEntity* PAttacker, int32 damage, ATTACK_TYPE attackType, DAMAGE_TYPE damageType);

bool TryInterruptSpell(CBattleEntity* PAttacker, CBattleEntity* PDefender, CSpell* PSpell);
float GetRangedDamageRatio(CBattleEntity* PAttacker, CBattleEntity* PDefender, bool isCritical, int16 bonusRangedAttack);
Expand All @@ -181,7 +181,7 @@ namespace battleutils
int16 GetEnmityModCure(int16 level);
bool isValidSelfTargetWeaponskill(int wsid);
bool CanUseWeaponskill(CCharEntity* PChar, CWeaponSkill* PSkill);
int16 CalculateBaseTP(int delay);
int16 CalculateBaseTP(int32 delay);
void GenerateCureEnmity(CBattleEntity* PSource, CBattleEntity* PTarget, int32 amount, int32 fixedCE = 0, int32 fixedVE = 0);
void GenerateInRangeEnmity(CBattleEntity* PSource, int16 CE, int16 VE);

Expand Down

0 comments on commit 0236b19

Please sign in to comment.