Adds OnDamage parameters for old and new health.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2021-11-21 14:16:57 +01:00
parent 0b8ebcc778
commit af450dceb4
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
4 changed files with 12 additions and 8 deletions

View File

@ -342,11 +342,13 @@ CreatureLib::Battling::BattleScript* AngelScriptScript::Clone(const ArbUt::Optio
return new AngelScriptScript(owner, GetAngelscriptOwner()->GetType(), _resolver, _type, obj, _ctxPool); return new AngelScriptScript(owner, GetAngelscriptOwner()->GetType(), _resolver, _type, obj, _ctxPool);
} }
void AngelScriptScript::OnDamage(CreatureLib::Battling::Creature* creature, void AngelScriptScript::OnDamage(CreatureLib::Battling::Creature* creature, CreatureLib::Battling::DamageSource source,
CreatureLib::Battling::DamageSource source) { [[maybe_unused]] u32 oldHealth, [[maybe_unused]] u32 newHealth) {
CALL_HOOK(OnDamage, { CALL_HOOK(OnDamage, {
ctx->SetArgObject(0, (void*)creature); ctx->SetArgObject(0, (void*)creature);
ctx->SetArgDWord(1, (i32)source); ctx->SetArgDWord(1, (i32)source);
ctx->SetArgDWord(2, oldHealth);
ctx->SetArgDWord(3, newHealth);
}) })
} }
void AngelScriptScript::OnFaint(CreatureLib::Battling::Creature* creature, CreatureLib::Battling::DamageSource source) { void AngelScriptScript::OnFaint(CreatureLib::Battling::Creature* creature, CreatureLib::Battling::DamageSource source) {

View File

@ -82,8 +82,8 @@ public:
void PreventSecondaryEffects(const CreatureLib::Battling::ExecutingAttack* attack, void PreventSecondaryEffects(const CreatureLib::Battling::ExecutingAttack* attack,
CreatureLib::Battling::Creature* target, uint8_t hitNumber, bool* outResult) override; CreatureLib::Battling::Creature* target, uint8_t hitNumber, bool* outResult) override;
void OnIncomingHit(const CreatureLib::Battling::ExecutingAttack* attack, void OnIncomingHit(const CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target,
CreatureLib::Battling::Creature* target, uint8_t hitNumber) override; uint8_t hitNumber) override;
void OnFaintingOpponent(const CreatureLib::Battling::ExecutingAttack* attack, void OnFaintingOpponent(const CreatureLib::Battling::ExecutingAttack* attack,
CreatureLib::Battling::Creature* target, u8 hitNumber) override; CreatureLib::Battling::Creature* target, u8 hitNumber) override;
void OnSecondaryEffect(const CreatureLib::Battling::ExecutingAttack* attack, void OnSecondaryEffect(const CreatureLib::Battling::ExecutingAttack* attack,
@ -124,7 +124,8 @@ public:
void PreventOpponentRunAway(const CreatureLib::Battling::FleeTurnChoice* choice, bool* result) override; void PreventOpponentRunAway(const CreatureLib::Battling::FleeTurnChoice* choice, bool* result) override;
void PreventOpponentSwitch(const CreatureLib::Battling::SwitchTurnChoice* choice, bool* outResult) override; void PreventOpponentSwitch(const CreatureLib::Battling::SwitchTurnChoice* choice, bool* outResult) override;
void OnEndTurn() override; void OnEndTurn() override;
void OnDamage(CreatureLib::Battling::Creature* creature, CreatureLib::Battling::DamageSource source) override; void OnDamage(CreatureLib::Battling::Creature* creature, CreatureLib::Battling::DamageSource source,
[[maybe_unused]] u32 oldHealth, [[maybe_unused]] u32 newHealth) override;
void OnFaint(CreatureLib::Battling::Creature* creature, CreatureLib::Battling::DamageSource source) override; void OnFaint(CreatureLib::Battling::Creature* creature, CreatureLib::Battling::DamageSource source) override;
void OnSwitchIn(CreatureLib::Battling::Creature* creature) override; void OnSwitchIn(CreatureLib::Battling::Creature* creature) override;

View File

@ -170,7 +170,8 @@ public:
SCRIPT_HOOK_FUNCTION(PreventOpponentSwitch, "void PreventOpponentSwitch(SwitchTurnChoice@ choice, bool& result)"); SCRIPT_HOOK_FUNCTION(PreventOpponentSwitch, "void PreventOpponentSwitch(SwitchTurnChoice@ choice, bool& result)");
SCRIPT_HOOK_FUNCTION(OnEndTurn, "void OnEndTurn()"); SCRIPT_HOOK_FUNCTION(OnEndTurn, "void OnEndTurn()");
SCRIPT_HOOK_FUNCTION(OnDamage, "void OnDamage(Pokemon@ pokemon, DamageSource damageSource)"); SCRIPT_HOOK_FUNCTION(OnDamage,
"void OnDamage(Pokemon@ pokemon, DamageSource damageSource, uint oldHealth, uint newHealth)");
SCRIPT_HOOK_FUNCTION(OnFaint, "void OnFaint(Pokemon@ pokemon, DamageSource damageSource)"); SCRIPT_HOOK_FUNCTION(OnFaint, "void OnFaint(Pokemon@ pokemon, DamageSource damageSource)");
SCRIPT_HOOK_FUNCTION(BlockWeather, "void BlockWeather(Battle@ battle, bool& result)"); SCRIPT_HOOK_FUNCTION(BlockWeather, "void BlockWeather(Battle@ battle, bool& result)");
SCRIPT_HOOK_FUNCTION(OnSwitchIn, "void OnSwitchIn(Pokemon@ pokemon)"); SCRIPT_HOOK_FUNCTION(OnSwitchIn, "void OnSwitchIn(Pokemon@ pokemon)");

View File

@ -54,7 +54,7 @@ shared abstract class PkmnScript {
void PreventOpponentRunAway(FleeTurnChoice@ choice, bool& result){}; void PreventOpponentRunAway(FleeTurnChoice@ choice, bool& result){};
void PreventOpponentSwitch(SwitchTurnChoice@ choice, bool& result){}; void PreventOpponentSwitch(SwitchTurnChoice@ choice, bool& result){};
void OnEndTurn(){}; void OnEndTurn(){};
void OnDamage(Pokemon@ pokemon, DamageSource damageSource){}; void OnDamage(Pokemon@ pokemon, DamageSource damageSource, uint oldHealth, uint newHealth){};
void OnFaint(Pokemon@ pokemon, DamageSource damageSource){}; void OnFaint(Pokemon@ pokemon, DamageSource damageSource){};
// PkmnLib methods // PkmnLib methods