Adds OnSwitchIn script hook to Angelscript.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2021-11-19 15:55:48 +01:00
parent 496ebfdfa1
commit d1ba703f76
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
4 changed files with 6 additions and 0 deletions

View File

@ -344,3 +344,6 @@ void AngelScriptScript::BlockWeather(CreatureLib::Battling::Battle* battle, bool
ctx->SetArgAddress(1, blockWeather); ctx->SetArgAddress(1, blockWeather);
}) })
} }
void AngelScriptScript::OnSwitchIn(CreatureLib::Battling::Creature* creature) {
CALL_HOOK(OnSwitchIn, { ctx->SetArgObject(0, (void*)creature); })
}

View File

@ -137,6 +137,7 @@ public:
void OnFaint(CreatureLib::Battling::Creature* creature, CreatureLib::Battling::DamageSource source) override; void OnFaint(CreatureLib::Battling::Creature* creature, CreatureLib::Battling::DamageSource source) override;
void BlockWeather(CreatureLib::Battling::Battle* battle, bool* blockWeather) override; void BlockWeather(CreatureLib::Battling::Battle* battle, bool* blockWeather) override;
void OnSwitchIn(CreatureLib::Battling::Creature* creature) override;
}; };
#undef CALL_HOOK #undef CALL_HOOK

View File

@ -167,6 +167,7 @@ public:
SCRIPT_HOOK_FUNCTION(OnEndTurn, "void OnEndTurn()"); SCRIPT_HOOK_FUNCTION(OnEndTurn, "void OnEndTurn()");
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)");
}; };
#undef SCRIPT_HOOK_FUNCTION #undef SCRIPT_HOOK_FUNCTION

View File

@ -61,6 +61,7 @@ shared abstract class PkmnScript {
void ModifyExperienceGain(Pokemon@ faintedMon, Pokemon@ winningMon, uint32& critStage){}; void ModifyExperienceGain(Pokemon@ faintedMon, Pokemon@ winningMon, uint32& critStage){};
void DoesShareExperience(Pokemon@ faintedMon, Pokemon@ winningMon, bool& shareExperience){}; void DoesShareExperience(Pokemon@ faintedMon, Pokemon@ winningMon, bool& shareExperience){};
void BlockWeather(Battle@ battle, bool& blockWeather){}; void BlockWeather(Battle@ battle, bool& blockWeather){};
void OnSwitchIn(Pokemon@ pokemon){};
} }
)"); )");
Ensure(r >= 0); Ensure(r >= 0);