Add crit block abilities and fix some common anims

pull/1/head
Flashfyre 2023-05-01 22:07:00 -04:00
parent bfc26970f0
commit f6c7a2906d
5 changed files with 523 additions and 515 deletions

View File

@ -13,7 +13,7 @@
"blendType": 0, "blendType": 0,
"target": 0, "target": 0,
"graphicFrame": 0, "graphicFrame": 0,
"opacity": 0, "opacity": 255,
"color": [ "color": [
0, 0,
0, 0,
@ -21,8 +21,8 @@
0 0
], ],
"tone": [ "tone": [
0, 40,
0, 40,
0, 0,
0 0
], ],
@ -55,8 +55,8 @@
0 0
], ],
"tone": [ "tone": [
40, 0,
40, 0,
0, 0,
0 0
], ],
@ -253,7 +253,7 @@
"blendType": 0, "blendType": 0,
"target": 0, "target": 0,
"graphicFrame": 0, "graphicFrame": 0,
"opacity": 0, "opacity": 255,
"color": [ "color": [
0, 0,
0, 0,
@ -261,8 +261,8 @@
0 0
], ],
"tone": [ "tone": [
0, 75,
0, 75,
0, 0,
0 0
], ],
@ -295,8 +295,8 @@
0 0
], ],
"tone": [ "tone": [
75, 0,
75, 0,
0, 0,
0 0
], ],
@ -527,7 +527,7 @@
"blendType": 0, "blendType": 0,
"target": 0, "target": 0,
"graphicFrame": 0, "graphicFrame": 0,
"opacity": 0, "opacity": 255,
"color": [ "color": [
0, 0,
0, 0,
@ -535,8 +535,8 @@
0 0
], ],
"tone": [ "tone": [
0, 125,
0, 125,
0, 0,
0 0
], ],
@ -569,8 +569,8 @@
0 0
], ],
"tone": [ "tone": [
125, 0,
125, 0,
0, 0,
0 0
], ],
@ -801,7 +801,7 @@
"blendType": 0, "blendType": 0,
"target": 0, "target": 0,
"graphicFrame": 0, "graphicFrame": 0,
"opacity": 0, "opacity": 255,
"color": [ "color": [
0, 0,
0, 0,
@ -809,8 +809,8 @@
0 0
], ],
"tone": [ "tone": [
0, 255,
0, 255,
0, 0,
0 0
], ],
@ -843,8 +843,8 @@
0 0
], ],
"tone": [ "tone": [
255, 0,
255, 0,
0, 0,
0 0
], ],
@ -1075,7 +1075,7 @@
"blendType": 0, "blendType": 0,
"target": 0, "target": 0,
"graphicFrame": 0, "graphicFrame": 0,
"opacity": 0, "opacity": 255,
"color": [ "color": [
0, 0,
0, 0,
@ -1083,8 +1083,8 @@
0 0
], ],
"tone": [ "tone": [
0, 255,
0, 255,
0, 0,
0 0
], ],
@ -1117,8 +1117,8 @@
0 0
], ],
"tone": [ "tone": [
255, 0,
255, 0,
0, 0,
0 0
], ],
@ -1349,7 +1349,7 @@
"blendType": 0, "blendType": 0,
"target": 0, "target": 0,
"graphicFrame": 0, "graphicFrame": 0,
"opacity": 0, "opacity": 255,
"color": [ "color": [
0, 0,
0, 0,
@ -1357,8 +1357,8 @@
0 0
], ],
"tone": [ "tone": [
0, 255,
0, 255,
0, 0,
0 0
], ],
@ -1391,8 +1391,8 @@
0 0
], ],
"tone": [ "tone": [
255, 0,
255, 0,
0, 0,
0 0
], ],
@ -1623,7 +1623,7 @@
"blendType": 0, "blendType": 0,
"target": 0, "target": 0,
"graphicFrame": 0, "graphicFrame": 0,
"opacity": 0, "opacity": 255,
"color": [ "color": [
0, 0,
0, 0,
@ -1631,8 +1631,8 @@
0 0
], ],
"tone": [ "tone": [
0, 255,
0, 255,
0, 0,
0 0
], ],
@ -1665,8 +1665,8 @@
0 0
], ],
"tone": [ "tone": [
255, 0,
255, 0,
0, 0,
0 0
], ],
@ -1897,7 +1897,7 @@
"blendType": 0, "blendType": 0,
"target": 0, "target": 0,
"graphicFrame": 0, "graphicFrame": 0,
"opacity": 0, "opacity": 255,
"color": [ "color": [
0, 0,
0, 0,
@ -1905,8 +1905,8 @@
0 0
], ],
"tone": [ "tone": [
0, 255,
0, 255,
0, 0,
0 0
], ],
@ -1939,8 +1939,8 @@
0 0
], ],
"tone": [ "tone": [
255, 0,
255, 0,
0, 0,
0 0
], ],
@ -2171,7 +2171,7 @@
"blendType": 0, "blendType": 0,
"target": 0, "target": 0,
"graphicFrame": 0, "graphicFrame": 0,
"opacity": 0, "opacity": 255,
"color": [ "color": [
0, 0,
0, 0,
@ -2179,8 +2179,8 @@
0 0
], ],
"tone": [ "tone": [
0, 125,
0, 125,
0, 0,
0 0
], ],
@ -2213,8 +2213,8 @@
0 0
], ],
"tone": [ "tone": [
125, 0,
125, 0,
0, 0,
0 0
], ],
@ -2445,7 +2445,7 @@
"blendType": 0, "blendType": 0,
"target": 0, "target": 0,
"graphicFrame": 0, "graphicFrame": 0,
"opacity": 0, "opacity": 255,
"color": [ "color": [
0, 0,
0, 0,
@ -2453,8 +2453,8 @@
0 0
], ],
"tone": [ "tone": [
0, 75,
0, 75,
0, 0,
0 0
], ],
@ -2487,8 +2487,8 @@
0 0
], ],
"tone": [ "tone": [
75, 0,
75, 0,
0, 0,
0 0
], ],
@ -2685,7 +2685,7 @@
"blendType": 0, "blendType": 0,
"target": 0, "target": 0,
"graphicFrame": 0, "graphicFrame": 0,
"opacity": 0, "opacity": 255,
"color": [ "color": [
0, 0,
0, 0,
@ -2693,8 +2693,8 @@
0 0
], ],
"tone": [ "tone": [
0, 40,
0, 40,
0, 0,
0 0
], ],
@ -2727,8 +2727,8 @@
0 0
], ],
"tone": [ "tone": [
40, 0,
40, 0,
0, 0,
0 0
], ],

