Switch to astypedef, adds unit tests
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2021-10-23 14:20:18 +02:00
parent 6560cd5752
commit 40dcd8a407
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
96 changed files with 336 additions and 300 deletions

15
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"port": 8684,
"name": "Run PokemonScriptTester",
"request": "attach",
"type": "angelscript",
"scriptPath": "/home/nathan/Projects/PokemonLibraries/Gen7Data/%s"
}
]
}

View File

@ -1,7 +0,0 @@
shared interface BaseTurnChoice {
TurnChoiceKind Kind { get const; }
const Pokemon@ User { get const; }
MoveTurnChoice@ opCast();
SwitchTurnChoice@ opCast();
FleeTurnChoice@ opCast();
}

View File

@ -0,0 +1,7 @@
type BaseTurnChoice {
TurnChoiceKind Kind { get const; };
const Pokemon@ User { get const; };
MoveTurnChoice@ opCast();
SwitchTurnChoice@ opCast();
FleeTurnChoice@ opCast();
}

View File

@ -1,16 +0,0 @@
shared interface Battle {
const BattleLibrary@ Library { get const; }
bool CanUse(BaseTurnChoice@ choice);
bool CanFlee { get const; }
uint CurrentTurn { get const; }
BattleRandom@ Random { get const; }
ChoiceQueue@ TurnQueue { get const; }
ref AddVolatile(const constString &in name);
void RemoveVolatile(const constString &in name) const;
void SetWeather(const constString &in name) const;
void ClearWeather(const constString &in name) const;
const constString& GetWeatherName() const;
BattleSide@ GetBattleSide(uint8 index);
BattleParty@ GetParty(uint8 index);
BattleParty@ FindPartyForPokemon(Pokemon@ pokemon);
}

View File

@ -0,0 +1,18 @@
type Battle {
const BattleLibrary@ Library { get const; };
bool CanFlee { get const; };
uint CurrentTurn { get const; };
BattleRandom@ Random { get const; };
ChoiceQueue@ TurnQueue { get const; };
narray<BattleSide>@ Sides { get const; };
narray<BattleParty>@ Parties { get const; };
bool CanUse(BaseTurnChoice@ choice);
ref@ AddVolatile(const constString &in name);
void RemoveVolatile(const constString &in name) const;
void SetWeather(const constString &in name) const;
void ClearWeather(const constString &in name) const;
const constString& GetWeatherName() const;
BattleSide@ GetBattleSide(uint8 index);
BattleParty@ GetParty(uint8 index);
BattleParty@ FindPartyForPokemon(Pokemon@ pokemon);
}

View File

@ -1,7 +1,7 @@
shared enum BattleItemCategory { enum BattleItemCategory {
None = 0, None = 0,
Healing = 1, Healing = 1,
StatusHealing = 2, StatusHealing = 2,
CaptureDevice = 3, Pokeball = 3,
Misc = 4, Misc = 4,
} }

View File

@ -1,8 +0,0 @@
shared interface BattleLibrary {
const LibrarySettings@ Settings { get const; }
const StaticLibrary@ StaticLibrary { get const; }
const SpeciesLibrary@ SpeciesLibrary { get const; }
const MoveLibrary@ MoveLibrary { get const; }
const ItemLibrary@ ItemLibrary { get const; }
const DamageLibrary@ DamageLibrary { get const; }
}

View File

@ -0,0 +1,8 @@
type BattleLibrary {
const LibrarySettings@ Settings { get const; };
const StaticLibrary@ StaticLibrary { get const; };
const SpeciesLibrary@ SpeciesLibrary { get const; };
const MoveLibrary@ MoveLibrary { get const; };
const ItemLibrary@ ItemLibrary { get const; };
const DamageLibrary@ DamageLibrary { get const; };
}

View File

@ -1,3 +0,0 @@
shared interface BattleParty {
Party@ Party { get const; }
}

View File

@ -0,0 +1,3 @@
type BattleParty {
Party@ Party { get const; };
}

View File

@ -1,6 +0,0 @@
shared interface BattleRandom {
bool EffectChance(float chance, ExecutingMove@ move, Pokemon@ target);
int Get();
int Get(int max);
int Get(int min, int max);
}

