From 6f7b88ab197f260d88f5f2b37632eb7033aa67fd Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Sat, 12 Feb 2022 14:28:05 +0100 Subject: [PATCH] Adds Battle Armor effect --- Abilities.json | 4 +++- Scripts/Abilities/PreventCritical.as | 8 ++++++++ Scripts/Interfaces/PkmnScript.as | 1 + Scripts/Interfaces/globals.astypedef | 24 ++++++++++++++++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 Scripts/Abilities/PreventCritical.as diff --git a/Abilities.json b/Abilities.json index 4adc4af..b5bb0b7 100644 --- a/Abilities.json +++ b/Abilities.json @@ -36,7 +36,9 @@ "battery": { "effect": "Battery" }, - "battle_armor": {}, + "battle_armor": { + "effect": "PreventCritical" + }, "battle_bond": {}, "beast_boost": {}, "berserk": {}, diff --git a/Scripts/Abilities/PreventCritical.as b/Scripts/Abilities/PreventCritical.as new file mode 100644 index 0000000..25b7998 --- /dev/null +++ b/Scripts/Abilities/PreventCritical.as @@ -0,0 +1,8 @@ +namespace Gen7 { + [Ability effect=PreventCritical] + class PreventCriticalAbility : PkmnScript { + void PreventIncomingCritical(ExecutingMove@, Pokemon@, uint8, bool &inout prevent) override { + prevent = true; + }; + } +} \ No newline at end of file diff --git a/Scripts/Interfaces/PkmnScript.as b/Scripts/Interfaces/PkmnScript.as index 9a7e437..5f0a4a9 100644 --- a/Scripts/Interfaces/PkmnScript.as +++ b/Scripts/Interfaces/PkmnScript.as @@ -43,6 +43,7 @@ shared abstract class PkmnScript { void OnEndTurn(){}; void OnDamage(Pokemon@, DamageSource, uint, uint){}; void OnFaint(Pokemon@, DamageSource){}; + void PreventIncomingCritical(ExecutingMove@, Pokemon@, uint8, bool &inout){}; void ModifyCriticalStage(ExecutingMove@, Pokemon@, uint8, uint8 &inout){}; void OverrideCriticalModifier(ExecutingMove@, Pokemon@, uint8, float &inout){}; void OverrideSTABModifier(ExecutingMove@, Pokemon@, uint8, float &inout){}; diff --git a/Scripts/Interfaces/globals.astypedef b/Scripts/Interfaces/globals.astypedef index 1355951..e4dcf4f 100644 --- a/Scripts/Interfaces/globals.astypedef +++ b/Scripts/Interfaces/globals.astypedef @@ -4,6 +4,30 @@ func string formatFloat(double val, const string&in options = "", uint width = 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 float fpFromIEEE(uint); +func uint fpToIEEE(float); +func double fpFromIEEE(uint64); +func uint64 fpToIEEE(double); +func bool closeTo(float, float, float = 0.00001f); +func bool closeTo(double, double, double = 0.0000000001); +func float cos(float); +func float sin(float); +func float tan(float); +func float acos(float); +func float asin(float); +func float atan(float); +func float atan2(float, float); +func float cosh(float); +func float sinh(float); +func float tanh(float); +func float log(float); +func float log10(float); +func float pow(float, float); +func float sqrt(float); +func float ceil(float); +func float abs(float); +func float floor(float); +func float fraction(float); func void print(const string&in); func void print(const constString&in); func void throw(const string&in);