diff --git a/Abilities.json b/Abilities.json index de39ade..4adc4af 100644 --- a/Abilities.json +++ b/Abilities.json @@ -33,7 +33,9 @@ "bad_dreams": { "effect": "BadDreams" }, - "battery": {}, + "battery": { + "effect": "Battery" + }, "battle_armor": {}, "battle_bond": {}, "beast_boost": {}, diff --git a/Scripts/Abilities/Battery.as b/Scripts/Abilities/Battery.as new file mode 100644 index 0000000..a3088f0 --- /dev/null +++ b/Scripts/Abilities/Battery.as @@ -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(GetOwner()).BattleSide.RemoveVolatile("Battery"); + } + } +} \ No newline at end of file diff --git a/Scripts/Abilities/BattleArmor.as b/Scripts/Abilities/BattleArmor.as new file mode 100644 index 0000000..f7743de --- /dev/null +++ b/Scripts/Abilities/BattleArmor.as @@ -0,0 +1,8 @@ +namespace Gen7 { + [Ability effect=BattleArmor] + class BattleArmor : PkmnScript { + void BlockCritical(ExecutingMove@, Pokemon@, uint8, bool &inout blockCrit) override { + blockCrit = true; + } + } +} \ No newline at end of file diff --git a/Scripts/Abilities/BattleBond.as b/Scripts/Abilities/BattleBond.as new file mode 100644 index 0000000..0012547 --- /dev/null +++ b/Scripts/Abilities/BattleBond.as @@ -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; + } + } + } +} \ No newline at end of file diff --git a/Scripts/Abilities/BeastBoost.as b/Scripts/Abilities/BeastBoost.as new file mode 100644 index 0000000..fe07a60 --- /dev/null +++ b/Scripts/Abilities/BeastBoost.as @@ -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); + } + } +} \ No newline at end of file diff --git a/Scripts/Abilities/Berserk.as b/Scripts/Abilities/Berserk.as new file mode 100644 index 0000000..d0435fe --- /dev/null +++ b/Scripts/Abilities/Berserk.as @@ -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); + } + } + } +} \ No newline at end of file diff --git a/Scripts/BattleSide/BatteryEffect.as b/Scripts/BattleSide/BatteryEffect.as new file mode 100644 index 0000000..813e146 --- /dev/null +++ b/Scripts/BattleSide/BatteryEffect.as @@ -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(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); + } + } + } +} \ No newline at end of file diff --git a/Scripts/Interfaces/PkmnScript.as b/Scripts/Interfaces/PkmnScript.as index a35c35c..9a7e437 100644 --- a/Scripts/Interfaces/PkmnScript.as +++ b/Scripts/Interfaces/PkmnScript.as @@ -17,7 +17,9 @@ shared abstract class PkmnScript { void OnAttackMiss(ExecutingMove@, Pokemon@){}; void ChangeAttackType(ExecutingMove@, Pokemon@, uint8, uint8 &inout){}; void ChangeEffectiveness(ExecutingMove@, Pokemon@, uint8, float &inout){}; + void BlockCritical(ExecutingMove@, Pokemon@, uint8, bool &inout){}; void OnIncomingHit(ExecutingMove@, Pokemon@, uint8){}; + void OnFaintingOpponent(ExecutingMove@, Pokemon@, uint8){}; void PreventSecondaryEffects(ExecutingMove@, Pokemon@, uint8, bool &inout){}; void OnSecondaryEffect(ExecutingMove@, Pokemon@, uint8){}; void OnAfterHits(ExecutingMove@, Pokemon@){}; @@ -39,6 +41,7 @@ shared abstract class PkmnScript { void PreventOpponentRunAway(FleeTurnChoice@, bool &inout){}; void PreventOpponentSwitch(SwitchTurnChoice@, bool &inout){}; void OnEndTurn(){}; + void OnDamage(Pokemon@, DamageSource, uint, uint){}; void OnFaint(Pokemon@, DamageSource){}; void ModifyCriticalStage(ExecutingMove@, Pokemon@, uint8, uint8 &inout){}; void OverrideCriticalModifier(ExecutingMove@, Pokemon@, uint8, float &inout){}; diff --git a/Scripts/Interfaces/Pokemon.astypedef b/Scripts/Interfaces/Pokemon.astypedef index 0a63ac7..abc3778 100644 --- a/Scripts/Interfaces/Pokemon.astypedef +++ b/Scripts/Interfaces/Pokemon.astypedef @@ -39,5 +39,6 @@ type Pokemon { ref@ AddVolatile(const constString &in name); void RemoveVolatile(const constString &in name) const; void ClearStatus() const; - void SetStatus(const constString &inout name); + void SetStatus(const constString &in name); + void ChangeForme(const constString &in name); } diff --git a/fetch_tester.sh b/fetch_tester.sh index d67ba92..92d0506 100755 --- a/fetch_tester.sh +++ b/fetch_tester.sh @@ -1,6 +1,6 @@ #!/bin/sh -TESTERVERSION=0.0.11 +TESTERVERSION=0.0.12 # 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" |