View File

@ -0,0 +1,6 @@
type BattleRandom {
bool EffectChance(float chance, ExecutingMove@ move, Pokemon@ target);
int Get();
int Get(int max);
int Get(int min, int max);
}

View File

@ -1,6 +0,0 @@
shared interface BattleSide {
bool SwapPositions(uint8 a, uint8 b);
uint8 SideIndex { get const; }
uint8 GetPokemonIndex(const Pokemon@ pokemon) const;
Pokemon@ GetPokemon(uint8 index) const;
}

View File

@ -0,0 +1,6 @@
type BattleSide {
bool SwapPositions(uint8 a, uint8 b);
uint8 SideIndex { get const; };
uint8 GetPokemonIndex(const Pokemon@ pokemon) const;
Pokemon@ GetPokemon(uint8 index) const;
}

View File

@ -1,4 +0,0 @@
shared interface ChoiceQueue {
bool MovePokemonChoiceNext(Pokemon@ target);
const BaseTurnChoice@ Peek() const;
}

View File

@ -0,0 +1,4 @@
type ChoiceQueue {
bool MovePokemonChoiceNext(Pokemon@ target);
const BaseTurnChoice@ Peek() const;
}

View File

@ -1,3 +0,0 @@
shared interface DamageLibrary {
int GetDamage() const;
}

View File

@ -0,0 +1,2 @@
type DamageLibrary {
}

View File

@ -1,4 +1,4 @@
shared enum DamageSource { enum DamageSource {
AttackDamage = 0, AttackDamage = 0,
Struggle = 1, Struggle = 1,
} }

View File

@ -1,7 +0,0 @@
shared interface EffectParameter {
EffectParameterType GetType() const;
bool AsBool() const;
int64 AsInt() const;
float AsFloat() const;
const constString& AsString() const;
}

View File

@ -0,0 +1,7 @@
type EffectParameter {
EffectParameterType GetType() const;
bool AsBool() const;
int64 AsInt() const;
float AsFloat() const;
const constString& AsString() const;
}

View File

