Implement AngelScript support for effect chance changes.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -170,6 +170,23 @@ public:
|
||||
void PreventSelfSwitch(const CreatureLib::Battling::SwitchTurnChoice* choice, bool* outResult) override {
|
||||
throw NotImplementedException(); // TODO
|
||||
}
|
||||
|
||||
void ModifyEffectChance(const CreatureLib::Battling::ExecutingAttack* attack,
|
||||
CreatureLib::Battling::Creature* target, float* chance) override {
|
||||
CALL_HOOK(ModifyEffectChance, {
|
||||
ctx->SetArgObject(0, (void*)attack);
|
||||
ctx->SetArgObject(1, (void*)target);
|
||||
ctx->SetArgAddress(2, chance);
|
||||
})
|
||||
}
|
||||
void ModifyIncomingEffectChance(const CreatureLib::Battling::ExecutingAttack* attack,
|
||||
CreatureLib::Battling::Creature* target, float* chance) override {
|
||||
CALL_HOOK(ModifyIncomingEffectChance, {
|
||||
ctx->SetArgObject(0, (void*)attack);
|
||||
ctx->SetArgObject(1, (void*)target);
|
||||
ctx->SetArgAddress(2, chance);
|
||||
})
|
||||
}
|
||||
};
|
||||
|
||||
#undef CALL_HOOK
|
||||
|
||||
@@ -88,6 +88,10 @@ public:
|
||||
SCRIPT_HOOK_FUNCTION(OnSecondaryEffect,
|
||||
"void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit)");
|
||||
SCRIPT_HOOK_FUNCTION(OnAfterHits, "void OnAfterHits(ExecutingMove@ attack, Pokemon@ target)");
|
||||
SCRIPT_HOOK_FUNCTION(ModifyEffectChance,
|
||||
"void ModifyEffectChance(ExecutingMove@ attack, Pokemon@ target, uint16& chance)");
|
||||
SCRIPT_HOOK_FUNCTION(ModifyIncomingEffectChance,
|
||||
"void ModifyIncomingEffectChance(ExecutingMove@ attack, Pokemon@ target, uint16& chance)");
|
||||
};
|
||||
|
||||
#undef SCRIPT_HOOK_FUNCTION
|
||||
|
||||
@@ -21,6 +21,7 @@ shared abstract class PkmnScript {
|
||||
void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit){};
|
||||
void OnAfterHits(ExecutingMove@ attack, Pokemon@ target){};
|
||||
|
||||
void ModifyEffectChance(ExecutingMove@ attack, Pokemon@ target, uint16& chance){};
|
||||
}
|
||||
)");
|
||||
assert(r >= 0);
|
||||
|
||||
Reference in New Issue
Block a user