File diff suppressed because it is too large Load Diff

View File

@ -673,7 +673,7 @@ export class CommandPhase extends FieldPhase {
break; break;
case Command.POKEMON: case Command.POKEMON:
const trapTag = playerPokemon.findTag(t => t instanceof TrappedTag) as TrappedTag; 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; const batonPass = args[0] as boolean;
if (batonPass || (!trapTag && !arenaTrapped)) { if (batonPass || (!trapTag && !arenaTrapped)) {
this.scene.unshiftPhase(new SwitchSummonPhase(this.scene, cursor, true, args[0] as boolean)); this.scene.unshiftPhase(new SwitchSummonPhase(this.scene, cursor, true, args[0] as boolean));

View File

@ -37,6 +37,10 @@ export class Ability {
return this; return this;
} }
hasAttr(attrType: { new(...args: any[]): AbAttr }): boolean {
return !!this.getAttrs(attrType).length;
}
condition(condition: AbAttrCondition): Ability { condition(condition: AbAttrCondition): Ability {
this.conditions.push(condition); 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 ArenaTrapAbAttr extends AbAttr { }
export class PreWeatherEffectAbAttr extends AbAttr { export class PreWeatherEffectAbAttr extends AbAttr {
@ -640,7 +646,8 @@ export function initAbilities() {
.attr(SuppressWeatherEffectAbAttr, true), .attr(SuppressWeatherEffectAbAttr, true),
new Ability(Abilities.ARENA_TRAP, "Arena Trap", "Prevents the foe from fleeing.", 3) new Ability(Abilities.ARENA_TRAP, "Arena Trap", "Prevents the foe from fleeing.", 3)
.attr(ArenaTrapAbAttr), .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) new Ability(Abilities.BLAZE, "Blaze", "Powers up FIRE-type moves in a pinch.", 3)
.attr(LowHpMoveTypePowerBoostAbAttr, Type.FIRE), .attr(LowHpMoveTypePowerBoostAbAttr, Type.FIRE),
new Ability(Abilities.CHLOROPHYLL, "Chlorophyll (N)", "Boosts the POKéMON's SPEED in sunshine.", 3), 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.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.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.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.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.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), new Ability(Abilities.SPEED_BOOST, "Speed Boost (N)", "Its SPEED stat is gradually boosted.", 3),

View File

@ -23,7 +23,7 @@ import { WeatherType } from './data/weather';
import { TempBattleStat } from './data/temp-battle-stat'; import { TempBattleStat } from './data/temp-battle-stat';
import { WeakenMoveTypeTag } from './data/arena-tag'; import { WeakenMoveTypeTag } from './data/arena-tag';
import { Biome } from './data/biome'; 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'; import PokemonData from './system/pokemon-data';
export default abstract class Pokemon extends Phaser.GameObjects.Container { 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.PHYSICAL:
case MoveCategory.SPECIAL: case MoveCategory.SPECIAL:
const isPhysical = moveCategory === MoveCategory.PHYSICAL; const isPhysical = moveCategory === MoveCategory.PHYSICAL;
const typeless = move.getAttrs(TypelessAttr).length const typeless = !!move.getAttrs(TypelessAttr).length
const cancelled = new Utils.BooleanHolder(false); const cancelled = new Utils.BooleanHolder(false);
const power = new Utils.NumberHolder(move.power); const power = new Utils.NumberHolder(move.power);
const typeMultiplier = new Utils.NumberHolder(!typeless 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)) if (source.getTag(BattlerTagType.CRIT_BOOST))
critLevel.value += 2; critLevel.value += 2;
const critChance = Math.ceil(16 / Math.pow(2, critLevel.value)); 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 sourceAtk = source.getBattleStat(isPhysical ? Stat.ATK : Stat.SPATK);
const targetDef = this.getBattleStat(isPhysical ? Stat.DEF : Stat.SPDEF); 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; const stabMultiplier = source.species.type1 === move.type || (source.species.type2 !== null && source.species.type2 === move.type) ? 1.5 : 1;