Code cleanup
parent
b86a20c7b2
commit
86877dc313
|
@ -1104,8 +1104,8 @@ export class ExposedTag extends BattlerTag {
|
|||
public immuneType: Type;
|
||||
public allowedTypes: Type[];
|
||||
|
||||
constructor(tagType: BattlerTagType, sourceMove: Moves, type: Type, allowedTypes: Type[], length: number) {
|
||||
super(tagType, BattlerTagLapseType.TURN_END, length, sourceMove);
|
||||
constructor(tagType: BattlerTagType, sourceMove: Moves, type: Type, allowedTypes: Type[]) {
|
||||
super(tagType, BattlerTagLapseType.TURN_END, 1, sourceMove);
|
||||
this.immuneType = type;
|
||||
this.allowedTypes = allowedTypes;
|
||||
}
|
||||
|
@ -1119,8 +1119,14 @@ export class ExposedTag extends BattlerTag {
|
|||
this.immuneType = source.type as Type;
|
||||
this.allowedTypes = source.allowedTypes as Type[];
|
||||
}
|
||||
|
||||
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
||||
return true;
|
||||
return lapseType !== BattlerTagLapseType.CUSTOM || super.lapse(pokemon, lapseType);
|
||||
}
|
||||
|
||||
ignoreImmunity(pokemon: Pokemon, moveType: Type): boolean {
|
||||
return pokemon.getTypes(true, true).includes(this.immuneType)
|
||||
&& this.allowedTypes.includes(moveType);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1383,9 +1389,9 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc
|
|||
case BattlerTagType.MAGNET_RISEN:
|
||||
return new MagnetRisenTag(tagType, sourceMove);
|
||||
case BattlerTagType.ODOR_SLEUTH:
|
||||
return new ExposedTag(tagType, sourceMove, Type.GHOST, [ Type.NORMAL, Type.FIGHTING ], turnCount);
|
||||
return new ExposedTag(tagType, sourceMove, Type.GHOST, [ Type.NORMAL, Type.FIGHTING ]);
|
||||
case BattlerTagType.MIRACLE_EYE:
|
||||
return new ExposedTag(tagType, sourceMove, Type.DARK, [ Type.PSYCHIC ], turnCount);
|
||||
return new ExposedTag(tagType, sourceMove, Type.DARK, [ Type.PSYCHIC ]);
|
||||
case BattlerTagType.NONE:
|
||||
default:
|
||||
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);
|
||||
|
|
|
@ -56,5 +56,6 @@ export enum BattlerTagType {
|
|||
CHARGED = "CHARGED",
|
||||
GROUNDED = "GROUNDED",
|
||||
MAGNET_RISEN = "MAGNET_RISEN",
|
||||
ODOR_SLEUTH = "ODOR_SLEUTH"
|
||||
ODOR_SLEUTH = "ODOR_SLEUTH",
|
||||
MIRACLE_EYE = "MIRACLE_EYE"
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import { Moves } from "./enums/moves";
|
|||
import { ChargeAnim, MoveChargeAnim, initMoveAnim, loadMoveAnimAssets } from "./battle-anims";
|
||||
import { BattleEndPhase, MovePhase, NewBattlePhase, PartyStatusCurePhase, PokemonHealPhase, StatChangePhase, SwitchSummonPhase } from "../phases";
|
||||
import { BattleStat, getBattleStatName } from "./battle-stat";
|
||||
import { EncoreTag, ExposedTag } from "./battler-tags";
|
||||
import { BattlerTag, EncoreTag, ExposedTag } from "./battler-tags";
|
||||
import { BattlerTagType } from "./enums/battler-tag-type";
|
||||
import { getPokemonMessage } from "../messages";
|
||||
import Pokemon, { AttackMoveResult, EnemyPokemon, HitResult, MoveResult, PlayerPokemon, PokemonMove, TurnMove } from "../field/pokemon";
|
||||
|
@ -1776,12 +1776,21 @@ export class ResetStatsAttr extends MoveEffectAttr {
|
|||
}
|
||||
|
||||
export class ExposedAttr extends MoveEffectAttr {
|
||||
private tagType: BattlerTagType;
|
||||
|
||||
constructor(tagType: BattlerTagType) {
|
||||
super();
|
||||
|
||||
this.tagType = tagType;
|
||||
}
|
||||
|
||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||
if (!super.apply(user, target, move, args))
|
||||
return false;
|
||||
|
||||
target.summonData.battleStats[BattleStat.EVA] = 0;
|
||||
target.updateInfo();
|
||||
target.addTag(this.tagType, 20, move.id, user.id);
|
||||
|
||||
target.scene.queueMessage(`${getPokemonMessage(user, " identified\n")}${getPokemonMessage(target, "!")}`);
|
||||
|
||||
|
@ -4671,8 +4680,7 @@ export function initMoves() {
|
|||
.attr(StatusEffectAttr, StatusEffect.PARALYSIS)
|
||||
.ballBombMove(),
|
||||
new StatusMove(Moves.FORESIGHT, Type.NORMAL, -1, 40, -1, 0, 2)
|
||||
.attr(ExposedAttr)
|
||||
.attr(AddBattlerTagAttr, BattlerTagType.ODOR_SLEUTH, false, false, 20),
|
||||
.attr(ExposedAttr, BattlerTagType.ODOR_SLEUTH),
|
||||
new SelfStatusMove(Moves.DESTINY_BOND, Type.GHOST, -1, 5, -1, 0, 2)
|
||||
.ignoresProtect()
|
||||
.condition(failOnBossCondition)
|
||||
|
@ -5022,8 +5030,7 @@ export function initMoves() {
|
|||
.attr(StatChangeAttr, BattleStat.SPATK, -2, true)
|
||||
.attr(HealStatusEffectAttr, true, StatusEffect.FREEZE),
|
||||
new StatusMove(Moves.ODOR_SLEUTH, Type.NORMAL, -1, 40, -1, 0, 3)
|
||||
.attr(ExposedAttr)
|
||||
.attr(AddBattlerTagAttr, BattlerTagType.ODOR_SLEUTH, false, false, 20),
|
||||
.attr(ExposedAttr, BattlerTagType.ODOR_SLEUTH),
|
||||
new AttackMove(Moves.ROCK_TOMB, Type.ROCK, MoveCategory.PHYSICAL, 60, 95, 15, 100, 0, 3)
|
||||
.attr(StatChangeAttr, BattleStat.SPD, -1)
|
||||
.makesContact(false),
|
||||
|
@ -5131,8 +5138,7 @@ export function initMoves() {
|
|||
.attr(AddArenaTagAttr, ArenaTagType.GRAVITY, 5)
|
||||
.target(MoveTarget.BOTH_SIDES),
|
||||
new StatusMove(Moves.MIRACLE_EYE, Type.PSYCHIC, -1, 40, -1, 0, 4)
|
||||
.attr(ExposedAttr)
|
||||
.attr(AddBattlerTagAttr, BattlerTagType.MIRACLE_EYE, false, false, 20),
|
||||
.attr(ExposedAttr, BattlerTagType.MIRACLE_EYE),
|
||||
new AttackMove(Moves.WAKE_UP_SLAP, Type.FIGHTING, MoveCategory.PHYSICAL, 70, 100, 10, -1, 0, 4)
|
||||
.attr(MovePowerMultiplierAttr, (user, target, move) => target.status?.effect === StatusEffect.SLEEP ? 2 : 1)
|
||||
.attr(HealStatusEffectAttr, false, StatusEffect.SLEEP),
|
||||
|
|
|
@ -965,6 +965,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
applyAbAttrs(IgnoreTypeImmunityAbAttr, source, ignoreImmunity, moveType, defType);
|
||||
if (ignoreImmunity.value)
|
||||
return 1;
|
||||
|
||||
const exposedTags = this.getTags(ExposedTag) as ExposedTag[];
|
||||
if (exposedTags.some(t => t.ignoreImmunity(this, moveType))) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return getTypeDamageMultiplier(moveType, defType);
|
||||
|
@ -1445,13 +1450,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
if (types.find(t => move.isTypeImmune(t)))
|
||||
typeMultiplier.value = 0;
|
||||
|
||||
if ((this.getTags(ExposedTag) as ExposedTag[]).some(t => {
|
||||
return t.allowedTypes.includes(move.type)
|
||||
&& this.getTypes(true, true).includes(t.immuneType);
|
||||
})) {
|
||||
typeMultiplier.value = 1;
|
||||
}
|
||||
|
||||
switch (moveCategory) {
|
||||
case MoveCategory.PHYSICAL:
|
||||
case MoveCategory.SPECIAL:
|
||||
|
|
Loading…
Reference in New Issue