Implement AngelScript support for effect chance changes.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
321afbebe4
commit
0147515ffb
|
@ -44,7 +44,7 @@ class PkmnLibConan(ConanFile):
|
|||
self.options["AngelScript"].link_std_statically = True
|
||||
|
||||
def requirements(self):
|
||||
self.requires("CreatureLib/579ee82f02d6eedb5d924c8b4b056bfdb561ef53@creaturelib/master")
|
||||
self.requires("CreatureLib/54e366fc1b3a44b200de41421707bfe4802aaecb@creaturelib/master")
|
||||
if self.options.script_handler == "angelscript":
|
||||
self.requires("AngelScript/2.34@AngelScript/Deukhoofd")
|
||||
else:
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue