109 lines
5.8 KiB
C++
109 lines
5.8 KiB
C++
#include "BasicScriptClass.hpp"
|
|
#include <Arbutils/Ensure.hpp>
|
|
|
|
void BasicScriptClass::Register(asIScriptEngine* engine) {
|
|
// 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.
|
|
int r = engine->GetModuleByIndex(0)->AddScriptSection("PkmnScript", R"(
|
|
shared abstract class PkmnScript {
|
|
private ref@ __owner;
|
|
|
|
protected const ref@& GetOwner() { return __owner; };
|
|
protected void SetOwner(ref@ o) { @__owner = @o; };
|
|
|
|
// CreatureLib methods
|
|
void OnInitialize(const BattleLibrary@ library, const narray<EffectParameter@>@ parameters){};
|
|
void Stack(){};
|
|
void OnRemove(){};
|
|
void OnBeforeTurn(BaseTurnChoice@ choice){};
|
|
void ChangeAttack(MoveTurnChoice@ choice, constString& changedMove){};
|
|
void ModifyNumberOfHits(MoveTurnChoice@ choice, uint8& result){};
|
|
void PreventAttack(ExecutingMove@ attack, bool& result){};
|
|
void FailAttack(ExecutingMove@ attack, bool& result){};
|
|
void StopBeforeAttack(ExecutingMove@ attack, bool& result){};
|
|
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){};
|
|
void ChangeEffectiveness(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& effectiveness){};
|
|
void BlockCritical(ExecutingMove@ attack, Pokemon@ target, uint8 hit, bool& blockCritical){};
|
|
void OnIncomingHit(ExecutingMove@ attack, Pokemon@ target, uint8 hit){};
|
|
void OnFaintingOpponent(ExecutingMove@ attack, Pokemon@ target, uint8 hit){};
|
|
void PreventStatBoostChange(Pokemon@ target, Statistic stat, int8 amount, bool selfInflicted, bool& prevent){};
|
|
void ModifyStatBoostChange(Pokemon@ target, Statistic stat, int8& amount){};
|
|
void PreventSecondaryEffects(ExecutingMove@ attack, Pokemon@ target, uint8 hit, bool& outResult){};
|
|
void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit){};
|
|
void OnAfterHits(ExecutingMove@ attack, Pokemon@ target){};
|
|
void PreventSelfSwitch(SwitchTurnChoice@ choice, bool& prevented){};
|
|
|
|
void ModifyEffectChance(ExecutingMove@ attack, Pokemon@ target, float& chance){};
|
|
void ModifyIncomingEffectChance(ExecutingMove@ attack, Pokemon@ target, float& chance){};
|
|
|
|
void OverrideBasePower(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint8& basePower){};
|
|
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){};
|
|
void OverrideDamage(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint& damage){};
|
|
void OverrideIncomingDamage(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint& damage){};
|
|
|
|
void ChangeSpeed(BaseTurnChoice@ choice, uint32& speed){};
|
|
void ChangePriority(MoveTurnChoice@ choice, int8& priority){};
|
|
void OnFail(Pokemon@ user){};
|
|
void OnOpponentFail(Pokemon@ user){};
|
|
|
|
void PreventRunAway(FleeTurnChoice@ choice, bool& result){};
|
|
void PreventOpponentRunAway(FleeTurnChoice@ choice, bool& result){};
|
|
void PreventOpponentSwitch(SwitchTurnChoice@ choice, bool& result){};
|
|
void OnEndTurn(){};
|
|
void OnDamage(Pokemon@ pokemon, DamageSource damageSource, uint oldHealth, uint newHealth){};
|
|
void OnFaint(Pokemon@ pokemon, DamageSource damageSource){};
|
|
void OnAfterHeldItemConsume(Pokemon@ target, const Item@ item){};
|
|
|
|
// PkmnLib methods
|
|
void PreventIncomingCritical(ExecutingMove@ attack, Pokemon@ target, uint8 hit, bool& preventCrit){};
|
|
void ModifyCriticalStage(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint8& critStage){};
|
|
void OverrideCriticalModifier(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& critModifier){};
|
|
void OverrideSTABModifier(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& stabModifier){};
|
|
|
|
void ModifyExperienceGain(Pokemon@ faintedMon, Pokemon@ winningMon, uint32& critStage){};
|
|
void DoesShareExperience(Pokemon@ faintedMon, Pokemon@ winningMon, bool& shareExperience){};
|
|
void BlockWeather(Battle@ battle, bool& blockWeather){};
|
|
void OnSwitchIn(Pokemon@ pokemon){};
|
|
|
|
void ModifyOffensiveStatValue(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& offensiveStatValue){};
|
|
void ModifyDefensiveStatValue(ExecutingMove@ attack, Pokemon@ target, uint8 hit, float& defensiveStatValue){};
|
|
}
|
|
)");
|
|
Ensure(r >= 0);
|
|
r = engine->GetModuleByIndex(0)->AddScriptSection("ItemUseScript", R"(
|
|
shared abstract class ItemUseScript {
|
|
private Item@ __owner;
|
|
|
|
protected const Item@ GetOwner() { return __owner; };
|
|
protected void SetOwner(Item@ o) { @__owner = @o; };
|
|
|
|
void OnInitialize(const narray<EffectParameter@>@ parameters){};
|
|
bool IsItemUsable() { return false; };
|
|
bool IsPokemonUseItem() { return false; };
|
|
bool IsUseValidForPokemon(Pokemon@ target) { return false; };
|
|
|
|
bool IsHoldable() { return false; }
|
|
|
|
void OnUse(Battle@ battle) { };
|
|
void OnPokemonUse(Pokemon@ target, bool isBattle) { };
|
|
void ModifyPokeballCatchBonus(Pokemon@ target, uint8& catchBonus){};
|
|
}
|
|
)");
|
|
Ensure(r >= 0);
|
|
|
|
r = engine->GetModuleByIndex(0)->AddScriptSection("EvolutionScript", R"(
|
|
shared abstract class EvolutionScript {
|
|
void DoesEvolveFromLevelUp(bool& out, const EvolutionData@ evoData, const Pokemon@ pokemon) { };
|
|
}
|
|
)");
|
|
Ensure(r >= 0);
|
|
}
|