More abilities
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2021-11-21 17:54:16 +01:00
parent 8d6ee4008c
commit 669a0094d5
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
10 changed files with 113 additions and 3 deletions

View File

@ -33,7 +33,9 @@
"bad_dreams": { "bad_dreams": {
"effect": "BadDreams" "effect": "BadDreams"
}, },
"battery": {}, "battery": {
"effect": "Battery"
},
"battle_armor": {}, "battle_armor": {},
"battle_bond": {}, "battle_bond": {},
"beast_boost": {}, "beast_boost": {},

View File

@ -0,0 +1,12 @@
namespace Gen7 {
[Ability effect=Battery]
class BatteryAbility : PkmnScript {
void OnSwitchIn(Pokemon@ pokemon) override {
pokemon.BattleSide.AddVolatile("Battery");
}
void OnRemove() override {
cast<Pokemon@>(GetOwner()).BattleSide.RemoveVolatile("Battery");
}
}
}

View File

@ -0,0 +1,8 @@
namespace Gen7 {
[Ability effect=BattleArmor]
class BattleArmor : PkmnScript {
void BlockCritical(ExecutingMove@, Pokemon@, uint8, bool &inout blockCrit) override {
blockCrit = true;
}
}
}

View File

@ -0,0 +1,16 @@
namespace Gen7 {
[Ability effect=BattleBond]
class BattleBond : PkmnScript {
void OnFaintingOpponent(ExecutingMove@ move, Pokemon@, uint8) override {
if (move.User.Species.Name == "greninja"){
move.User.ChangeForme("ash");
}
}
void OverrideBasePower(ExecutingMove@ move, Pokemon@, uint8, uint8 &inout damage) override {
if (move.User.Forme.Name == "ash" && move.UseMove.Name == "water_shuriken"){
damage = 20;
}
}
}
}

View File

@ -0,0 +1,34 @@
namespace Gen7 {
class BeastBoost : PkmnScript {
void OnFaintingOpponent(ExecutingMove@ move, Pokemon@, uint8) override {
Statistic increaseStat = Statistic::HP;
auto user = move.User;
if (user.GetFlatStat(Statistic::Attack) > user.GetFlatStat(Statistic::HP) &&
user.GetFlatStat(Statistic::Attack) > user.GetFlatStat(Statistic::Defense) &&
user.GetFlatStat(Statistic::Attack) > user.GetFlatStat(Statistic::SpecialAttack) &&
user.GetFlatStat(Statistic::Attack) > user.GetFlatStat(Statistic::SpecialDefense) &&
user.GetFlatStat(Statistic::Attack) > user.GetFlatStat(Statistic::Speed)) {
increaseStat = Statistic::Attack;
}
if (user.GetFlatStat(Statistic::Defense) > user.GetFlatStat(Statistic::HP) &&
user.GetFlatStat(Statistic::Defense) > user.GetFlatStat(Statistic::SpecialAttack) &&
user.GetFlatStat(Statistic::Defense) > user.GetFlatStat(Statistic::SpecialDefense) &&
user.GetFlatStat(Statistic::Defense) > user.GetFlatStat(Statistic::Speed)) {
increaseStat = Statistic::Defense;
}
if (user.GetFlatStat(Statistic::SpecialAttack) > user.GetFlatStat(Statistic::HP) &&
user.GetFlatStat(Statistic::SpecialAttack) > user.GetFlatStat(Statistic::SpecialDefense) &&
user.GetFlatStat(Statistic::SpecialAttack) > user.GetFlatStat(Statistic::Speed)) {
increaseStat = Statistic::SpecialAttack;
}
if (user.GetFlatStat(Statistic::SpecialDefense) > user.GetFlatStat(Statistic::HP) &&
user.GetFlatStat(Statistic::SpecialDefense) > user.GetFlatStat(Statistic::Speed)) {
increaseStat = Statistic::SpecialDefense;
}
if (user.GetFlatStat(Statistic::Speed) > user.GetFlatStat(Statistic::HP)) {
increaseStat = Statistic::Speed;
}
user.ChangeStatBoost(increaseStat, 1);
}
}
}

