Fix not checking move conditions for AI
This commit is contained in:
parent
0f153d39b1
commit
7a418109c3
|
@ -919,8 +919,8 @@ export class MovePowerBoostAbAttr extends VariableMovePowerAbAttr {
|
|||
private condition: PokemonAttackCondition;
|
||||
private powerMultiplier: number;
|
||||
|
||||
constructor(condition: PokemonAttackCondition, powerMultiplier: number) {
|
||||
super(true);
|
||||
constructor(condition: PokemonAttackCondition, powerMultiplier: number, showAbility: boolean = true) {
|
||||
super(showAbility);
|
||||
this.condition = condition;
|
||||
this.powerMultiplier = powerMultiplier;
|
||||
}
|
||||
|
@ -2725,7 +2725,7 @@ export function initAbilities() {
|
|||
.attr(TypeImmunityStatChangeAbAttr, Type.ELECTRIC, BattleStat.SPD, 1)
|
||||
.ignorable(),
|
||||
new Ability(Abilities.RIVALRY, 4)
|
||||
.attr(MovePowerBoostAbAttr, (user, target, move) => user.gender !== Gender.GENDERLESS && target.gender !== Gender.GENDERLESS && user.gender === target.gender, 1.25)
|
||||
.attr(MovePowerBoostAbAttr, (user, target, move) => user.gender !== Gender.GENDERLESS && target.gender !== Gender.GENDERLESS && user.gender === target.gender, 1.25, true)
|
||||
.attr(MovePowerBoostAbAttr, (user, target, move) => user.gender !== Gender.GENDERLESS && target.gender !== Gender.GENDERLESS && user.gender !== target.gender, 0.75),
|
||||
new Ability(Abilities.STEADFAST, 4)
|
||||
.attr(FlinchStatChangeAbAttr, BattleStat.SPD, 1),
|
||||
|
|
|
@ -3645,6 +3645,20 @@ export class MoneyAttr extends MoveEffectAttr {
|
|||
}
|
||||
}
|
||||
|
||||
export class LastResortAttr extends MoveAttr {
|
||||
getCondition(): MoveConditionFunc {
|
||||
return (user: Pokemon, target: Pokemon, move: Move) => {
|
||||
const uniqueUsedMoveIds = new Set<Moves>();
|
||||
const movesetMoveIds = user.getMoveset().map(m => m.moveId);
|
||||
user.getMoveHistory().map(m => {
|
||||
if (m.move !== move.id && movesetMoveIds.find(mm => mm === m.move))
|
||||
uniqueUsedMoveIds.add(m.move);
|
||||
});
|
||||
return uniqueUsedMoveIds.size >= movesetMoveIds.length - 1;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const failOnGravityCondition: MoveConditionFunc = (user, target, move) => !user.scene.arena.getTag(ArenaTagType.GRAVITY);
|
||||
|
||||
const failOnBossCondition: MoveConditionFunc = (user, target, move) => !target.isBossImmune();
|
||||
|
@ -4836,15 +4850,7 @@ export function initMoves() {
|
|||
new AttackMove(Moves.PUNISHMENT, Type.DARK, MoveCategory.PHYSICAL, -1, 100, 5, -1, 0, 4)
|
||||
.unimplemented(),
|
||||
new AttackMove(Moves.LAST_RESORT, Type.NORMAL, MoveCategory.PHYSICAL, 140, 100, 5, -1, 0, 4)
|
||||
.condition((user, target, move) => {
|
||||
const uniqueUsedMoveIds = new Set<Moves>();
|
||||
const movesetMoveIds = user.getMoveset().map(m => m.moveId);
|
||||
user.getMoveHistory().map(m => {
|
||||
if (m.move !== move.id && movesetMoveIds.find(mm => mm === m.move))
|
||||
uniqueUsedMoveIds.add(m.move);
|
||||
});
|
||||
return uniqueUsedMoveIds.size >= movesetMoveIds.length - 1;
|
||||
}),
|
||||
.attr(LastResortAttr),
|
||||
new StatusMove(Moves.WORRY_SEED, Type.GRASS, 100, 10, -1, 0, 4)
|
||||
.attr(AbilityChangeAttr, Abilities.INSOMNIA),
|
||||
new AttackMove(Moves.SUCKER_PUNCH, Type.DARK, MoveCategory.PHYSICAL, 70, 100, 5, -1, 1, 4)
|
||||
|
|
|
@ -2680,7 +2680,7 @@ export class EnemyPokemon extends Pokemon {
|
|||
for (let mt of moveTargets[move.id]) {
|
||||
const target = this.scene.getField()[mt];
|
||||
let targetScore = move.getUserBenefitScore(this, target, move) + move.getTargetBenefitScore(this, target, move) * (mt < BattlerIndex.ENEMY === this.isPlayer() ? 1 : -1);
|
||||
if (move.name.endsWith(' (N)'))
|
||||
if (move.name.endsWith(' (N)') || !move.applyConditions(this, target, move))
|
||||
targetScore = -20;
|
||||
else if (move instanceof AttackMove) {
|
||||
const effectiveness = target.getAttackMoveEffectiveness(this, pokemonMove);
|
||||
|
|
Loading…
Reference in New Issue