@ -1,4 +1,4 @@
shared enum EffectParameterType { enum EffectParameterType {
None = 0, None = 0,
Bool = 1, Bool = 1,
Int = 2, Int = 2,

View File

@ -1,6 +0,0 @@
shared interface EvolutionData {
const Species& NewSpecies { get const; }
EvolutionMethod Method { get const; }
uint64 DataCount { get const; }
EffectParameter@ GetData(uint64 index) const;
}

View File

@ -0,0 +1,7 @@
type EvolutionData {
const Species& NewSpecies { get const; };
EvolutionMethod Method { get const; };
uint64 DataCount { get const; };
const narray<EffectParameter@>@ Data { get const; };
EffectParameter@ GetDataAt(uint64 index) const;
}

View File

@ -1,4 +1,4 @@
shared enum EvolutionMethod { enum EvolutionMethod {
Level = 0, Level = 0,
HighFriendship = 1, HighFriendship = 1,
HighFriendshipTime = 2, HighFriendshipTime = 2,

View File

@ -1,7 +0,0 @@
shared interface ExecutingMove {
HitData@ GetHitData(Pokemon@ target, uint8 hit) const;
bool IsPokemonTarget(Pokemon@ pkmn) const;
Pokemon@ User { get const; }
LearnedMove@ Move { get const; }
MoveData@ UseMove { get const; }
}

View File

@ -0,0 +1,7 @@
type ExecutingMove {
Pokemon@ User { get const; };
LearnedMove@ Move { get const; };
MoveData@ UseMove { get const; };
HitData@ GetHitData(Pokemon@ target, uint8 hit) const;
bool IsPokemonTarget(Pokemon@ pkmn) const;
}

View File

@ -1,5 +0,0 @@
shared interface FleeTurnChoice {
TurnChoiceKind Kind { get const; }
const Pokemon@ User { get const; }
BaseTurnChoice@ opImplCast();
}

View File

@ -0,0 +1,5 @@
type FleeTurnChoice {
TurnChoiceKind Kind { get const; };
const Pokemon@ User { get const; };
BaseTurnChoice@ opImplCast();
}

View File

@ -1,10 +0,0 @@
shared interface Forme {
const constString& Name { get const; }
float Weight { get const; }
float Height { get const; }
uint BaseExperience { get const; }
int TypeCount { get const; }
uint8 GetType(int index) const;
uint GetStatistic(Statistic stat) const;
const constString& GetAbility(bool hidden, uint8 index) const;
}

View File

@ -0,0 +1,10 @@
type Forme {
const constString& Name { get const; };
float Weight { get const; };
float Height { get const; };
uint BaseExperience { get const; };
int TypeCount { get const; };
uint8 GetType(int index) const;
uint GetStatistic(Statistic stat) const;
const constString& GetAbility(bool hidden, uint8 index) const;
}

View File

@ -1,4 +1,4 @@
shared enum Gender { enum Gender {
Male = 0, Male = 0,
Female = 1, Female = 1,
Genderless = 2, Genderless = 2,

View File

@ -1,4 +0,0 @@
shared interface GrowthRate {
uint8 CalculateLevel(uint experience) const;
uint CalculateExperience(uint8 level) const;
}

View File

@ -0,0 +1,4 @@
type GrowthRate {
uint8 CalculateLevel(uint experience) const;
uint CalculateExperience(uint8 level) const;
}

View File

@ -1,4 +0,0 @@
shared interface GrowthRateLibrary {
uint8 CalculateLevel(const constString &in growthRate, uint experience) const;
uint CalculateExperience(const constString &in growthRate, uint8 experience) const;
}

View File

@ -0,0 +1,4 @@
type GrowthRateLibrary {
uint8 CalculateLevel(const constString &in growthRate, uint experience) const;
uint CalculateExperience(const constString &in growthRate, uint8 experience) const;
}

View File

@ -1,9 +0,0 @@
shared interface HitData {
bool IsCritical { get const; }
uint8 BasePower { get const; }
float Effectiveness { get const; }
uint Damage { get const; }
uint8 Type { get const; }
bool HasFailed { get const; }
void Fail();
}

View File

@ -0,0 +1,9 @@
type HitData {
bool IsCritical { get const; };
uint8 BasePower { get const; };
float Effectiveness { get const; };
uint Damage { get const; };
uint8 Type { get const; };
bool HasFailed { get const; };
void Fail();
}

View File

@ -1,7 +0,0 @@
shared interface Item {
const constString& Name { get const; }
ItemCategory Category { get const; }
BattleItemCategory BattleCategory { get const; }
int Price { get const; }
bool HasFlag(const constString &in flag) const;
}

View File

@ -0,0 +1,7 @@
type Item {
const constString& Name { get const; };
ItemCategory Category { get const; };
BattleItemCategory BattleCategory { get const; };
int Price { get const; };
bool HasFlag(const constString &in flag) const;
}

View File

@ -1,4 +1,4 @@
shared enum ItemCategory { enum ItemCategory {
Misc = 0, Misc = 0,
Pokeball = 1, Pokeball = 1,
Medicine = 2, Medicine = 2,

View File

@ -1,3 +0,0 @@
shared interface ItemLibrary {
const Item@ Get(const constString &in name) const;
}

View File

@ -0,0 +1,3 @@
type ItemLibrary {
const Item@ Get(const constString &in name) const;
}

View File

@ -1,9 +1,9 @@
shared abstract class ItemUseScript { shared abstract class ItemUseScript {
void OnInitialize(const EffectParameter@[] &in){}; void OnInitialize(const narray<EffectParameter@>@){};
bool IsItemUsable(){}; bool IsItemUsable(){ return false; };
bool IsPokemonUseItem(){}; bool IsPokemonUseItem(){ return false; };
bool IsUseValidForPokemon(Pokemon@){}; bool IsUseValidForPokemon(Pokemon@){ return false; };
bool IsHoldable(){}; bool IsHoldable(){ return false; };
void OnUse(){}; void OnUse(){};
void OnPokemonUse(Pokemon@){}; void OnPokemonUse(Pokemon@){};
} }

View File

@ -1,6 +0,0 @@
shared interface LearnedMove {
const MoveData@ MoveData { get const; }
uint8 MaxUses { get const; }
uint8 RemainingUses { get const; }
Gender LearnMethod { get const; }
}

View File

@ -0,0 +1,6 @@
type LearnedMove {
const MoveData@ MoveData { get const; };
uint8 MaxUses { get const; };
uint8 RemainingUses { get const; };
Gender LearnMethod { get const; };
}

View File

@ -1,5 +0,0 @@
shared interface LibrarySettings {
uint8 MaximalLevel { get const; }
uint8 MaximalMoves { get const; }
uint16 ShinyRate { get const; }
}

View File

@ -0,0 +1,5 @@
type LibrarySettings {
uint8 MaximalLevel { get const; };
uint8 MaximalMoves { get const; };
uint16 ShinyRate { get const; };
}

View File

@ -1,4 +1,4 @@
shared enum MoveCategory { enum MoveCategory {
Physical = 0, Physical = 0,
Special = 1, Special = 1,
Status = 2, Status = 2,

View File

@ -1,11 +0,0 @@
shared interface MoveData {
const constString& Name { get const; }
uint8 Type { get const; }
MoveCategory Category { get const; }
uint8 BasePower { get const; }
uint8 Accuracy { get const; }
uint8 BaseUsages { get const; }
MoveTarget Target { get const; }
int8 Priority { get const; }
bool HasFlag(const constString &in flag) const;
}

View File

@ -0,0 +1,11 @@
type MoveData {
const constString& Name { get const; };
uint8 Type { get const; };
MoveCategory Category { get const; };
uint8 BasePower { get const; };
uint8 Accuracy { get const; };
uint8 BaseUsages { get const; };
MoveTarget Target { get const; };
int8 Priority { get const; };
bool HasFlag(const constString &in flag) const;
}

View File

@ -1,4 +0,0 @@
shared enum MoveLearnMethod {
Unknown = 0,
Level = 1,
}

View File

@ -0,0 +1,4 @@
enum MoveLearnMethod {
Unknown = 0,
Level = 1,
}

View File

@ -1,3 +0,0 @@
shared interface MoveLibrary {
const MoveData@ Get(const constString &in name) const;
}

View File

@ -0,0 +1,3 @@
type MoveLibrary {
const MoveData@ Get(const constString &in name) const;
}

View File

@ -1,4 +1,4 @@
shared enum MoveTarget { enum MoveTarget {
Adjacent = 0, Adjacent = 0,
AdjacentAlly = 1, AdjacentAlly = 1,
AdjacentAllySelf = 2, AdjacentAllySelf = 2,

View File

@ -1,7 +0,0 @@
shared interface MoveTurnChoice {
TurnChoiceKind Kind { get const; }
Pokemon@ User { get const; }
LearnedMove@ Move { get const; }
int8 Priority { get const; }
BaseTurnChoice@ opImplCast();
}

View File

@ -0,0 +1,7 @@
type MoveTurnChoice {
TurnChoiceKind Kind { get const; };
Pokemon@ User { get const; };
LearnedMove@ Move { get const; };
int8 Priority { get const; };
BaseTurnChoice@ opImplCast();
}

View File

@ -1,4 +0,0 @@
shared interface Party {
Pokemon@ GetAtIndex(int index) const;
int Length { get const; }
}

View File

@ -0,0 +1,5 @@
type Party {
const narray<Pokemon@>@ Pokemon { get const; };
uint64 Length { get const; };
Pokemon@ GetAtIndex(int index) const;
}

View File

@ -1,5 +1,5 @@
shared abstract class PkmnScript { shared abstract class PkmnScript {
void OnInitialize(const EffectParameter@[] &in){}; void OnInitialize(const narray<EffectParameter@>@){};
void Stack(){}; void Stack(){};
void OnRemove(){}; void OnRemove(){};
void OnBeforeTurn(BaseTurnChoice@){}; void OnBeforeTurn(BaseTurnChoice@){};

View File

@ -1,37 +0,0 @@
shared interface Pokemon {
const Species@ Species { get const; }
const Forme@ Forme { get const; }
uint8 Level { get const; }
uint Experience { get const; }
Gender Gender { get const; }
uint8 Coloring { get const; }
bool Shiny { get const; }
const Item@ HeldItem { get const; }
bool HasHeldItem(const constString &in name) const;
void SetHeldItem(const constString &in name);
void SetHeldItem(const Item@ item);
uint CurrentHealth { get const; }
const string& Nickname { get const; }
const constString& ActiveAbility { get const; }
bool IsFainted { get const; }
bool HasType(uint8 type) const;
uint MaxHealth { get const; }
void Damage(uint type, DamageSource source);
void Heal(uint type);
void OverrideActiveAbility(const string &in ability);
LearnedMove@[]@ GetMoves() const;
void ChangeStatBoost(Statistic stat, int8 amount);
const Species@ DisplaySpecies { get const; }
const Species@ DisplayForme { get const; }
uint GetFlatStat(Statistic stat) const;
uint GetBoostedStat(Statistic stat) const;
uint GetBaseStat(Statistic stat) const;
int8 GetStatBoost(Statistic stat) const;
ref AddVolatile(const constString &in name);
void RemoveVolatile(const constString &in name) const;
Battle@ Battle { get const; }
BattleSide@ BattleSide { get const; }
const constString& Status { get const; }
void ClearStatus() const;
void SetStatus(const constString &inout name);
}

View File

@ -0,0 +1,37 @@
type Pokemon {
const Species@ Species { get const; };
const Forme@ Forme { get const; };
uint8 Level { get const; };
uint Experience { get const; };
Gender Gender { get const; };
uint8 Coloring { get const; };
bool Shiny { get const; };
const Item@ HeldItem { get const; };
uint CurrentHealth { get const; };
const constString& ActiveAbility { get const; };
bool IsFainted { get const; };
uint MaxHealth { get const; };
const Species@ DisplaySpecies { get const; };
const Forme@ DisplayForme { get const; };
Battle@ Battle { get const; };
BattleSide@ BattleSide { get const; };
const constString& Status { get const; };
const narray<LearnedMove@>@ Moves { get const; };
bool HasHeldItem(const constString &in name) const;
void SetHeldItem(const constString &in name);
void SetHeldItem(const Item@ item);
string Nickname { get const; };
bool HasType(uint8 type) const;
void Damage(uint type, DamageSource source);
void Heal(uint type);
void OverrideActiveAbility(const string &in ability);
void ChangeStatBoost(Statistic stat, int8 amount);
uint GetFlatStat(Statistic stat) const;
uint GetBoostedStat(Statistic stat) const;
uint GetBaseStat(Statistic stat) const;
int8 GetStatBoost(Statistic stat) const;
ref@ AddVolatile(const constString &in name);
void RemoveVolatile(const constString &in name) const;
void ClearStatus() const;
void SetStatus(const constString &inout name);
}

View File

@ -1,9 +0,0 @@
shared interface Species {
const constString& Name { get const; }
uint16 Id { get const; }
float GenderRate { get const; }
uint8 CaptureRate { get const; }
Gender GetRandomGender() const;
const Forme@ GetForme(string key) const;
const Forme@ DefaultForme { get const; }
}

View File

@ -0,0 +1,9 @@
type Species {
const constString& Name { get const; };
uint16 Id { get const; };
float GenderRate { get const; };
uint8 CaptureRate { get const; };
const Forme@ DefaultForme { get const; };
Gender GetRandomGender() const;
const Forme@ GetForme(string key) const;
}

View File

@ -1,3 +0,0 @@
shared interface SpeciesLibrary {
const Species@ Get(const constString &in name) const;
}

View File

@ -0,0 +1,3 @@
type SpeciesLibrary {
const Species@ Get(const constString &in name) const;
}

View File

@ -1,8 +0,0 @@
shared interface StaticLibrary {
const LibrarySettings@ Settings { get const; }
const SpeciesLibrary@ SpeciesLibrary { get const; }
const MoveLibrary@ MoveLibrary { get const; }
const ItemLibrary@ ItemLibrary { get const; }
const GrowthRateLibrary@ GrowthRateLibrary { get const; }
const TypeLibrary@ TypeLibrary { get const; }
}

View File

@ -0,0 +1,8 @@
type StaticLibrary {
const LibrarySettings@ Settings { get const; };
const SpeciesLibrary@ SpeciesLibrary { get const; };
const MoveLibrary@ MoveLibrary { get const; };
const ItemLibrary@ ItemLibrary { get const; };
const GrowthRateLibrary@ GrowthRateLibrary { get const; };
const TypeLibrary@ TypeLibrary { get const; };
}

View File

@ -1,4 +1,4 @@
shared enum Statistic { enum Statistic {
HP = 0, HP = 0,
Attack = 1, Attack = 1,
Defense = 2, Defense = 2,

View File

@ -1,6 +0,0 @@
shared interface SwitchTurnChoice {
TurnChoiceKind Kind { get const; }
const Pokemon@ User { get const; }
Pokemon@ NewPokemon { get const; }
BaseTurnChoice@ opImplCast();
}

View File

@ -0,0 +1,6 @@
type SwitchTurnChoice {
TurnChoiceKind Kind { get const; };
const Pokemon@ User { get const; };
Pokemon@ NewPokemon { get const; };
BaseTurnChoice@ opImplCast();
}

View File

@ -1,13 +0,0 @@
Party@ CreateSimpleParty(const array<constString>&in species, uint8 level);
Battle@ CreateSimpleBattle(uint seed, const constString&in species1, const constString&in species2, uint8 level);
Battle@ CreateSimpleBattle(uint seed, Party@ p1, Party@ p2);
// Note that this returns a ref handle, and therefore should be cast first.
ref@ CreateMoveScript(const constString&in name);
ExecutingMove@ CreateExecutingMove(const constString&in moveName, Pokemon@ user, Pokemon@ target);
MoveTurnChoice@ CreateMoveTurnChoice(const constString&in moveName, Pokemon@ user, uint8 targetSide, uint8 target);
bool Require(bool expression);
bool RequireEquals(int expected, int actual);
bool RequireEquals(const string &in expected, const string &in actual);

View File

@ -1,4 +1,4 @@
shared enum TurnChoiceKind { enum TurnChoiceKind {
Pass = 0, Pass = 0,
Attack = 1, Attack = 1,
Item = 2, Item = 2,

View File

@ -1,4 +0,0 @@
shared interface TypeLibrary {
uint8 GetTypeId(const constString &in name) const;
float GetSingleEffectiveness(uint8 attacking, uint8 defensive) const;
}

View File

@ -0,0 +1,4 @@
type TypeLibrary {
uint8 GetTypeId(const constString &in name) const;
float GetSingleEffectiveness(uint8 attacking, uint8 defensive) const;
}

View File

@ -1,6 +0,0 @@
shared interface constString {
bool opEquals(const constString &in) const;
bool opEquals(const string &in) const;
uint opImplConv();
string opImplConv();
}

View File

@ -0,0 +1,11 @@
valuetype constString {
behave 2 void f();
behave 0 void f();
behave 0 void f(const string&in s);
behave 0 void f(const constString&in);
constString& opAssign(const constString &in);
bool opEquals(const constString &in) const;
bool opEquals(const string &in) const;
uint opImplConv();
string opImplConv();
}

View File

@ -1,16 +0,0 @@
shared interface dictionary {
void set(const string &in, const ?&in);
bool get(const string &in, ? &out) const;
void set(const string &in, const int64&in);
bool get(const string &in, int64 &out) const;
void set(const string &in, const double&in);
bool get(const string &in, double &out) const;
bool exists(const string &in) const;
bool isEmpty() const;
uint getSize() const;
bool delete(const string &in);
void deleteAll();
string[]@ getKeys() const;
dictionaryValue& opIndex(const string &in);
const dictionaryValue& opIndex(const string &in) const;
}

View File

@ -0,0 +1,18 @@
type dictionary {
behave 4 dictionary@ f(int&in) { repeat { string, ? } };
dictionary& opAssign(const dictionary &in);
void set(const string &in, const ?&in);
bool get(const string &in, ? &out) const;
void set(const string &in, const int64&in);
bool get(const string &in, int64 &out) const;
void set(const string &in, const double&in);
bool get(const string &in, double &out) const;
bool exists(const string &in) const;
bool isEmpty() const;
uint getSize() const;
bool delete(const string &in);
void deleteAll();
string[]@ getKeys() const;
dictionaryValue& opIndex(const string &in);
const dictionaryValue& opIndex(const string &in) const;
}

View File

@ -1,8 +0,0 @@
shared interface dictionaryValue {
dictionaryValue& opHndlAssign(const ? &in);
dictionaryValue& opHndlAssign(const dictionaryValue &in);
void opCast(? &out);
void opConv(? &out);
int64 opConv();
double opConv();
}

View File

@ -0,0 +1,12 @@
type dictionaryValue {
dictionaryValue& opAssign(const dictionaryValue &in);
dictionaryValue& opHndlAssign(const ? &in);
dictionaryValue& opHndlAssign(const dictionaryValue &in);
dictionaryValue& opAssign(const ? &in);
dictionaryValue& opAssign(double);
dictionaryValue& opAssign(int64);
void opCast(? &out);
void opConv(? &out);
int64 opConv();
double opConv();
}

View File

@ -0,0 +1,10 @@
func string formatInt(int64 val, const string&in options = "", uint width = 0);
func string formatUInt(uint64 val, const string&in options = "", uint width = 0);
func string formatFloat(double val, const string&in options = "", uint width = 0, uint precision = 0);
func int64 parseInt(const string&in, uint base = 10, uint&out byteCount = 0);
func uint64 parseUInt(const string&in, uint base = 10, uint&out byteCount = 0);
func double parseFloat(const string&in, uint&out byteCount = 0);
func void print(const string&in);
func void print(const constString&in);
func void throw(const string&in);
func string getExceptionInfo();

View File

@ -0,0 +1,5 @@
type narray<T> {
uint64 Length { get const; };
const T@ At(uint64 index) const;
const T@ opIndex(uint64) const;
}

View File

@ -0,0 +1,7 @@
type ref {
void opCast(? &out);
ref@& opHndlAssign(const ref &in);
ref@& opHndlAssign(const ? &in);
bool opEquals(const ref@ &in) const;
bool opEquals(const ? &in) const;
}

View File

@ -3,7 +3,7 @@ namespace Pokemon{
class HealItem : ItemUseScript { class HealItem : ItemUseScript {
uint _amount; uint _amount;
void OnInitialize(const array<EffectParameter@> &in parameters) override { void OnInitialize(const narray<EffectParameter@>@ parameters) override {
_amount = uint(parameters[0].AsInt()); _amount = uint(parameters[0].AsInt());
} }

View File

@ -1,5 +1,3 @@
#include "Utilities/CopyableMoves.as"
namespace Gen7 { namespace Gen7 {
[Move effect=Assist] [Move effect=Assist]
class Assist : PkmnScript { class Assist : PkmnScript {
@ -8,19 +6,19 @@ namespace Gen7 {
auto battle = user.Battle; auto battle = user.Battle;
auto party = battle.FindPartyForPokemon(user).Party; auto party = battle.FindPartyForPokemon(user).Party;
array<const MoveData@> possibleMoves; array<const MoveData@> possibleMoves;
for (int i = 0; i < party.Length; i++){ for (uint64 i = 0; i < party.Length; i++){
auto mon = party.GetAtIndex(i); auto mon = party.GetAtIndex(i);
if (mon is null){ continue; } if (mon is null){ continue; }
if (mon is user){ continue; } if (mon is user){ continue; }
auto moves = mon.GetMoves(); auto moves = mon.Moves;
for (uint j = 0; j < moves.length; j++){ for (uint64 j = 0; j < moves.Length; j++){
auto m = moves[j]; auto m = moves[j];
if (m is null){ continue; } if (m is null){ continue; }
if (CopyableMoves::CanCopyMove(m.MoveData)){ if (CopyableMoves::CanCopyMove(m.MoveData)){
possibleMoves.insertLast(m.MoveData); possibleMoves.insertLast(m.MoveData);
} }
} }
} }
if (possibleMoves.length == 0){ if (possibleMoves.length == 0){
// TODO: Log failure. // TODO: Log failure.
return; return;

View File

@ -3,7 +3,7 @@ namespace Gen7 {
class ChangeAllTargetStats : PkmnScript{ class ChangeAllTargetStats : PkmnScript{
int8 _amount; int8 _amount;
void OnInitialize(const EffectParameter@[] &in parameters) override{ void OnInitialize(const narray<EffectParameter@>@ parameters) override{
_amount = int8(parameters[0].AsInt()); _amount = int8(parameters[0].AsInt());
} }

View File

@ -3,7 +3,7 @@ namespace Gen7 {
class ChangeTargetAttack : PkmnScript{ class ChangeTargetAttack : PkmnScript{
int8 _amount; int8 _amount;
void OnInitialize(const EffectParameter@[] &in parameters) override{ void OnInitialize(const narray<EffectParameter@>@ parameters) override{
_amount = int8(parameters[0].AsInt()); _amount = int8(parameters[0].AsInt());
} }

View File

@ -3,7 +3,7 @@ namespace Gen7 {
shared class ChangeTargetDefense : PkmnScript{ shared class ChangeTargetDefense : PkmnScript{
int8 _amount; int8 _amount;
void OnInitialize(const EffectParameter@[] &in parameters) override{ void OnInitialize(const narray<EffectParameter@>@ parameters) override{
_amount = int8(parameters[0].AsInt()); _amount = int8(parameters[0].AsInt());
} }

View File

@ -3,7 +3,7 @@ namespace Gen7 {
shared class ChangeTargetSpecialDefense : PkmnScript{ shared class ChangeTargetSpecialDefense : PkmnScript{
int8 _amount; int8 _amount;
void OnInitialize(const array<EffectParameter@> &in parameters) override{ void OnInitialize(const narray<EffectParameter@>@ parameters) override{
_amount = int8(parameters[0].AsInt()); _amount = int8(parameters[0].AsInt());
} }

View File

@ -3,7 +3,7 @@ namespace Gen7 {
shared class ChangeTargetSpeed : PkmnScript{ shared class ChangeTargetSpeed : PkmnScript{
int8 _amount; int8 _amount;
void OnInitialize(const array<EffectParameter@> &in parameters) override{ void OnInitialize(const narray<EffectParameter@>@ parameters) override{
_amount = int8(parameters[0].AsInt()); _amount = int8(parameters[0].AsInt());
} }

View File

@ -7,9 +7,9 @@ namespace Gen7 {
auto battleParty = user.Battle.FindPartyForPokemon(user); auto battleParty = user.Battle.FindPartyForPokemon(user);
if (battleParty !is null){ if (battleParty !is null){
auto party = battleParty.Party; auto party = battleParty.Party.Pokemon;
for (int i = 0; i < party.Length; i++){ for (uint64 i = 0; i < party.Length; i++){
auto m = party.GetAtIndex(i); auto m = party[i];
if (m !is null){ if (m !is null){
m.ClearStatus(); m.ClearStatus();
} }

View File

@ -3,7 +3,7 @@ namespace Gen7 {
shared class DrainMove : PkmnScript{ shared class DrainMove : PkmnScript{
private float _healModifier = 0; private float _healModifier = 0;
void OnInitialize(const array<EffectParameter@> &in parameters) override { void OnInitialize(const narray<EffectParameter@>@ parameters) override {
_healModifier = parameters[0].AsFloat(); _healModifier = parameters[0].AsFloat();
} }

View File

@ -3,7 +3,7 @@ namespace Gen7 {
shared class HealEachEndOfTurn : PkmnScript { shared class HealEachEndOfTurn : PkmnScript {
float _amount; float _amount;
void OnInitialize(const EffectParameter@[] &in parameters) override{ void OnInitialize(const narray<EffectParameter@>@ parameters) override{
_amount = float(parameters[0].AsFloat()) / 100; _amount = float(parameters[0].AsFloat()) / 100;
} }

View File

@ -1,6 +1,6 @@
namespace Gen7 { namespace Gen7 {
namespace CopyableMoves{ namespace CopyableMoves{
dictionary _nonCopyableMoves = { dictionary@ _nonCopyableMoves = {
{"assist", true}, {"assist", true},
{"baneful_bunker", true}, {"baneful_bunker", true},
{"beak_blast", true}, {"beak_blast", true},