Initial commit.

This commit is contained in:
2020-04-11 00:23:17 +02:00
commit 5650fd004c
18 changed files with 94793 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
shared abstract class PkmnScript {
// CreatureLib methods
void OnInitialize(const array<EffectParameter@> &in parameters){};
void Stack(){};
void OnRemove(){};
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 OnStatusMove(ExecutingMove@ attack, Pokemon@ target, uint8 hit){};
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 ModifyEffectChance(ExecutingMove@ attack, Pokemon@ target, float& chance){};
void ModifyIncomingEffectChance(ExecutingMove@ attack, Pokemon@ target, float& chance){};
void OverrideBasePower(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint8& chance){};
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, int& damage){};
// PkmnLib methods
void ModifyCriticalStage(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint8& critStage){};
}

View File

@@ -0,0 +1,38 @@
interface Pokemon{
const Species@ Species { get const; }
const Forme@ Forme { get const; }
const Species@ DisplaySpecies { get const; }
const Forme@ DisplayForme { get const; }
uint8 Level { get const; }
uint32 Experience { get const; }
Gender Gender { get const; }
uint8 Coloring { get const; }
bool Shiny { get const; }
const Item@ HeldItem { get const; }
uint32 CurrentHealth{ get const; }
const string& Nickname { get const; }
const string& ActiveAbility { get const; }
bool IsFainted { get const; }
bool HasType(uint8) const;
uint32 MaxHealth{ get const; };
const Species@ DisplaySpecies { get const; }
uint8[]@ GetTypes() const;
LearnedMove@[]@ GetMoves() const
void ChangeStatBoost(Statistic stat, int8 amount);
uint32 GetFlatStat(Statistic stat) const;
uint32 GetBoostedStat(Statistic stat) const;
uint32 GetBaseStat(Statistic stat) const;
int8 GetStatBoost(Statistic stat) const;
bool HasHeldItem(const string &in name) const;
void Damage(uint32 amount, DamageSource source);
void Heal(uint32 amount);
void OverrideActiveAbility(const string &in ability);
void SetHeldItem(const string &in name);
void SetHeldItem(const Item@ name);
Battle Battle{ get const; }
}

View File

@@ -0,0 +1,11 @@
namespace Gen7 {
[Move effect=Acrobatics]
class Acrobatics : PkmnScript{
void OverrideBasePower(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint8& basePower) override {
if (attack.User.HeldItem is null){
if (basePower >= 128) basePower = 255;
else basePower *= 2;
}
};
}
}

View File

@@ -0,0 +1,13 @@
namespace Gen7{
[Move effect=Acupressure]
class Acupressure : PkmnScript {
void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit) override {
if (attack.User is target){
// TODO: Fail.
return;
}
auto randStat = Statistic(target.Battle.Random.Get(0, 6));
target.ChangeStatBoost(randStat, 2);
};
}
}

11
Scripts/Moves/AfterYou.as Normal file
View File

@@ -0,0 +1,11 @@
namespace Gen7 {
[Move effect=AfterYou]
class AfterYou : PkmnScript{
void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit) override {
bool result = target.Battle.TurnQueue.MovePokemonChoiceNext(target);
if (!result){
// TODO: Failed
}
};
}
}

View File

@@ -0,0 +1,14 @@
namespace Gen7 {
[Move effect=ChangeTargetDef]
shared class ChangeTargetDefense : PkmnScript{
int8 _amount;
void OnInitialize(const array<EffectParameter@> &in parameters) override{
_amount = int8(parameters[0].AsInt());
}
void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit) override{
target.ChangeStatBoost(Statistic::Defense, _amount);
}
}
}

View File

@@ -0,0 +1,14 @@
namespace Gen7 {
[Move effect=ChangeTargetSpDef]
shared class ChangeTargetSpecialDefense : PkmnScript{
int8 _amount;
void OnInitialize(const array<EffectParameter@> &in parameters) override{
_amount = int8(parameters[0].AsInt());
}
void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit) override{
target.ChangeStatBoost(Statistic::SpecialDefense, _amount);
}
}
}

View File

@@ -0,0 +1,14 @@
namespace Gen7 {
[Move effect=ChangeTargetSpeed]
shared class ChangeTargetSpeed : PkmnScript{
int8 _amount;
void OnInitialize(const array<EffectParameter@> &in parameters) override{
_amount = int8(parameters[0].AsInt());
}
void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit) override{
target.ChangeStatBoost(Statistic::Speed, _amount);
}
}
}

20
Scripts/Moves/Drain.as Normal file
View File

@@ -0,0 +1,20 @@
namespace Gen7{
[Move effect=drain]
shared class DrainMove : PkmnScript{
private float _healModifier = 0;
void OnInitialize(const array<EffectParameter@> &in parameters) override{
_healModifier = parameters[0].AsFloat();
}
void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit) override{
auto hitData = attack.GetAttackDataForTarget(target).GetHit(hit);
auto damage = hitData.Damage;
float mod = _healModifier;
if (attack.User.HasHeldItem("big_root")){
mod *= 1.3;
}
attack.User.Heal(uint(damage * mod));
}
}
}

8
Scripts/Moves/Flinch.as Normal file
View File

@@ -0,0 +1,8 @@
namespace Gen7{
[Move effect=Flinch]
class Flinch : PkmnScript {
void OnSecondaryEffect(ExecutingMove@ attack, Pokemon@ target, uint8 hit) override{
target.AddVolatile("flinch");
}
}
}

View File

@@ -0,0 +1,8 @@
namespace Gen7 {
[Move effect=IncreasedCriticalStage]
shared class IncreasedCriticalStage : PkmnScript {
void ModifyCriticalStage(ExecutingMove@ attack, Pokemon@ target, uint8 hit, uint8& critStage) override{
critStage++;
};
}
}

View File

@@ -0,0 +1,8 @@
namespace Pokemon{
[Pokemon effect=Flinch]
class Flinch : PkmnScript{
void PreventAttack(ExecutingMove@ attack, bool& result) override {
result = true;
}
}
}