View File

@ -0,0 +1,9 @@
namespace Gen7 {
class Berserk : PkmnScript {
void OnDamage(Pokemon@ pokemon, DamageSource, uint old, uint new) override {
if (float(old) / pokemon.MaxHealth >= 0.5f && float(new) / pokemon.MaxHealth < 0.5f) {
pokemon.ChangeStatBoost(Statistic::SpecialDefense, 1);
}
}
}
}

View File

@ -0,0 +1,25 @@
namespace Gen7 {
[Side effect=Battery]
class BatteryEffect : PkmnScript {
int num = 1;
void Stack() override {
num++;
}
void Unstack() {
num--;
if (num == 0){
cast<BattleSide@>(GetOwner()).RemoveVolatile("Battery");
}
}
void OverrideBasePower(ExecutingMove@ move, Pokemon@, uint8, uint8 &inout power) override {
if (move.UseMove.Category == MoveCategory::Special) {
auto p = power * 1.3f;
if (p > 255) p = 255;
power = uint8(p);
}
}
}
}

View File

@ -17,7 +17,9 @@ shared abstract class PkmnScript {
void OnAttackMiss(ExecutingMove@, Pokemon@){}; void OnAttackMiss(ExecutingMove@, Pokemon@){};
void ChangeAttackType(ExecutingMove@, Pokemon@, uint8, uint8 &inout){}; void ChangeAttackType(ExecutingMove@, Pokemon@, uint8, uint8 &inout){};
void ChangeEffectiveness(ExecutingMove@, Pokemon@, uint8, float &inout){}; void ChangeEffectiveness(ExecutingMove@, Pokemon@, uint8, float &inout){};
void BlockCritical(ExecutingMove@, Pokemon@, uint8, bool &inout){};
void OnIncomingHit(ExecutingMove@, Pokemon@, uint8){}; void OnIncomingHit(ExecutingMove@, Pokemon@, uint8){};
void OnFaintingOpponent(ExecutingMove@, Pokemon@, uint8){};
void PreventSecondaryEffects(ExecutingMove@, Pokemon@, uint8, bool &inout){}; void PreventSecondaryEffects(ExecutingMove@, Pokemon@, uint8, bool &inout){};
void OnSecondaryEffect(ExecutingMove@, Pokemon@, uint8){}; void OnSecondaryEffect(ExecutingMove@, Pokemon@, uint8){};
void OnAfterHits(ExecutingMove@, Pokemon@){}; void OnAfterHits(ExecutingMove@, Pokemon@){};
@ -39,6 +41,7 @@ shared abstract class PkmnScript {
void PreventOpponentRunAway(FleeTurnChoice@, bool &inout){}; void PreventOpponentRunAway(FleeTurnChoice@, bool &inout){};
void PreventOpponentSwitch(SwitchTurnChoice@, bool &inout){}; void PreventOpponentSwitch(SwitchTurnChoice@, bool &inout){};
void OnEndTurn(){}; void OnEndTurn(){};
void OnDamage(Pokemon@, DamageSource, uint, uint){};
void OnFaint(Pokemon@, DamageSource){}; void OnFaint(Pokemon@, DamageSource){};
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){};

View File

@ -39,5 +39,6 @@ type Pokemon {
ref@ AddVolatile(const constString &in name); ref@ AddVolatile(const constString &in name);
void RemoveVolatile(const constString &in name) const; void RemoveVolatile(const constString &in name) const;
void ClearStatus() const; void ClearStatus() const;
void SetStatus(const constString &inout name); void SetStatus(const constString &in name);
void ChangeForme(const constString &in name);
} }

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
TESTERVERSION=0.0.11 TESTERVERSION=0.0.12
# Get the release information from the api for the specified version # Get the release information from the api for the specified version
curl -X GET "https://git.p-epsilon.com/api/v1/repos/Deukhoofd/PokemonScriptTester/releases/tags/$TESTERVERSION" -H "accept: application/json" | curl -X GET "https://git.p-epsilon.com/api/v1/repos/Deukhoofd/PokemonScriptTester/releases/tags/$TESTERVERSION" -H "accept: application/json" |