Loads of work on getting data ready.
This commit is contained in:
parent
d3262e924d
commit
82ac1061fa
|
@ -3560,7 +3560,11 @@
|
||||||
"itemType": "medicine",
|
"itemType": "medicine",
|
||||||
"flags": [],
|
"flags": [],
|
||||||
"price": 200,
|
"price": 200,
|
||||||
"flingPower": 30
|
"flingPower": 30,
|
||||||
|
"effect": {
|
||||||
|
"name": "heal",
|
||||||
|
"parameters": [20]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "powder_jar",
|
"name": "powder_jar",
|
||||||
|
|
3938
Moves.json
3938
Moves.json
File diff suppressed because it is too large
Load Diff
13176
Pokemon.json
13176
Pokemon.json
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,7 @@
|
||||||
shared interface BaseTurnChoice {
|
shared interface BaseTurnChoice {
|
||||||
TurnChoiceKind Kind { get const; }
|
TurnChoiceKind Kind { get const; }
|
||||||
Pokemon@ User { get const; }
|
const Pokemon@ User { get const; }
|
||||||
MoveTurnChoice@ opCast();
|
MoveTurnChoice@ opCast();
|
||||||
|
SwitchTurnChoice@ opCast();
|
||||||
|
FleeTurnChoice@ opCast();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,10 @@ shared interface Battle {
|
||||||
bool CanFlee { get const; }
|
bool CanFlee { get const; }
|
||||||
BattleRandom@ Random { get const; }
|
BattleRandom@ Random { get const; }
|
||||||
ChoiceQueue@ TurnQueue { get const; }
|
ChoiceQueue@ TurnQueue { get const; }
|
||||||
void AddVolatile(const constString &in name) const;
|
ref AddVolatile(const constString &in name);
|
||||||
void RemoveVolatile(const constString &in name) const;
|
void RemoveVolatile(const constString &in name) const;
|
||||||
void SetWeather(const constString &in name) const;
|
void SetWeather(const constString &in name) const;
|
||||||
void ClearWeather(const constString &in name) const;
|
void ClearWeather(const constString &in name) const;
|
||||||
const constString& GetWeatherName() const;
|
const constString& GetWeatherName() const;
|
||||||
|
BattleSide@ GetBattleSide(uint8 index);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
shared interface BattleSide {
|
||||||
|
bool SwapPositions(uint8 a, uint8 b);
|
||||||
|
uint8 SideIndex { get const; }
|
||||||
|
uint8 GetPokemonIndex(const Pokemon@ pokemon) const;
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
shared interface FleeTurnChoice {
|
||||||
|
TurnChoiceKind Kind { get const; }
|
||||||
|
const Pokemon@ User { get const; }
|
||||||
|
BaseTurnChoice@ opImplCast();
|
||||||
|
}
|
|
@ -4,4 +4,6 @@ shared interface HitData {
|
||||||
float Effectiveness { get const; }
|
float Effectiveness { get const; }
|
||||||
uint Damage { get const; }
|
uint Damage { get const; }
|
||||||
uint8 Type { get const; }
|
uint8 Type { get const; }
|
||||||
|
bool HasFailed { get const; }
|
||||||
|
void Fail();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
shared abstract class ItemUseScript {
|
||||||
|
void OnInitialize(const EffectParameter@[] &in){};
|
||||||
|
bool IsItemUsable(){};
|
||||||
|
bool IsPokemonUseItem(){};
|
||||||
|
bool IsUseValidForPokemon(Pokemon@){};
|
||||||
|
bool IsHoldable(){};
|
||||||
|
void OnUse(){};
|
||||||
|
void OnPokemonUse(Pokemon@){};
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
shared interface MoveTurnChoice {
|
shared interface MoveTurnChoice {
|
||||||
TurnChoiceKind Kind { get const; }
|
TurnChoiceKind Kind { get const; }
|
||||||
Pokemon@ User { get const; }
|
const Pokemon@ User { get const; }
|
||||||
LearnedMove@ Move { get const; }
|
LearnedMove@ Move { get const; }
|
||||||
int8 Priority { get const; }
|
int8 Priority { get const; }
|
||||||
BaseTurnChoice@ opImplCast();
|
BaseTurnChoice@ opImplCast();
|
||||||
|
|
|
@ -4,6 +4,7 @@ shared abstract class PkmnScript {
|
||||||
void OnRemove(){};
|
void OnRemove(){};
|
||||||
void OnBeforeTurn(BaseTurnChoice@){};
|
void OnBeforeTurn(BaseTurnChoice@){};
|
||||||
void ChangeAttack(MoveTurnChoice@, constString &inout){};
|
void ChangeAttack(MoveTurnChoice@, constString &inout){};
|
||||||
|
void ModifyNumberOfHits(MoveTurnChoice@, uint8 &inout){};
|
||||||
void PreventAttack(ExecutingMove@, bool &inout){};
|
void PreventAttack(ExecutingMove@, bool &inout){};
|
||||||
void FailAttack(ExecutingMove@, bool &inout){};
|
void FailAttack(ExecutingMove@, bool &inout){};
|
||||||
void StopBeforeAttack(ExecutingMove@, bool &inout){};
|
void StopBeforeAttack(ExecutingMove@, bool &inout){};
|
||||||
|
@ -26,6 +27,13 @@ shared abstract class PkmnScript {
|
||||||
void ModifyStatModifier(ExecutingMove@, Pokemon@, uint8, float &inout){};
|
void ModifyStatModifier(ExecutingMove@, Pokemon@, uint8, float &inout){};
|
||||||
void ModifyDamageModifier(ExecutingMove@, Pokemon@, uint8, float &inout){};
|
void ModifyDamageModifier(ExecutingMove@, Pokemon@, uint8, float &inout){};
|
||||||
void OverrideDamage(ExecutingMove@, Pokemon@, uint8, uint &inout){};
|
void OverrideDamage(ExecutingMove@, Pokemon@, uint8, uint &inout){};
|
||||||
|
void ChangePriority(MoveTurnChoice@, int8 &inout){};
|
||||||
|
void OnFail(Pokemon@){};
|
||||||
|
void OnOpponentFail(Pokemon@){};
|
||||||
|
void PreventRunAway(FleeTurnChoice@, bool &inout){};
|
||||||
|
void PreventOpponentRunAway(FleeTurnChoice@, bool &inout){};
|
||||||
|
void PreventOpponentSwitch(SwitchTurnChoice@, bool &inout){};
|
||||||
|
void OnEndTurn(Pokemon@){};
|
||||||
void ModifyCriticalStage(ExecutingMove@, Pokemon@, uint8, uint8 &inout){};
|
void ModifyCriticalStage(ExecutingMove@, Pokemon@, uint8, uint8 &inout){};
|
||||||
void OverrideCriticalModifier(ExecutingMove@, Pokemon@, uint8, float &inout){};
|
void OverrideCriticalModifier(ExecutingMove@, Pokemon@, uint8, float &inout){};
|
||||||
void OverrideSTABModifier(ExecutingMove@, Pokemon@, uint8, float &inout){};
|
void OverrideSTABModifier(ExecutingMove@, Pokemon@, uint8, float &inout){};
|
||||||
|
|
|
@ -27,7 +27,8 @@ shared interface Pokemon {
|
||||||
uint GetBoostedStat(Statistic stat) const;
|
uint GetBoostedStat(Statistic stat) const;
|
||||||
uint GetBaseStat(Statistic stat) const;
|
uint GetBaseStat(Statistic stat) const;
|
||||||
int8 GetStatBoost(Statistic stat) const;
|
int8 GetStatBoost(Statistic stat) const;
|
||||||
void AddVolatile(const constString &in name) const;
|
ref AddVolatile(const constString &in name);
|
||||||
void RemoveVolatile(const constString &in name) const;
|
void RemoveVolatile(const constString &in name) const;
|
||||||
const Battle@ Battle { get const; }
|
Battle@ Battle { get const; }
|
||||||
|
BattleSide@ BattleSide { get const; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
shared interface SwitchTurnChoice {
|
shared interface SwitchTurnChoice {
|
||||||
TurnChoiceKind Kind { get const; }
|
TurnChoiceKind Kind { get const; }
|
||||||
Pokemon@ User { get const; }
|
const Pokemon@ User { get const; }
|
||||||
Pokemon@ NewPokemon { get const; }
|
Pokemon@ NewPokemon { get const; }
|
||||||
MoveTurnChoice@ opCast();
|
|
||||||
BaseTurnChoice@ opImplCast();
|
BaseTurnChoice@ opImplCast();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
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;
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
shared interface dictionaryValue {
|
||||||
|
dictionaryValue& opHndlAssign(const ? &in);
|
||||||
|
dictionaryValue& opHndlAssign(const dictionaryValue &in);
|
||||||
|
void opCast(? &out);
|
||||||
|
void opConv(? &out);
|
||||||
|
int64 opConv();
|
||||||
|
double opConv();
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
namespace Pokemon{
|
||||||
|
[ItemUse effect=heal]
|
||||||
|
class HealItem : ItemUseScript {
|
||||||
|
uint _amount;
|
||||||
|
|
||||||
|
void OnInitialize(const array<EffectParameter@> &in parameters) override {
|
||||||
|
_amount = uint(parameters[0].AsInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsItemUsable() override {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsPokemonUseItem() override {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsUseValidForPokemon(Pokemon@ pokemon) override {
|
||||||
|
return pokemon.CurrentHealth < pokemon.MaxHealth;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnPokemonUse(Pokemon@ pkmn) override {
|
||||||
|
pkmn.Heal(_amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
namespace Gen7 {
|
||||||
|
[Move effect=2_5HitMove]
|
||||||
|
class MultiHitMove : PkmnScript{
|
||||||
|
void ModifyNumberOfHits(MoveTurnChoice@ choice, uint8 &inout numberHits) override {
|
||||||
|
auto randValue = choice.User.Battle.Random.Get(6);
|
||||||
|
switch (randValue){
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
numberHits = 2;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
case 3:
|
||||||
|
numberHits = 3;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
numberHits = 4;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
numberHits = 5;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw("Invalid randValue");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
namespace Gen7 {
|
||||||
|
[Move effect=ChangeAllTargetStats]
|
||||||
|
class ChangeAllTargetStats : PkmnScript{
|
||||||
|
int8 _amount;
|
||||||
|
|
||||||
|
void OnInitialize(const EffectParameter@[] &in parameters) override{
|
||||||
|
_amount = int8(parameters[0].AsInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit) override{
|
||||||
|
target.ChangeStatBoost(Statistic::Attack, _amount);
|
||||||
|
target.ChangeStatBoost(Statistic::Defense, _amount);
|
||||||
|
target.ChangeStatBoost(Statistic::SpecialAttack, _amount);
|
||||||
|
target.ChangeStatBoost(Statistic::SpecialDefense, _amount);
|
||||||
|
target.ChangeStatBoost(Statistic::Speed, _amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
namespace Gen7 {
|
||||||
|
[Move effect=ChangeTargetAtt]
|
||||||
|
class ChangeTargetAttack : PkmnScript{
|
||||||
|
int8 _amount;
|
||||||
|
|
||||||
|
void OnInitialize(const EffectParameter@[] &in parameters) override{
|
||||||
|
_amount = int8(parameters[0].AsInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit) override{
|
||||||
|
target.ChangeStatBoost(Statistic::Attack, _amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,7 +8,7 @@ namespace Gen7{
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit) override {
|
void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit) override {
|
||||||
auto hitData = attack.GetAttackDataForTarget(target).GetHit(hit);
|
auto hitData = attack.GetHitData(target, hit);
|
||||||
auto damage = hitData.Damage;
|
auto damage = hitData.Damage;
|
||||||
float mod = _healModifier;
|
float mod = _healModifier;
|
||||||
if (attack.User.HasHeldItem("big_root")){
|
if (attack.User.HasHeldItem("big_root")){
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
namespace Gen7 {
|
||||||
|
[Move effect=HealEachEndOfTurn]
|
||||||
|
shared class HealEachEndOfTurn : PkmnScript {
|
||||||
|
float _amount;
|
||||||
|
|
||||||
|
void OnInitialize(const EffectParameter@[] &in parameters) override{
|
||||||
|
_amount = float(parameters[0].AsFloat()) / 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnSecondaryEffect(ExecutingMove@, Pokemon@ pokemon, uint8) override {
|
||||||
|
auto script = cast<HealEachEndOfTurnEffect>(pokemon.AddVolatile("HealEachEndOfTurn"));
|
||||||
|
script.SetBaseHealAmount(_amount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
namespace Gen7 {
|
||||||
|
[Move effect=PreventFoeRunning]
|
||||||
|
shared class PreventFoeRunning : PkmnScript {
|
||||||
|
void OnSecondaryEffect(ExecutingMove@ move, Pokemon@ target, uint8 hit) override {
|
||||||
|
auto script = cast<PreventFoeRunningEffect>(move.User.AddVolatile("PreventFoeRunning"));
|
||||||
|
script.SetLockedOpponent(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
namespace Gen7 {
|
||||||
|
[Move effect=Struggle]
|
||||||
|
shared class Struggle : PkmnScript {
|
||||||
|
void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit) override{
|
||||||
|
attack.User.Damage(uint(attack.User.MaxHealth / 4), DamageSource::Struggle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
namespace Gen7 {
|
||||||
|
[Move effect=SwapWithTarget]
|
||||||
|
shared class SwapWithTarget : PkmnScript {
|
||||||
|
void OnSecondaryEffect(ExecutingMove@ move, Pokemon@ target, uint8 hit) override {
|
||||||
|
auto userSide = move.User.BattleSide;
|
||||||
|
auto targetSide = target.BattleSide;
|
||||||
|
if (userSide !is targetSide){
|
||||||
|
move.GetHitData(target, hit).Fail();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto userIndex = userSide.GetPokemonIndex(move.User);
|
||||||
|
auto targetIndex = userSide.GetPokemonIndex(target);
|
||||||
|
if (!userSide.SwapPositions(userIndex, targetIndex)){
|
||||||
|
move.GetHitData(target, hit).Fail();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ namespace Pokemon{
|
||||||
class Flinch : PkmnScript{
|
class Flinch : PkmnScript{
|
||||||
void PreventAttack(ExecutingMove@ attack, bool& result) override {
|
void PreventAttack(ExecutingMove@ attack, bool& result) override {
|
||||||
result = true;
|
result = true;
|
||||||
|
attack.User.RemoveVolatile("flinch");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
namespace Gen7 {
|
||||||
|
[Pokemon effect=HealEachEndOfTurn]
|
||||||
|
shared class HealEachEndOfTurnEffect : PkmnScript {
|
||||||
|
float _factor;
|
||||||
|
|
||||||
|
void OnEndTurn(Pokemon@ pokemon) override {
|
||||||
|
auto healAmount = pokemon.MaxHealth * _factor;
|
||||||
|
if (pokemon.HasHeldItem("big_root")){
|
||||||
|
healAmount *= 1.3;
|
||||||
|
}
|
||||||
|
pokemon.Heal(uint(healAmount));
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetBaseHealAmount(float factor){
|
||||||
|
_factor = factor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
namespace Gen7 {
|
||||||
|
[Pokemon effect=PreventFoeRunning]
|
||||||
|
shared class PreventFoeRunningEffect : PkmnScript {
|
||||||
|
Pokemon@[] _trappedOpponents;
|
||||||
|
|
||||||
|
void PreventOpponentRunAway(FleeTurnChoice@ choice, bool &inout o) override {
|
||||||
|
for(uint i = 0; i < _trappedOpponents.length; i++)
|
||||||
|
{
|
||||||
|
if (_trappedOpponents[i] is choice.User){
|
||||||
|
o = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetLockedOpponent(Pokemon@ opponent){
|
||||||
|
_trappedOpponents.insertLast(opponent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue