Implement Sticky Web

pull/49/head
JackSmith5202 2024-04-06 18:55:02 -04:00 committed by Samuel H
parent f762cf1eb3
commit b7913e2a82
3 changed files with 37 additions and 4 deletions

View File

@ -1,15 +1,16 @@
import { Arena } from "../field/arena";
import { Type } from "./type";
import * as Utils from "../utils";
import { MoveCategory, allMoves } from "./move";
import { MoveCategory, StatChangeAttr, allMoves } from "./move";
import { getPokemonMessage } from "../messages";
import Pokemon, { HitResult, PokemonMove } from "../field/pokemon";
import { MoveEffectPhase } from "../phases";
import { MoveEffectPhase, StatChangePhase } from "../phases";
import { StatusEffect } from "./status-effect";
import { BattlerIndex } from "../battle";
import { Moves } from "./enums/moves";
import { ArenaTagType } from "./enums/arena-tag-type";
import { BlockNonDirectDamageAbAttr, applyAbAttrs } from "./ability";
import { BlockNonDirectDamageAbAttr, ProtectStatAbAttr, applyAbAttrs } from "./ability";
import { BattleStat } from "./battle-stat";
export enum ArenaTagSide {
BOTH,
@ -392,6 +393,34 @@ class StealthRockTag extends ArenaTrapTag {
}
}
class StickyWebTag extends ArenaTrapTag {
constructor(sourceId: integer, side: ArenaTagSide) {
super(ArenaTagType.STICKY_WEB, Moves.STICKY_WEB, sourceId, side, 1);
}
onAdd(arena: Arena): void {
super.onAdd(arena);
const source = arena.scene.getPokemonById(this.sourceId);
arena.scene.queueMessage(`A ${this.getMoveName()} has been laid out on the ground around the opposing team!`);
}
activateTrap(pokemon: Pokemon): boolean {
if (pokemon.isGrounded()) {
const cancelled = new Utils.BooleanHolder(false);
applyAbAttrs(ProtectStatAbAttr, pokemon, cancelled);
if (!cancelled.value) {
pokemon.scene.queueMessage(`The opposing ${pokemon.name} was caught in a sticky web!`);
const statLevels = new Utils.NumberHolder(-1);
pokemon.scene.unshiftPhase(new StatChangePhase(pokemon.scene, pokemon.getBattlerIndex(), false, [BattleStat.SPD], statLevels.value));
}
}
return false;
}
}
export class TrickRoomTag extends ArenaTag {
constructor(turnCount: integer, sourceId: integer) {
super(ArenaTagType.TRICK_ROOM, turnCount, Moves.TRICK_ROOM, sourceId);
@ -443,6 +472,8 @@ export function getArenaTag(tagType: ArenaTagType, turnCount: integer, sourceMov
return new DelayedAttackTag(tagType, sourceMove, sourceId, targetIndex);
case ArenaTagType.STEALTH_ROCK:
return new StealthRockTag(sourceId, side);
case ArenaTagType.STICKY_WEB:
return new StickyWebTag(sourceId, side);
case ArenaTagType.TRICK_ROOM:
return new TrickRoomTag(turnCount, sourceId);
case ArenaTagType.GRAVITY:

View File

@ -9,6 +9,7 @@ export enum ArenaTagType {
FUTURE_SIGHT = "FUTURE_SIGHT",
DOOM_DESIRE = "DOOM_DESIRE",
STEALTH_ROCK = "STEALTH_ROCK",
STICKY_WEB = "STICKY_WEB",
TRICK_ROOM = "TRICK_ROOM",
GRAVITY = "GRAVITY",
REFLECT = "REFLECT",

View File

@ -4176,7 +4176,8 @@ export function initMoves() {
new AttackMove(Moves.BELCH, "Belch (P)", Type.POISON, MoveCategory.SPECIAL, 120, 90, 10, "The user lets out a damaging belch at the target. The user must eat a held Berry to use this move.", -1, 0, 6),
new StatusMove(Moves.ROTOTILLER, "Rototiller (N)", Type.GROUND, -1, 10, "Tilling the soil, the user makes it easier for plants to grow. This raises the Attack and Sp. Atk stats of Grass-type Pokémon.", 100, 0, 6)
.target(MoveTarget.ALL),
new StatusMove(Moves.STICKY_WEB, "Sticky Web (N)", Type.BUG, -1, 20, "The user weaves a sticky net around the opposing team, which lowers their Speed stats upon switching into battle.", -1, 0, 6)
new StatusMove(Moves.STICKY_WEB, "Sticky Web", Type.BUG, -1, 20, "The user weaves a sticky net around the opposing team, which lowers their Speed stats upon switching into battle.", -1, 0, 6)
.attr(AddArenaTrapTagAttr, ArenaTagType.STICKY_WEB)
.target(MoveTarget.ENEMY_SIDE),
new AttackMove(Moves.FELL_STINGER, "Fell Stinger (P)", Type.BUG, MoveCategory.PHYSICAL, 50, 100, 25, "When the user knocks out a target with this move, the user's Attack stat rises drastically.", -1, 0, 6),
new AttackMove(Moves.PHANTOM_FORCE, "Phantom Force", Type.GHOST, MoveCategory.PHYSICAL, 90, 100, 10, "The user vanishes somewhere, then strikes the target on the next turn. This move hits even if the target protects itself.", -1, 0, 6)