From f6c7a2906def711578cbbf7da67992fb3f1ca9e8 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Mon, 1 May 2023 22:07:00 -0400 Subject: [PATCH] Add crit block abilities and fix some common anims --- public/battle-anims/common-paralysis.json | 110 +-- public/battle-anims/common-wrap.json | 908 +++++++++++----------- src/battle-phases.ts | 2 +- src/data/ability.ts | 12 +- src/pokemon.ts | 6 +- 5 files changed, 523 insertions(+), 515 deletions(-) diff --git a/public/battle-anims/common-paralysis.json b/public/battle-anims/common-paralysis.json index 6a8a92a324a..5ce9fdfa735 100644 --- a/public/battle-anims/common-paralysis.json +++ b/public/battle-anims/common-paralysis.json @@ -13,7 +13,7 @@ "blendType": 0, "target": 0, "graphicFrame": 0, - "opacity": 0, + "opacity": 255, "color": [ 0, 0, @@ -21,8 +21,8 @@ 0 ], "tone": [ - 0, - 0, + 40, + 40, 0, 0 ], @@ -55,8 +55,8 @@ 0 ], "tone": [ - 40, - 40, + 0, + 0, 0, 0 ], @@ -253,7 +253,7 @@ "blendType": 0, "target": 0, "graphicFrame": 0, - "opacity": 0, + "opacity": 255, "color": [ 0, 0, @@ -261,8 +261,8 @@ 0 ], "tone": [ - 0, - 0, + 75, + 75, 0, 0 ], @@ -295,8 +295,8 @@ 0 ], "tone": [ - 75, - 75, + 0, + 0, 0, 0 ], @@ -527,7 +527,7 @@ "blendType": 0, "target": 0, "graphicFrame": 0, - "opacity": 0, + "opacity": 255, "color": [ 0, 0, @@ -535,8 +535,8 @@ 0 ], "tone": [ - 0, - 0, + 125, + 125, 0, 0 ], @@ -569,8 +569,8 @@ 0 ], "tone": [ - 125, - 125, + 0, + 0, 0, 0 ], @@ -801,7 +801,7 @@ "blendType": 0, "target": 0, "graphicFrame": 0, - "opacity": 0, + "opacity": 255, "color": [ 0, 0, @@ -809,8 +809,8 @@ 0 ], "tone": [ - 0, - 0, + 255, + 255, 0, 0 ], @@ -843,8 +843,8 @@ 0 ], "tone": [ - 255, - 255, + 0, + 0, 0, 0 ], @@ -1075,7 +1075,7 @@ "blendType": 0, "target": 0, "graphicFrame": 0, - "opacity": 0, + "opacity": 255, "color": [ 0, 0, @@ -1083,8 +1083,8 @@ 0 ], "tone": [ - 0, - 0, + 255, + 255, 0, 0 ], @@ -1117,8 +1117,8 @@ 0 ], "tone": [ - 255, - 255, + 0, + 0, 0, 0 ], @@ -1349,7 +1349,7 @@ "blendType": 0, "target": 0, "graphicFrame": 0, - "opacity": 0, + "opacity": 255, "color": [ 0, 0, @@ -1357,8 +1357,8 @@ 0 ], "tone": [ - 0, - 0, + 255, + 255, 0, 0 ], @@ -1391,8 +1391,8 @@ 0 ], "tone": [ - 255, - 255, + 0, + 0, 0, 0 ], @@ -1623,7 +1623,7 @@ "blendType": 0, "target": 0, "graphicFrame": 0, - "opacity": 0, + "opacity": 255, "color": [ 0, 0, @@ -1631,8 +1631,8 @@ 0 ], "tone": [ - 0, - 0, + 255, + 255, 0, 0 ], @@ -1665,8 +1665,8 @@ 0 ], "tone": [ - 255, - 255, + 0, + 0, 0, 0 ], @@ -1897,7 +1897,7 @@ "blendType": 0, "target": 0, "graphicFrame": 0, - "opacity": 0, + "opacity": 255, "color": [ 0, 0, @@ -1905,8 +1905,8 @@ 0 ], "tone": [ - 0, - 0, + 255, + 255, 0, 0 ], @@ -1939,8 +1939,8 @@ 0 ], "tone": [ - 255, - 255, + 0, + 0, 0, 0 ], @@ -2171,7 +2171,7 @@ "blendType": 0, "target": 0, "graphicFrame": 0, - "opacity": 0, + "opacity": 255, "color": [ 0, 0, @@ -2179,8 +2179,8 @@ 0 ], "tone": [ - 0, - 0, + 125, + 125, 0, 0 ], @@ -2213,8 +2213,8 @@ 0 ], "tone": [ - 125, - 125, + 0, + 0, 0, 0 ], @@ -2445,7 +2445,7 @@ "blendType": 0, "target": 0, "graphicFrame": 0, - "opacity": 0, + "opacity": 255, "color": [ 0, 0, @@ -2453,8 +2453,8 @@ 0 ], "tone": [ - 0, - 0, + 75, + 75, 0, 0 ], @@ -2487,8 +2487,8 @@ 0 ], "tone": [ - 75, - 75, + 0, + 0, 0, 0 ], @@ -2685,7 +2685,7 @@ "blendType": 0, "target": 0, "graphicFrame": 0, - "opacity": 0, + "opacity": 255, "color": [ 0, 0, @@ -2693,8 +2693,8 @@ 0 ], "tone": [ - 0, - 0, + 40, + 40, 0, 0 ], @@ -2727,8 +2727,8 @@ 0 ], "tone": [ - 40, - 40, + 0, + 0, 0, 0 ], diff --git a/public/battle-anims/common-wrap.json b/public/battle-anims/common-wrap.json index 6887fc884a1..64df3557681 100644 --- a/public/battle-anims/common-wrap.json +++ b/public/battle-anims/common-wrap.json @@ -13,7 +13,7 @@ "blendType": 0, "target": 0, "graphicFrame": 0, - "opacity": 0, + "opacity": 255, "color": [ 0, 0, @@ -117,7 +117,7 @@ "blendType": 0, "target": 0, "graphicFrame": 0, - "opacity": 0, + "opacity": 255, "color": [ 0, 0, @@ -213,46 +213,46 @@ { "x": 0, "y": 0, - "zoomX": 100, - "zoomY": 100, - "angle": 0, - "mirror": false, - "visible": true, - "blendType": 0, - "target": 0, - "graphicFrame": 0, - "opacity": 0, - "color": [ - 0, - 0, - 0, - 0 - ], - "tone": [ - 0, - 0, - 0, - 0 - ], - "flash": [ - 0, - 0, - 0, - 0 - ], - "locked": false, - "priority": 1, - "focus": 2 - }, - { - "x": 128, - "y": -64, "zoomX": 92, "zoomY": 102, "angle": 0, "mirror": false, "visible": true, "blendType": 0, + "target": 0, + "graphicFrame": 0, + "opacity": 255, + "color": [ + 0, + 0, + 0, + 0 + ], + "tone": [ + 0, + 0, + 0, + 0 + ], + "flash": [ + 0, + 0, + 0, + 0 + ], + "locked": false, + "priority": 1, + "focus": 2 + }, + { + "x": 128, + "y": -64, + "zoomX": 100, + "zoomY": 100, + "angle": 0, + "mirror": false, + "visible": true, + "blendType": 0, "target": 1, "graphicFrame": 0, "opacity": 255, @@ -317,46 +317,46 @@ { "x": 0, "y": 0, - "zoomX": 100, - "zoomY": 100, - "angle": 0, - "mirror": false, - "visible": true, - "blendType": 0, - "target": 0, - "graphicFrame": 0, - "opacity": 0, - "color": [ - 0, - 0, - 0, - 0 - ], - "tone": [ - 0, - 0, - 0, - 0 - ], - "flash": [ - 0, - 0, - 0, - 0 - ], - "locked": false, - "priority": 1, - "focus": 2 - }, - { - "x": 128, - "y": -64, "zoomX": 84, "zoomY": 104, "angle": 0, "mirror": false, "visible": true, "blendType": 0, + "target": 0, + "graphicFrame": 0, + "opacity": 255, + "color": [ + 0, + 0, + 0, + 0 + ], + "tone": [ + 0, + 0, + 0, + 0 + ], + "flash": [ + 0, + 0, + 0, + 0 + ], + "locked": false, + "priority": 1, + "focus": 2 + }, + { + "x": 128, + "y": -64, + "zoomX": 100, + "zoomY": 100, + "angle": 0, + "mirror": false, + "visible": true, + "blendType": 0, "target": 1, "graphicFrame": 0, "opacity": 255, @@ -421,119 +421,15 @@ { "x": 0, "y": 0, - "zoomX": 100, - "zoomY": 100, - "angle": 0, - "mirror": false, - "visible": true, - "blendType": 0, - "target": 0, - "graphicFrame": 0, - "opacity": 0, - "color": [ - 0, - 0, - 0, - 0 - ], - "tone": [ - 0, - 0, - 0, - 0 - ], - "flash": [ - 0, - 0, - 0, - 0 - ], - "locked": false, - "priority": 1, - "focus": 2 - }, - { - "x": 128, - "y": -64, "zoomX": 68, "zoomY": 108, "angle": 0, "mirror": false, "visible": true, "blendType": 0, - "target": 1, - "graphicFrame": 0, - "opacity": 255, - "color": [ - 0, - 0, - 0, - 0 - ], - "tone": [ - 0, - 0, - 0, - 0 - ], - "flash": [ - 0, - 0, - 0, - 0 - ], - "locked": false, - "priority": 1, - "focus": 1 - }, - { - "x": 16, - "y": 38, - "zoomX": 100, - "zoomY": 100, - "angle": 0, - "mirror": false, - "visible": true, - "blendType": 0, - "target": 2, - "graphicFrame": 3, - "opacity": 255, - "color": [ - 0, - 0, - 0, - 0 - ], - "tone": [ - 0, - 0, - 0, - 0 - ], - "flash": [ - 0, - 0, - 0, - 0 - ], - "locked": false, - "priority": 1, - "focus": 2 - } - ], - [ - { - "x": 0, - "y": 0, - "zoomX": 100, - "zoomY": 100, - "angle": 0, - "mirror": false, - "visible": true, - "blendType": 0, "target": 0, "graphicFrame": 0, - "opacity": 0, + "opacity": 255, "color": [ 0, 0, @@ -559,12 +455,116 @@ { "x": 128, "y": -64, + "zoomX": 100, + "zoomY": 100, + "angle": 0, + "mirror": false, + "visible": true, + "blendType": 0, + "target": 1, + "graphicFrame": 0, + "opacity": 255, + "color": [ + 0, + 0, + 0, + 0 + ], + "tone": [ + 0, + 0, + 0, + 0 + ], + "flash": [ + 0, + 0, + 0, + 0 + ], + "locked": false, + "priority": 1, + "focus": 1 + }, + { + "x": 16, + "y": 38, + "zoomX": 100, + "zoomY": 100, + "angle": 0, + "mirror": false, + "visible": true, + "blendType": 0, + "target": 2, + "graphicFrame": 3, + "opacity": 255, + "color": [ + 0, + 0, + 0, + 0 + ], + "tone": [ + 0, + 0, + 0, + 0 + ], + "flash": [ + 0, + 0, + 0, + 0 + ], + "locked": false, + "priority": 1, + "focus": 2 + } + ], + [ + { + "x": 0, + "y": 0, "zoomX": 82, "zoomY": 104, "angle": 0, "mirror": false, "visible": true, "blendType": 0, + "target": 0, + "graphicFrame": 0, + "opacity": 255, + "color": [ + 0, + 0, + 0, + 0 + ], + "tone": [ + 0, + 0, + 0, + 0 + ], + "flash": [ + 0, + 0, + 0, + 0 + ], + "locked": false, + "priority": 1, + "focus": 2 + }, + { + "x": 128, + "y": -64, + "zoomX": 100, + "zoomY": 100, + "angle": 0, + "mirror": false, + "visible": true, + "blendType": 0, "target": 1, "graphicFrame": 0, "opacity": 255, @@ -637,7 +637,7 @@ "blendType": 0, "target": 0, "graphicFrame": 0, - "opacity": 0, + "opacity": 255, "color": [ 0, 0, @@ -775,7 +775,7 @@ "blendType": 0, "target": 0, "graphicFrame": 0, - "opacity": 0, + "opacity": 255, "color": [ 0, 0, @@ -913,7 +913,7 @@ "blendType": 0, "target": 0, "graphicFrame": 0, - "opacity": 0, + "opacity": 255, "color": [ 0, 0, @@ -1043,46 +1043,46 @@ { "x": 0, "y": 0, - "zoomX": 100, - "zoomY": 100, - "angle": 0, - "mirror": false, - "visible": true, - "blendType": 0, - "target": 0, - "graphicFrame": 0, - "opacity": 0, - "color": [ - 0, - 0, - 0, - 0 - ], - "tone": [ - 0, - 0, - 0, - 0 - ], - "flash": [ - 0, - 0, - 0, - 0 - ], - "locked": false, - "priority": 1, - "focus": 2 - }, - { - "x": 128, - "y": -64, "zoomX": 92, "zoomY": 102, "angle": 0, "mirror": false, "visible": true, "blendType": 0, + "target": 0, + "graphicFrame": 0, + "opacity": 255, + "color": [ + 0, + 0, + 0, + 0 + ], + "tone": [ + 0, + 0, + 0, + 0 + ], + "flash": [ + 0, + 0, + 0, + 0 + ], + "locked": false, + "priority": 1, + "focus": 2 + }, + { + "x": 128, + "y": -64, + "zoomX": 100, + "zoomY": 100, + "angle": 0, + "mirror": false, + "visible": true, + "blendType": 0, "target": 1, "graphicFrame": 0, "opacity": 255, @@ -1181,46 +1181,46 @@ { "x": 0, "y": 0, - "zoomX": 100, - "zoomY": 100, - "angle": 0, - "mirror": false, - "visible": true, - "blendType": 0, - "target": 0, - "graphicFrame": 0, - "opacity": 0, - "color": [ - 0, - 0, - 0, - 0 - ], - "tone": [ - 0, - 0, - 0, - 0 - ], - "flash": [ - 0, - 0, - 0, - 0 - ], - "locked": false, - "priority": 1, - "focus": 2 - }, - { - "x": 128, - "y": -64, "zoomX": 84, "zoomY": 104, "angle": 0, "mirror": false, "visible": true, "blendType": 0, + "target": 0, + "graphicFrame": 0, + "opacity": 255, + "color": [ + 0, + 0, + 0, + 0 + ], + "tone": [ + 0, + 0, + 0, + 0 + ], + "flash": [ + 0, + 0, + 0, + 0 + ], + "locked": false, + "priority": 1, + "focus": 2 + }, + { + "x": 128, + "y": -64, + "zoomX": 100, + "zoomY": 100, + "angle": 0, + "mirror": false, + "visible": true, + "blendType": 0, "target": 1, "graphicFrame": 0, "opacity": 255, @@ -1319,46 +1319,46 @@ { "x": 0, "y": 0, - "zoomX": 100, - "zoomY": 100, - "angle": 0, - "mirror": false, - "visible": true, - "blendType": 0, - "target": 0, - "graphicFrame": 0, - "opacity": 0, - "color": [ - 0, - 0, - 0, - 0 - ], - "tone": [ - 0, - 0, - 0, - 0 - ], - "flash": [ - 0, - 0, - 0, - 0 - ], - "locked": false, - "priority": 1, - "focus": 2 - }, - { - "x": 128, - "y": -64, "zoomX": 76, "zoomY": 106, "angle": 0, "mirror": false, "visible": true, "blendType": 0, + "target": 0, + "graphicFrame": 0, + "opacity": 255, + "color": [ + 0, + 0, + 0, + 0 + ], + "tone": [ + 0, + 0, + 0, + 0 + ], + "flash": [ + 0, + 0, + 0, + 0 + ], + "locked": false, + "priority": 1, + "focus": 2 + }, + { + "x": 128, + "y": -64, + "zoomX": 100, + "zoomY": 100, + "angle": 0, + "mirror": false, + "visible": true, + "blendType": 0, "target": 1, "graphicFrame": 0, "opacity": 255, @@ -1457,46 +1457,46 @@ { "x": 0, "y": 0, - "zoomX": 100, - "zoomY": 100, - "angle": 0, - "mirror": false, - "visible": true, - "blendType": 0, - "target": 0, - "graphicFrame": 0, - "opacity": 0, - "color": [ - 0, - 0, - 0, - 0 - ], - "tone": [ - 0, - 0, - 0, - 0 - ], - "flash": [ - 0, - 0, - 0, - 0 - ], - "locked": false, - "priority": 1, - "focus": 2 - }, - { - "x": 128, - "y": -64, "zoomX": 60, "zoomY": 110, "angle": 0, "mirror": false, "visible": true, "blendType": 0, + "target": 0, + "graphicFrame": 0, + "opacity": 255, + "color": [ + 0, + 0, + 0, + 0 + ], + "tone": [ + 0, + 0, + 0, + 0 + ], + "flash": [ + 0, + 0, + 0, + 0 + ], + "locked": false, + "priority": 1, + "focus": 2 + }, + { + "x": 128, + "y": -64, + "zoomX": 100, + "zoomY": 100, + "angle": 0, + "mirror": false, + "visible": true, + "blendType": 0, "target": 1, "graphicFrame": 0, "opacity": 255, @@ -1595,153 +1595,15 @@ { "x": 0, "y": 0, - "zoomX": 100, - "zoomY": 100, - "angle": 0, - "mirror": false, - "visible": true, - "blendType": 0, - "target": 0, - "graphicFrame": 0, - "opacity": 0, - "color": [ - 0, - 0, - 0, - 0 - ], - "tone": [ - 0, - 0, - 0, - 0 - ], - "flash": [ - 0, - 0, - 0, - 0 - ], - "locked": false, - "priority": 1, - "focus": 2 - }, - { - "x": 128, - "y": -64, "zoomX": 75, "zoomY": 106, "angle": 0, "mirror": false, "visible": true, "blendType": 0, - "target": 1, - "graphicFrame": 0, - "opacity": 255, - "color": [ - 0, - 0, - 0, - 0 - ], - "tone": [ - 0, - 0, - 0, - 0 - ], - "flash": [ - 0, - 0, - 0, - 0 - ], - "locked": false, - "priority": 1, - "focus": 1 - }, - { - "x": 16, - "y": 38, - "zoomX": 100, - "zoomY": 100, - "angle": 0, - "mirror": false, - "visible": true, - "blendType": 0, - "target": 2, - "graphicFrame": 3, - "opacity": 127, - "color": [ - 0, - 0, - 0, - 0 - ], - "tone": [ - 0, - 0, - 0, - 0 - ], - "flash": [ - 0, - 0, - 0, - 0 - ], - "locked": false, - "priority": 1, - "focus": 2 - }, - { - "x": 16, - "y": 18, - "zoomX": 100, - "zoomY": 100, - "angle": 0, - "mirror": false, - "visible": true, - "blendType": 0, - "target": 2, - "graphicFrame": 3, - "opacity": 127, - "color": [ - 0, - 0, - 0, - 0 - ], - "tone": [ - 0, - 0, - 0, - 0 - ], - "flash": [ - 0, - 0, - 0, - 0 - ], - "locked": false, - "priority": 1, - "focus": 2 - } - ], - [ - { - "x": 0, - "y": 0, - "zoomX": 100, - "zoomY": 100, - "angle": 0, - "mirror": false, - "visible": true, - "blendType": 0, "target": 0, "graphicFrame": 0, - "opacity": 0, + "opacity": 255, "color": [ 0, 0, @@ -1767,12 +1629,150 @@ { "x": 128, "y": -64, + "zoomX": 100, + "zoomY": 100, + "angle": 0, + "mirror": false, + "visible": true, + "blendType": 0, + "target": 1, + "graphicFrame": 0, + "opacity": 255, + "color": [ + 0, + 0, + 0, + 0 + ], + "tone": [ + 0, + 0, + 0, + 0 + ], + "flash": [ + 0, + 0, + 0, + 0 + ], + "locked": false, + "priority": 1, + "focus": 1 + }, + { + "x": 16, + "y": 38, + "zoomX": 100, + "zoomY": 100, + "angle": 0, + "mirror": false, + "visible": true, + "blendType": 0, + "target": 2, + "graphicFrame": 3, + "opacity": 127, + "color": [ + 0, + 0, + 0, + 0 + ], + "tone": [ + 0, + 0, + 0, + 0 + ], + "flash": [ + 0, + 0, + 0, + 0 + ], + "locked": false, + "priority": 1, + "focus": 2 + }, + { + "x": 16, + "y": 18, + "zoomX": 100, + "zoomY": 100, + "angle": 0, + "mirror": false, + "visible": true, + "blendType": 0, + "target": 2, + "graphicFrame": 3, + "opacity": 127, + "color": [ + 0, + 0, + 0, + 0 + ], + "tone": [ + 0, + 0, + 0, + 0 + ], + "flash": [ + 0, + 0, + 0, + 0 + ], + "locked": false, + "priority": 1, + "focus": 2 + } + ], + [ + { + "x": 0, + "y": 0, "zoomX": 85, "zoomY": 103, "angle": 0, "mirror": false, "visible": true, "blendType": 0, + "target": 0, + "graphicFrame": 0, + "opacity": 255, + "color": [ + 0, + 0, + 0, + 0 + ], + "tone": [ + 0, + 0, + 0, + 0 + ], + "flash": [ + 0, + 0, + 0, + 0 + ], + "locked": false, + "priority": 1, + "focus": 2 + }, + { + "x": 128, + "y": -64, + "zoomX": 100, + "zoomY": 100, + "angle": 0, + "mirror": false, + "visible": true, + "blendType": 0, "target": 1, "graphicFrame": 0, "opacity": 255, @@ -1879,7 +1879,7 @@ "blendType": 0, "target": 0, "graphicFrame": 0, - "opacity": 0, + "opacity": 255, "color": [ 0, 0, diff --git a/src/battle-phases.ts b/src/battle-phases.ts index 5c72abf824b..67a0febbcc9 100644 --- a/src/battle-phases.ts +++ b/src/battle-phases.ts @@ -673,7 +673,7 @@ export class CommandPhase extends FieldPhase { break; case Command.POKEMON: const trapTag = playerPokemon.findTag(t => t instanceof TrappedTag) as TrappedTag; - const arenaTrapped = !!enemyPokemon.getAbility().getAttrs(ArenaTrapAbAttr).length; + const arenaTrapped = !!enemyPokemon.getAbility().hasAttr(ArenaTrapAbAttr); const batonPass = args[0] as boolean; if (batonPass || (!trapTag && !arenaTrapped)) { this.scene.unshiftPhase(new SwitchSummonPhase(this.scene, cursor, true, args[0] as boolean)); diff --git a/src/data/ability.ts b/src/data/ability.ts index f91fb4d1380..ac8f7e2397f 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -37,6 +37,10 @@ export class Ability { return this; } + hasAttr(attrType: { new(...args: any[]): AbAttr }): boolean { + return !!this.getAttrs(attrType).length; + } + condition(condition: AbAttrCondition): Ability { this.conditions.push(condition); @@ -247,6 +251,8 @@ export class ProtectStatAttr extends PreStatChangeAbAttr { } } +export class BlockCritAbAttr extends AbAttr { } + export class ArenaTrapAbAttr extends AbAttr { } export class PreWeatherEffectAbAttr extends AbAttr { @@ -640,7 +646,8 @@ export function initAbilities() { .attr(SuppressWeatherEffectAbAttr, true), new Ability(Abilities.ARENA_TRAP, "Arena Trap", "Prevents the foe from fleeing.", 3) .attr(ArenaTrapAbAttr), - new Ability(Abilities.BATTLE_ARMOR, "Battle Armor (N)", "The POKéMON is protected against critical hits.", 3), + new Ability(Abilities.BATTLE_ARMOR, "Battle Armor", "The POKéMON is protected against critical hits.", 3) + .attr(BlockCritAbAttr), new Ability(Abilities.BLAZE, "Blaze", "Powers up FIRE-type moves in a pinch.", 3) .attr(LowHpMoveTypePowerBoostAbAttr, Type.FIRE), new Ability(Abilities.CHLOROPHYLL, "Chlorophyll (N)", "Boosts the POKéMON's SPEED in sunshine.", 3), @@ -703,7 +710,8 @@ export function initAbilities() { new Ability(Abilities.SERENE_GRACE, "Serene Grace (N)", "Boosts the likelihood of added effects appearing.", 3), new Ability(Abilities.SHADOW_TAG, "Shadow Tag (N)", "Prevents the foe from escaping.", 3), new Ability(Abilities.SHED_SKIN, "Shed Skin (N)", "The POKéMON may heal its own status problems.", 3), - new Ability(Abilities.SHELL_ARMOR, "Shell Armor (N)", "The POKéMON is protected against critical hits.", 3), + new Ability(Abilities.SHELL_ARMOR, "Shell Armor", "The POKéMON is protected against critical hits.", 3) + .attr(BlockCritAbAttr), new Ability(Abilities.SHIELD_DUST, "Shield Dust (N)", "Blocks the added effects of attacks taken.", 3), new Ability(Abilities.SOUNDPROOF, "Soundproof (N)", "Gives immunity to sound-based moves.", 3), new Ability(Abilities.SPEED_BOOST, "Speed Boost (N)", "Its SPEED stat is gradually boosted.", 3), diff --git a/src/pokemon.ts b/src/pokemon.ts index dae33b8673a..4f1549edc38 100644 --- a/src/pokemon.ts +++ b/src/pokemon.ts @@ -23,7 +23,7 @@ import { WeatherType } from './data/weather'; import { TempBattleStat } from './data/temp-battle-stat'; import { WeakenMoveTypeTag } from './data/arena-tag'; import { Biome } from './data/biome'; -import { Ability, TypeImmunityAbAttr, VariableMovePowerAbAttr, abilities, applyPreAttackAbAttrs, applyPreDefendAbAttrs } from './data/ability'; +import { Ability, BlockCritAbAttr, TypeImmunityAbAttr, VariableMovePowerAbAttr, abilities, applyPreAttackAbAttrs, applyPreDefendAbAttrs } from './data/ability'; import PokemonData from './system/pokemon-data'; export default abstract class Pokemon extends Phaser.GameObjects.Container { @@ -490,7 +490,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { case MoveCategory.PHYSICAL: case MoveCategory.SPECIAL: const isPhysical = moveCategory === MoveCategory.PHYSICAL; - const typeless = move.getAttrs(TypelessAttr).length + const typeless = !!move.getAttrs(TypelessAttr).length const cancelled = new Utils.BooleanHolder(false); const power = new Utils.NumberHolder(move.power); const typeMultiplier = new Utils.NumberHolder(!typeless @@ -520,7 +520,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { if (source.getTag(BattlerTagType.CRIT_BOOST)) critLevel.value += 2; const critChance = Math.ceil(16 / Math.pow(2, critLevel.value)); - let isCritical = !source.getTag(BattlerTagType.NO_CRIT) && (critChance === 1 || !Utils.randInt(critChance)); + let isCritical = !source.getTag(BattlerTagType.NO_CRIT) && !(this.getAbility().hasAttr(BlockCritAbAttr)) && (critChance === 1 || !Utils.randInt(critChance)); const sourceAtk = source.getBattleStat(isPhysical ? Stat.ATK : Stat.SPATK); const targetDef = this.getBattleStat(isPhysical ? Stat.DEF : Stat.SPDEF); const stabMultiplier = source.species.type1 === move.type || (source.species.type2 !== null && source.species.type2 === move.type) ? 1.5 : 1;