fix: all pokemon types can use toxic

This commit is contained in:
raksus 2024-05-16 16:02:53 +02:00
parent 434025ef17
commit 799a63e9d1
2 changed files with 15 additions and 10 deletions

View File

@ -241,6 +241,18 @@ export default class Move implements Localizable {
return this; return this;
} }
ignoresHiddenTag(user: Pokemon) {
switch (this.id) {
case Moves.TOXIC:
if(user.isOfType(Type.POISON)){
return true;
}
default:
return false;
}
}
soundBased(soundBased?: boolean): this { soundBased(soundBased?: boolean): this {
this.setFlag(MoveFlags.SOUND_BASED, soundBased); this.setFlag(MoveFlags.SOUND_BASED, soundBased);
return this; return this;
@ -4207,8 +4219,6 @@ export class VariableTargetAttr extends MoveAttr {
const failOnGravityCondition: MoveConditionFunc = (user, target, move) => !user.scene.arena.getTag(ArenaTagType.GRAVITY); const failOnGravityCondition: MoveConditionFunc = (user, target, move) => !user.scene.arena.getTag(ArenaTagType.GRAVITY);
const poisonTypeCondition: MoveConditionFunc = (user, target, move) => user.isOfType(Type.POISON);
const failOnBossCondition: MoveConditionFunc = (user, target, move) => !target.isBossImmune(); const failOnBossCondition: MoveConditionFunc = (user, target, move) => !target.isBossImmune();
const failOnMaxCondition: MoveConditionFunc = (user, target, move) => !target.isMax(); const failOnMaxCondition: MoveConditionFunc = (user, target, move) => !target.isMax();
@ -4592,12 +4602,7 @@ export function initMoves() {
.ignoresVirtual(), .ignoresVirtual(),
new StatusMove(Moves.TOXIC, Type.POISON, 90, 10, -1, 0, 1) new StatusMove(Moves.TOXIC, Type.POISON, 90, 10, -1, 0, 1)
.attr(StatusEffectAttr, StatusEffect.TOXIC) .attr(StatusEffectAttr, StatusEffect.TOXIC)
.attr(ToxicAccuracyAttr) .attr(ToxicAccuracyAttr),
.condition(poisonTypeCondition)
.attr(HitsTagAttr, BattlerTagType.UNDERGROUND, true)
.attr(HitsTagAttr, BattlerTagType.FLYING, true)
.attr(HitsTagAttr, BattlerTagType.UNDERWATER, true)
.attr(HitsTagAttr, BattlerTagType.HIDDEN, true),
new AttackMove(Moves.CONFUSION, Type.PSYCHIC, MoveCategory.SPECIAL, 50, 100, 25, 10, 0, 1) new AttackMove(Moves.CONFUSION, Type.PSYCHIC, MoveCategory.SPECIAL, 50, 100, 25, 10, 0, 1)
.attr(ConfuseAttr), .attr(ConfuseAttr),
new AttackMove(Moves.PSYCHIC, Type.PSYCHIC, MoveCategory.SPECIAL, 90, 100, 10, 10, 0, 1) new AttackMove(Moves.PSYCHIC, Type.PSYCHIC, MoveCategory.SPECIAL, 90, 100, 10, 10, 0, 1)

View File

@ -2261,7 +2261,7 @@ export class MovePhase extends BattlePhase {
const targets = this.scene.getField(true).filter(p => { const targets = this.scene.getField(true).filter(p => {
if (this.targets.indexOf(p.getBattlerIndex()) > -1) { if (this.targets.indexOf(p.getBattlerIndex()) > -1) {
const hiddenTag = p.getTag(HiddenTag); const hiddenTag = p.getTag(HiddenTag);
if (hiddenTag && !this.move.getMove().getAttrs(HitsTagAttr).filter(hta => (hta as HitsTagAttr).tagType === hiddenTag.tagType).length && !p.hasAbilityWithAttr(AlwaysHitAbAttr) && !this.pokemon.hasAbilityWithAttr(AlwaysHitAbAttr)) if (hiddenTag && !this.move.getMove().getAttrs(HitsTagAttr).filter(hta => (hta as HitsTagAttr).tagType === hiddenTag.tagType).length && !this.move.getMove().ignoresHiddenTag(this.pokemon) && !p.hasAbilityWithAttr(AlwaysHitAbAttr) && !this.pokemon.hasAbilityWithAttr(AlwaysHitAbAttr))
return false; return false;
return true; return true;
} }
@ -2580,7 +2580,7 @@ export class MoveEffectPhase extends PokemonPhase {
return true; return true;
const hiddenTag = target.getTag(HiddenTag); const hiddenTag = target.getTag(HiddenTag);
if (hiddenTag && !this.move.getMove().getAttrs(HitsTagAttr).filter(hta => (hta as HitsTagAttr).tagType === hiddenTag.tagType).length) if (hiddenTag && !this.move.getMove().getAttrs(HitsTagAttr).filter(hta => (hta as HitsTagAttr).tagType === hiddenTag.tagType).length && !this.move.getMove().ignoresHiddenTag(this.getUserPokemon()))
return false; return false;
if (user.getTag(BattlerTagType.IGNORE_ACCURACY) && (user.getLastXMoves().find(() => true)?.targets || []).indexOf(target.getBattlerIndex()) > -1) if (user.getTag(BattlerTagType.IGNORE_ACCURACY) && (user.getLastXMoves().find(() => true)?.targets || []).indexOf(target.getBattlerIndex()) > -1)