2020-02-04 18:34:30 +00:00
|
|
|
#include "BasicScriptClass.hpp"
|
2021-10-30 12:29:57 +00:00
|
|
|
#include <Arbutils/Ensure.hpp>
|
2020-02-04 18:34:30 +00:00
|
|
|
|
|
|
|
void BasicScriptClass::Register(asIScriptEngine* engine) {
|
2020-04-22 13:34:24 +00:00
|
|
|
// As far as I am aware at the moment you can't create an abstract class with virtual members through the
|
|
|
|
// application registry interface. As such, we just create it from string.
|
2021-03-07 16:09:30 +00:00
|
|
|
int r = engine->GetModuleByIndex(0)->AddScriptSection("PkmnScript", R"(
|
2020-02-04 18:34:30 +00:00
|
|
|
shared abstract class PkmnScript {
|
2021-10-29 21:54:44 +00:00
|
|
|
private ref@ __owner;
|
|
|
|
|
2021-10-29 22:19:24 +00:00
|
|
|
protected ref@& GetOwner() { return __owner; };
|
2021-10-29 21:54:44 +00:00
|
|
|
|
|
|
|
// CreatureLib methods
|
2022-02-12 16:27:39 +00:00
|
|
|
void OnInitialize(const BattleLibrary@ library, const narray<EffectParameter@>@ parameters){};
|
2020-02-04 18:34:30 +00:00
|
|
|
void Stack(){};
|
2020-02-06 15:25:55 +00:00
|
|
|
void OnRemove(){};
|
2020-04-22 13:34:24 +00:00
|
|
|
void OnBeforeTurn(BaseTurnChoice@ choice){};
|
|
|
|
void ChangeAttack(MoveTurnChoice@ choice, constString& changedMove){};
|
2021-03-28 17:58:08 +00:00
|
|
|
void ModifyNumberOfHits(MoveTurnChoice@ choice, uint8& result){};
|
2020-02-04 18:34:30 +00:00
|
|
|
void PreventAttack(ExecutingMove@ attack, bool& result){};
|
|
|
|
void FailAttack(ExecutingMove@ attack, bool& result){};
|
|
|
|
void StopBeforeAttack(ExecutingMove@ attack, bool& result){};
|
2020-02-05 16:06:15 +00:00
|
|
|
void OnBeforeAttack(ExecutingMove@ attack){};
|
|
|
|
void FailIncomingAttack(ExecutingMove@ attack, Pokemon@ target, bool& result){};
|
|
|
|
void IsInvulnerable(ExecutingMove@ attack, Pokemon@ target, bool& result){};
|
|
|
|
void OnAttackMiss(ExecutingMove@ attack, Pokemon@ target){};
|
|
|
|
void ChangeAttackType(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint8& outType){};
|
2020-04-19 11:41:41 +00:00
|
|
|
void ChangeEffectiveness(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& effectiveness){};
|
2021-11-21 09:55:54 +00:00
|
|
|
void BlockCritical(ExecutingMove@ attack, Pokemon@ target, uint8 hit, bool& blockCritical){};
|
2021-11-19 17:07:21 +00:00
|
|
|
void OnIncomingHit(ExecutingMove@ attack, Pokemon@ target, uint8 hit){};
|
2021-11-21 12:37:26 +00:00
|
|
|
void OnFaintingOpponent(ExecutingMove@ attack, Pokemon@ target, uint8 hit){};
|
2022-02-12 14:59:16 +00:00
|
|
|
void PreventStatBoostChange(Pokemon@ target, Statistic stat, int8 amount, bool& prevent){};
|
2022-02-12 14:24:50 +00:00
|
|
|
void ModifyStatBoostChange(Pokemon@ target, Statistic stat, int8& amount){};
|
2020-02-05 16:06:15 +00:00
|
|
|
void PreventSecondaryEffects(ExecutingMove@ attack, Pokemon@ target, uint8 hit, bool& outResult){};
|
|
|
|
void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit){};
|
|
|
|
void OnAfterHits(ExecutingMove@ attack, Pokemon@ target){};
|
2020-04-22 13:34:24 +00:00
|
|
|
void PreventSelfSwitch(SwitchTurnChoice@ choice, bool& prevented){};
|
2020-02-05 16:06:15 +00:00
|
|
|
|
2020-02-17 09:55:42 +00:00
|
|
|
void ModifyEffectChance(ExecutingMove@ attack, Pokemon@ target, float& chance){};
|
|
|
|
void ModifyIncomingEffectChance(ExecutingMove@ attack, Pokemon@ target, float& chance){};
|
2020-02-19 09:25:27 +00:00
|
|
|
|
2020-04-06 18:03:44 +00:00
|
|
|
void OverrideBasePower(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint8& basePower){};
|
2020-02-19 09:25:27 +00:00
|
|
|
void ChangeDamageStatsUser(ExecutingMove@ attack, Pokemon@ target, uint8 hit, Pokemon@& user){};
|
|
|
|
void BypassDefensiveStat(ExecutingMove@ attack, Pokemon@ target, uint8 hit, bool& bypass){};
|
|
|
|
void BypassOffensiveStat(ExecutingMove@ attack, Pokemon@ target, uint8 hit, bool& bypass){};
|
|
|
|
void ModifyStatModifier(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& modifier){};
|
|
|
|
void ModifyDamageModifier(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& modifier){};
|
2020-04-06 18:03:44 +00:00
|
|
|
void OverrideDamage(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint& damage){};
|
2021-10-29 16:29:30 +00:00
|
|
|
void OverrideIncomingDamage(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint& damage){};
|
2020-02-20 12:28:31 +00:00
|
|
|
|
2021-03-27 12:51:06 +00:00
|
|
|
void ChangePriority(MoveTurnChoice@ choice, int8& priority){};
|
2021-03-27 14:34:04 +00:00
|
|
|
void OnFail(Pokemon@ user){};
|
|
|
|
void OnOpponentFail(Pokemon@ user){};
|
|
|
|
|
|
|
|
void PreventRunAway(FleeTurnChoice@ choice, bool& result){};
|
|
|
|
void PreventOpponentRunAway(FleeTurnChoice@ choice, bool& result){};
|
2021-03-28 16:53:08 +00:00
|
|
|
void PreventOpponentSwitch(SwitchTurnChoice@ choice, bool& result){};
|
2021-10-29 17:35:31 +00:00
|
|
|
void OnEndTurn(){};
|
2021-11-21 13:16:57 +00:00
|
|
|
void OnDamage(Pokemon@ pokemon, DamageSource damageSource, uint oldHealth, uint newHealth){};
|
2021-11-19 11:40:31 +00:00
|
|
|
void OnFaint(Pokemon@ pokemon, DamageSource damageSource){};
|
2022-02-19 13:04:43 +00:00
|
|
|
void OnAfterHeldItemConsume(Pokemon@ target, const Item@ item){};
|
2021-03-27 12:51:06 +00:00
|
|
|
|
2021-03-27 12:33:56 +00:00
|
|
|
// PkmnLib methods
|
2022-02-12 12:03:40 +00:00
|
|
|
void PreventIncomingCritical(ExecutingMove@ attack, Pokemon@ target, uint8 hit, bool& preventCrit){};
|
2020-02-20 12:28:31 +00:00
|
|
|
void ModifyCriticalStage(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint8& critStage){};
|
2020-06-05 11:49:12 +00:00
|
|
|
void OverrideCriticalModifier(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& critModifier){};
|
|
|
|
void OverrideSTABModifier(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& stabModifier){};
|
|
|
|
|
2020-05-24 11:36:45 +00:00
|
|
|
void ModifyExperienceGain(Pokemon@ faintedMon, Pokemon@ winningMon, uint32& critStage){};
|
|
|
|
void DoesShareExperience(Pokemon@ faintedMon, Pokemon@ winningMon, bool& shareExperience){};
|
2021-11-19 14:06:13 +00:00
|
|
|
void BlockWeather(Battle@ battle, bool& blockWeather){};
|
2021-11-19 14:55:48 +00:00
|
|
|
void OnSwitchIn(Pokemon@ pokemon){};
|
2022-02-12 16:00:37 +00:00
|
|
|
|
|
|
|
void ModifyOffensiveStatValue(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& offensiveStatValue){};
|
|
|
|
void ModifyDefensiveStatValue(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& defensiveStatValue){};
|
2020-02-04 18:34:30 +00:00
|
|
|
}
|
|
|
|
)");
|
2020-12-13 11:32:52 +00:00
|
|
|
Ensure(r >= 0);
|
2021-03-07 16:09:30 +00:00
|
|
|
r = engine->GetModuleByIndex(0)->AddScriptSection("ItemUseScript", R"(
|
|
|
|
shared abstract class ItemUseScript {
|
2021-09-25 15:56:31 +00:00
|
|
|
void OnInitialize(const narray<EffectParameter@>@ parameters){};
|
2021-03-07 16:09:30 +00:00
|
|
|
bool IsItemUsable() { return false; };
|
|
|
|
bool IsPokemonUseItem() { return false; };
|
|
|
|
bool IsUseValidForPokemon(Pokemon@ target) { return false; };
|
|
|
|
|
|
|
|
bool IsHoldable() { return false; }
|
|
|
|
|
2022-02-13 12:47:30 +00:00
|
|
|
void OnUse(Battle@ battle) { };
|
|
|
|
void OnPokemonUse(Pokemon@ target, bool isBattle) { };
|
2021-03-07 16:09:30 +00:00
|
|
|
}
|
|
|
|
)");
|
|
|
|
Ensure(r >= 0);
|
2021-07-09 11:54:42 +00:00
|
|
|
|
|
|
|
r = engine->GetModuleByIndex(0)->AddScriptSection("EvolutionScript", R"(
|
|
|
|
shared abstract class EvolutionScript {
|
|
|
|
void DoesEvolveFromLevelUp(bool& out, const EvolutionData@ evoData, const Pokemon@ pokemon) { };
|
|
|
|
}
|
|
|
|
)");
|
|
|
|
Ensure(r >= 0);
|
2020-02-04 18:34:30 +00:00
|
|
|
}
|