Adds damage script hooks.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
3d75e8233d
commit
f447e40663
|
@ -57,7 +57,8 @@ uint32_t PkmnLib::Battling::DamageLibrary::GetDamage(CreatureLib::Battling::Exec
|
||||||
} else {
|
} else {
|
||||||
damage = static_cast<uint32_t>(floatDamage);
|
damage = static_cast<uint32_t>(floatDamage);
|
||||||
}
|
}
|
||||||
// HOOK: Override damage
|
PKMN_HOOK(OverrideDamage, attack, attack, target, hitIndex, &damage);
|
||||||
|
PKMN_HOOK(OverrideIncomingDamage, target, attack, target, hitIndex, &damage);
|
||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
uint8_t PkmnLib::Battling::DamageLibrary::GetBasePower(CreatureLib::Battling::ExecutingAttack* attack,
|
uint8_t PkmnLib::Battling::DamageLibrary::GetBasePower(CreatureLib::Battling::ExecutingAttack* attack,
|
||||||
|
|
|
@ -208,6 +208,16 @@ void AngelScriptScript::OverrideDamage(CreatureLib::Battling::ExecutingAttack* a
|
||||||
ctx->SetArgAddress(3, damage);
|
ctx->SetArgAddress(3, damage);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
void AngelScriptScript::OverrideIncomingDamage(CreatureLib::Battling::ExecutingAttack* attack,
|
||||||
|
CreatureLib::Battling::Creature* target, uint8_t hitIndex,
|
||||||
|
uint32_t* damage) {
|
||||||
|
CALL_HOOK(OverrideIncomingDamage, {
|
||||||
|
ctx->SetArgObject(0, (void*)attack);
|
||||||
|
ctx->SetArgObject(1, (void*)target);
|
||||||
|
ctx->SetArgByte(2, hitIndex);
|
||||||
|
ctx->SetArgAddress(3, damage);
|
||||||
|
})
|
||||||
|
}
|
||||||
void AngelScriptScript::ModifyCriticalStage(CreatureLib::Battling::ExecutingAttack* attack,
|
void AngelScriptScript::ModifyCriticalStage(CreatureLib::Battling::ExecutingAttack* attack,
|
||||||
CreatureLib::Battling::Creature* target, uint8_t hit, uint8_t* critStage) {
|
CreatureLib::Battling::Creature* target, uint8_t hit, uint8_t* critStage) {
|
||||||
CALL_HOOK(ModifyCriticalStage, {
|
CALL_HOOK(ModifyCriticalStage, {
|
||||||
|
|
|
@ -104,6 +104,8 @@ public:
|
||||||
uint8_t hitIndex, float* modifier) override;
|
uint8_t hitIndex, float* modifier) override;
|
||||||
void OverrideDamage(CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target,
|
void OverrideDamage(CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target,
|
||||||
uint8_t hitIndex, uint32_t* damage) override;
|
uint8_t hitIndex, uint32_t* damage) override;
|
||||||
|
void OverrideIncomingDamage(CreatureLib::Battling::ExecutingAttack* attack, CreatureLib::Battling::Creature* target,
|
||||||
|
uint8_t hitIndex, uint32_t* damage) override;
|
||||||
|
|
||||||
void ChangePriority(CreatureLib::Battling::AttackTurnChoice* choice, int8_t* priority) override;
|
void ChangePriority(CreatureLib::Battling::AttackTurnChoice* choice, int8_t* priority) override;
|
||||||
void OnFail(CreatureLib::Battling::Creature* target) override;
|
void OnFail(CreatureLib::Battling::Creature* target) override;
|
||||||
|
|
|
@ -119,6 +119,8 @@ public:
|
||||||
"void ModifyDamageModifier(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& modifier)");
|
"void ModifyDamageModifier(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& modifier)");
|
||||||
SCRIPT_HOOK_FUNCTION(OverrideDamage,
|
SCRIPT_HOOK_FUNCTION(OverrideDamage,
|
||||||
"void OverrideDamage(ExecutingMove@ attack, Pokemon@ target, uint8 hit, int& damage)");
|
"void OverrideDamage(ExecutingMove@ attack, Pokemon@ target, uint8 hit, int& damage)");
|
||||||
|
SCRIPT_HOOK_FUNCTION(OverrideIncomingDamage,
|
||||||
|
"void OverrideIncomingDamage(ExecutingMove@ attack, Pokemon@ target, uint8 hit, int& damage)");
|
||||||
|
|
||||||
SCRIPT_HOOK_FUNCTION(
|
SCRIPT_HOOK_FUNCTION(
|
||||||
ModifyCriticalStage,
|
ModifyCriticalStage,
|
||||||
|
|
|
@ -36,6 +36,7 @@ shared abstract class PkmnScript {
|
||||||
void ModifyStatModifier(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& modifier){};
|
void ModifyStatModifier(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& modifier){};
|
||||||
void ModifyDamageModifier(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& modifier){};
|
void ModifyDamageModifier(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& modifier){};
|
||||||
void OverrideDamage(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint& damage){};
|
void OverrideDamage(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint& damage){};
|
||||||
|
void OverrideIncomingDamage(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint& damage){};
|
||||||
|
|
||||||
void ChangePriority(MoveTurnChoice@ choice, int8& priority){};
|
void ChangePriority(MoveTurnChoice@ choice, int8& priority){};
|
||||||
void OnFail(Pokemon@ user){};
|
void OnFail(Pokemon@ user){};
|
||||||
|
|
Loading…
Reference in New Issue