implements modifier, works correctly. does not spawn item or have correct icon

This commit is contained in:
shayebeadlingkl 2024-05-10 15:54:32 -04:00
parent acb61d6fb7
commit b46377fab4
3 changed files with 39 additions and 2 deletions

View File

@ -15,7 +15,7 @@ import { ArenaTagType } from "./enums/arena-tag-type";
import { UnswappableAbilityAbAttr, UncopiableAbilityAbAttr, UnsuppressableAbilityAbAttr, NoTransformAbilityAbAttr, BlockRecoilDamageAttr, BlockOneHitKOAbAttr, IgnoreContactAbAttr, MaxMultiHitAbAttr, applyAbAttrs, BlockNonDirectDamageAbAttr, applyPreSwitchOutAbAttrs, PreSwitchOutAbAttr, applyPostDefendAbAttrs, PostDefendContactApplyStatusEffectAbAttr, MoveAbilityBypassAbAttr, ReverseDrainAbAttr, FieldPreventExplosiveMovesAbAttr, ForceSwitchOutImmunityAbAttr } from "./ability";
import { Abilities } from "./enums/abilities";
import { allAbilities } from './ability';
import { PokemonHeldItemModifier } from "../modifier/modifier";
import { ExtendScreenModifier, PokemonHeldItemModifier } from "../modifier/modifier";
import { BattlerIndex } from "../battle";
import { Stat } from "./pokemon-stat";
import { TerrainType } from "./terrain";
@ -3035,8 +3035,13 @@ export class AddArenaTagAttr extends MoveEffectAttr {
if (!super.apply(user, target, move, args))
return false;
const turnCountHolder = new Utils.IntegerHolder(this.turnCount);
if ([ArenaTagType.REFLECT, ArenaTagType.LIGHT_SCREEN, ArenaTagType.AURORA_VEIL].includes(this.tagType))
user.scene.applyModifiers(ExtendScreenModifier, user.isPlayer(), user, turnCountHolder);
if (move.chance < 0 || move.chance === 100 || user.randSeedInt(100) < move.chance) {
user.scene.arena.addTag(this.tagType, this.turnCount, move.id, user.id, (this.selfSideTarget ? user : target).isPlayer() ? ArenaTagSide.PLAYER : ArenaTagSide.ENEMY);
user.scene.arena.addTag(this.tagType, turnCountHolder.value, move.id, user.id, (this.selfSideTarget ? user : target).isPlayer() ? ArenaTagSide.PLAYER : ArenaTagSide.ENEMY);
return true;
}

View File

@ -918,6 +918,9 @@ export const modifierTypes = {
HEALING_CHARM: () => new ModifierType('Healing Charm', 'Increases the effectiveness of HP restoring moves and items by 10% (excludes Revives)',
(type, _args) => new Modifiers.HealingBoosterModifier(type, 1.1), 'healing_charm'),
CANDY_JAR: () => new ModifierType('Candy Jar', 'Increases the number of levels added by Rare Candy items by 1', (type, _args) => new Modifiers.LevelIncrementBoosterModifier(type)),
LIGHT_CLAY: () => new ModifierType('Light Clay', 'Aurora Veil, Light Screen, or Reflect lasts 8 turns instead of 5.',
(type, _args) => new Modifiers.ExtendScreenModifier(type), 'coin_case'),
BERRY_POUCH: () => new ModifierType('Berry Pouch', 'Adds a 25% chance that a used berry will not be consumed',
(type, _args) => new Modifiers.PreserveBerryModifier(type)),

View File

@ -918,6 +918,35 @@ export class PreserveBerryModifier extends PersistentModifier {
}
}
export class ExtendScreenModifier extends PersistentModifier {
constructor(type: ModifierType, stackCount?: integer) {
super(type, stackCount);
}
match(modifier: Modifier) {
return modifier instanceof ExtendScreenModifier;
}
clone() {
return new ExtendScreenModifier(this.type, this.stackCount);
}
shouldApply(args: any[]): boolean {
return super.shouldApply(args) && args[0] instanceof Pokemon && args[1] instanceof Utils.IntegerHolder;
}
apply(args: any[]): boolean {
if ((args[1] as Utils.IntegerHolder).value)
(args[1] as Utils.IntegerHolder).value = (args[1] as Utils.IntegerHolder).value + 3;
return true;
}
getMaxStackCount(scene: BattleScene): integer {
return 1;
}
}
export class PokemonInstantReviveModifier extends PokemonHeldItemModifier {
constructor(type: ModifierType, pokemonId: integer, stackCount?: integer) {
super(type, pokemonId, stackCount);