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);
}
void AngelScriptScript::OnDamage(CreatureLib::Battling::Creature* creature,
CreatureLib::Battling::DamageSource source) {
void AngelScriptScript::OnDamage(CreatureLib::Battling::Creature* creature, CreatureLib::Battling::DamageSource source,
[[maybe_unused]] u32 oldHealth, [[maybe_unused]] u32 newHealth) {
CALL_HOOK(OnDamage, {
ctx->SetArgObject(0, (void*)creature);
ctx->SetArgDWord(1, (i32)source);
ctx->SetArgDWord(2, oldHealth);
ctx->SetArgDWord(3, newHealth);
})
}
void AngelScriptScript::OnFaint(CreatureLib::Battling::Creature* creature, CreatureLib::Battling::DamageSource source) {

View File

@ -75,15 +75,15 @@ public:
uint8_t hitNumber, uint8_t* outType) override;
void BlockCritical(CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target,
uint8_t hitNumber, bool* blockCritical) override;
uint8_t hitNumber, bool* blockCritical) override;
void ChangeEffectiveness(CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target,
uint8_t hitNumber, float* effectiveness) override;
void PreventSecondaryEffects(const CreatureLib::Battling::ExecutingAttack* attack,
CreatureLib::Battling::Creature* target, uint8_t hitNumber, bool* outResult) override;
void OnIncomingHit(const CreatureLib::Battling::ExecutingAttack* attack,
CreatureLib::Battling::Creature* target, uint8_t hitNumber) override;
void OnIncomingHit(const CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target,
uint8_t hitNumber) override;
void OnFaintingOpponent(const CreatureLib::Battling::ExecutingAttack* attack,
CreatureLib::Battling::Creature* target, u8 hitNumber) override;
void OnSecondaryEffect(const CreatureLib::Battling::ExecutingAttack* attack,
@ -124,7 +124,8 @@ public:
void PreventOpponentRunAway(const CreatureLib::Battling::FleeTurnChoice* choice, bool* result) override;
void PreventOpponentSwitch(const CreatureLib::Battling::SwitchTurnChoice* choice, bool* outResult) 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 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(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(BlockWeather, "void BlockWeather(Battle@ battle, bool& result)");
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 PreventOpponentSwitch(SwitchTurnChoice@ choice, bool& result){};
void OnEndTurn(){};
void OnDamage(Pokemon@ pokemon, DamageSource damageSource){};
void OnDamage(Pokemon@ pokemon, DamageSource damageSource, uint oldHealth, uint newHealth){};
void OnFaint(Pokemon@ pokemon, DamageSource damageSource){};
// PkmnLib methods