Fix incorrect effectiveness evaluation after Odor sleuth
parent
17c6c309e1
commit
4b4d3c6c8a
|
@ -1100,11 +1100,14 @@ export class MagnetRisenTag extends TypeImmuneTag {
|
|||
}
|
||||
}
|
||||
|
||||
export class IdentifyTag extends BattlerTag {
|
||||
public type: Type;
|
||||
constructor(tagType: BattlerTagType, sourceMove: Moves, type: Type, length: number) {
|
||||
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);
|
||||
this.type = type;
|
||||
this.immuneType = type;
|
||||
this.allowedTypes = allowedTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1113,7 +1116,8 @@ export class IdentifyTag extends BattlerTag {
|
|||
*/
|
||||
loadTag(source: BattlerTag | any): void {
|
||||
super.loadTag(source);
|
||||
this.type = source.type as Type;
|
||||
this.immuneType = source.type as Type;
|
||||
this.allowedTypes = source.allowedTypes as Type[];
|
||||
}
|
||||
lapse(pokemon: Pokemon, lapseType: BattlerTagLapseType): boolean {
|
||||
return true;
|
||||
|
@ -1379,7 +1383,7 @@ export function getBattlerTag(tagType: BattlerTagType, turnCount: integer, sourc
|
|||
case BattlerTagType.MAGNET_RISEN:
|
||||
return new MagnetRisenTag(tagType, sourceMove);
|
||||
case BattlerTagType.ODOR_SLEUTH:
|
||||
return new IdentifyTag(tagType, sourceMove, Type.GHOST, turnCount);
|
||||
return new ExposedTag(tagType, sourceMove, Type.GHOST, [ Type.NORMAL, Type.FIGHTING ], turnCount);
|
||||
case BattlerTagType.NONE:
|
||||
default:
|
||||
return new BattlerTag(tagType, BattlerTagLapseType.CUSTOM, turnCount, sourceMove, sourceId);
|
||||
|
|
|
@ -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 } from "./battler-tags";
|
||||
import { 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";
|
||||
|
@ -1775,7 +1775,7 @@ export class ResetStatsAttr extends MoveEffectAttr {
|
|||
}
|
||||
}
|
||||
|
||||
export class IdentifyAttr extends MoveEffectAttr {
|
||||
export class ExposedAttr extends MoveEffectAttr {
|
||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||
if (!super.apply(user, target, move, args))
|
||||
return false;
|
||||
|
@ -5021,9 +5021,8 @@ 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(IdentifyAttr)
|
||||
.attr(AddBattlerTagAttr, BattlerTagType.ODOR_SLEUTH, false, false, 20)
|
||||
.partial(),
|
||||
.attr(ExposedAttr)
|
||||
.attr(AddBattlerTagAttr, BattlerTagType.ODOR_SLEUTH, false, false, 20),
|
||||
new AttackMove(Moves.ROCK_TOMB, Type.ROCK, MoveCategory.PHYSICAL, 60, 95, 15, 100, 0, 3)
|
||||
.attr(StatChangeAttr, BattleStat.SPD, -1)
|
||||
.makesContact(false),
|
||||
|
|
|
@ -4,7 +4,7 @@ import { Variant, VariantSet, variantColorCache } from '#app/data/variant';
|
|||
import { variantData } from '#app/data/variant';
|
||||
import BattleInfo, { PlayerBattleInfo, EnemyBattleInfo } from '../ui/battle-info';
|
||||
import { Moves } from "../data/enums/moves";
|
||||
import Move, { HighCritAttr, HitsTagAttr, applyMoveAttrs, FixedDamageAttr, VariableAtkAttr, VariablePowerAttr, allMoves, MoveCategory, TypelessAttr, CritOnlyAttr, getMoveTargets, OneHitKOAttr, MultiHitAttr, StatusMoveTypeImmunityAttr, MoveTarget, VariableDefAttr, AttackMove, ModifiedDamageAttr, VariableMoveTypeMultiplierAttr, IgnoreOpponentStatChangesAttr, SacrificialAttr, VariableMoveTypeAttr, VariableMoveCategoryAttr, CounterDamageAttr, StatChangeAttr, RechargeAttr, ChargeAttr, IgnoreWeatherTypeDebuffAttr, IdentifyAttr } from "../data/move";
|
||||
import Move, { HighCritAttr, HitsTagAttr, applyMoveAttrs, FixedDamageAttr, VariableAtkAttr, VariablePowerAttr, allMoves, MoveCategory, TypelessAttr, CritOnlyAttr, getMoveTargets, OneHitKOAttr, MultiHitAttr, StatusMoveTypeImmunityAttr, MoveTarget, VariableDefAttr, AttackMove, ModifiedDamageAttr, VariableMoveTypeMultiplierAttr, IgnoreOpponentStatChangesAttr, SacrificialAttr, VariableMoveTypeAttr, VariableMoveCategoryAttr, CounterDamageAttr, StatChangeAttr, RechargeAttr, ChargeAttr, IgnoreWeatherTypeDebuffAttr, ExposedAttr } from "../data/move";
|
||||
import { default as PokemonSpecies, PokemonSpeciesForm, SpeciesFormKey, getFusedSpeciesName, getPokemonSpecies, getPokemonSpeciesForm, getStarterValueFriendshipCap, speciesStarters, starterPassiveAbilities } from '../data/pokemon-species';
|
||||
import * as Utils from '../utils';
|
||||
import { Type, TypeDamageMultiplier, getTypeDamageMultiplier, getTypeRgb } from '../data/type';
|
||||
|
@ -19,7 +19,7 @@ import { pokemonEvolutions, pokemonPrevolutions, SpeciesFormEvolution, SpeciesEv
|
|||
import { reverseCompatibleTms, tmSpecies, tmPoolTiers } from '../data/tms';
|
||||
import { DamagePhase, FaintPhase, LearnMovePhase, ObtainStatusEffectPhase, StatChangePhase, SwitchSummonPhase } from '../phases';
|
||||
import { BattleStat } from '../data/battle-stat';
|
||||
import { BattlerTag, BattlerTagLapseType, EncoreTag, HelpingHandTag, HighestStatBoostTag, IdentifyTag, TypeBoostTag, getBattlerTag } from '../data/battler-tags';
|
||||
import { BattlerTag, BattlerTagLapseType, EncoreTag, HelpingHandTag, HighestStatBoostTag, ExposedTag, TypeBoostTag, getBattlerTag } from '../data/battler-tags';
|
||||
import { BattlerTagType } from "../data/enums/battler-tag-type";
|
||||
import { Species } from '../data/enums/species';
|
||||
import { WeatherType } from '../data/weather';
|
||||
|
@ -779,17 +779,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
types.splice(flyingIndex, 1);
|
||||
}
|
||||
|
||||
const identifyTags = this.findTags(t => t instanceof IdentifyTag);
|
||||
console.log(identifyTags);
|
||||
if (forDefend && identifyTags.length) {
|
||||
identifyTags.forEach(tag => {
|
||||
const type = (tag as IdentifyTag).type;
|
||||
const typeIndex = types.indexOf(type);
|
||||
if (typeIndex > -1)
|
||||
types.splice(typeIndex, 1);
|
||||
});
|
||||
}
|
||||
|
||||
if (!types.length) // become UNKNOWN if no types are present
|
||||
types.push(Type.UNKNOWN);
|
||||
|
||||
|
@ -800,7 +789,6 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||
}
|
||||
}
|
||||
|
||||
console.log(types);
|
||||
return types;
|
||||
}
|
||||
|
||||
|
@ -1457,6 +1445,13 @@ 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