partially implemented protean/libero

pull/692/head
Paul 2024-05-09 23:27:45 +02:00
parent 10cf1cd94f
commit c344978870
3 changed files with 49 additions and 4 deletions

View File

@ -964,6 +964,34 @@ export class FieldPreventExplosiveMovesAbAttr extends AbAttr {
} }
} }
export class PokemonTypeChangeAttr extends PreAttackAbAttr {
private condition: PokemonAttackCondition;
constructor(condition: PokemonAttackCondition){
super(true);
this.condition = condition;
}
applyPreAttack(pokemon: Pokemon, passive: boolean, defender: Pokemon, move: PokemonMove, args: any[]): boolean {
const moveType = move.getMove().type;
let effectiveType = moveType;
if (args && args.length > 0 && args[0] instanceof Utils.IntegerHolder) {
effectiveType = args[0].value;
}
const pokemonType = pokemon.getTypes();
if(this.condition(pokemon, defender, move.getMove()))
if(pokemonType.length > 1 || pokemonType[0] != effectiveType){
pokemon.summonData.types = [effectiveType]
pokemon.updateInfo();
pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` transformed into the ${Utils.toReadableString(Type[effectiveType])} type!`));
return true;
}
return false;
}
}
export class MoveTypeChangeAttr extends PreAttackAbAttr { export class MoveTypeChangeAttr extends PreAttackAbAttr {
private newType: Type; private newType: Type;
private powerMultiplier: number; private powerMultiplier: number;
@ -3236,7 +3264,8 @@ export function initAbilities() {
new Ability(Abilities.CHEEK_POUCH, 6) new Ability(Abilities.CHEEK_POUCH, 6)
.unimplemented(), .unimplemented(),
new Ability(Abilities.PROTEAN, 6) new Ability(Abilities.PROTEAN, 6)
.unimplemented(), .attr(PokemonTypeChangeAttr, (user, target, move) => !move.hasFlag(MoveFlags.CALLS_OTHER_MOVES) && move.id !== Moves.STRUGGLE && move.id !== Moves.REVELATION_DANCE && move.id !== Moves.CAMOUFLAGE)
.partial(),
new Ability(Abilities.FUR_COAT, 6) new Ability(Abilities.FUR_COAT, 6)
.attr(ReceivedMoveDamageMultiplierAbAttr, (target, user, move) => move.category === MoveCategory.PHYSICAL, 0.5) .attr(ReceivedMoveDamageMultiplierAbAttr, (target, user, move) => move.category === MoveCategory.PHYSICAL, 0.5)
.ignorable(), .ignorable(),
@ -3458,7 +3487,8 @@ export function initAbilities() {
.attr(PostSummonStatChangeAbAttr, BattleStat.DEF, 1, true) .attr(PostSummonStatChangeAbAttr, BattleStat.DEF, 1, true)
.condition(getOncePerBattleCondition(Abilities.DAUNTLESS_SHIELD)), .condition(getOncePerBattleCondition(Abilities.DAUNTLESS_SHIELD)),
new Ability(Abilities.LIBERO, 8) new Ability(Abilities.LIBERO, 8)
.unimplemented(), .attr(PokemonTypeChangeAttr, (user, target, move) => !move.hasFlag(MoveFlags.CALLS_OTHER_MOVES) && move.id !== Moves.STRUGGLE && move.id !== Moves.REVELATION_DANCE && move.id !== Moves.CAMOUFLAGE)
.partial(),
new Ability(Abilities.BALL_FETCH, 8) new Ability(Abilities.BALL_FETCH, 8)
.unimplemented(), .unimplemented(),
new Ability(Abilities.COTTON_DOWN, 8) new Ability(Abilities.COTTON_DOWN, 8)

View File

@ -77,6 +77,7 @@ export enum MoveFlags {
WIND_MOVE = 1 << 14, WIND_MOVE = 1 << 14,
TRIAGE_MOVE = 1 << 15, TRIAGE_MOVE = 1 << 15,
IGNORE_ABILITIES = 1 << 16, IGNORE_ABILITIES = 1 << 16,
CALLS_OTHER_MOVES = 1 << 17,
} }
type MoveConditionFunc = (user: Pokemon, target: Pokemon, move: Move) => boolean; type MoveConditionFunc = (user: Pokemon, target: Pokemon, move: Move) => boolean;
@ -317,6 +318,11 @@ export default class Move implements Localizable {
return this; return this;
} }
callsOtherMoves(callsOtherMoves?: boolean): this {
this.setFlag(MoveFlags.CALLS_OTHER_MOVES, callsOtherMoves);
return this;
}
checkFlag(flag: MoveFlags, user: Pokemon, target: Pokemon): boolean { checkFlag(flag: MoveFlags, user: Pokemon, target: Pokemon): boolean {
switch (flag) { switch (flag) {
case MoveFlags.MAKES_CONTACT: case MoveFlags.MAKES_CONTACT:
@ -2261,7 +2267,7 @@ export class ThunderAccuracyAttr extends VariableAccuracyAttr {
export class ToxicAccuracyAttr extends VariableAccuracyAttr { export class ToxicAccuracyAttr extends VariableAccuracyAttr {
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
if (user.isOfType(Type.POISON)) { if (user.isOfType(Type.POISON) || user.hasAbility(Abilities.PROTEAN)) {
const accuracy = args[0] as Utils.NumberHolder; const accuracy = args[0] as Utils.NumberHolder;
accuracy.value = -1; accuracy.value = -1;
return true; return true;
@ -4384,9 +4390,11 @@ export function initMoves() {
.unimplemented(), .unimplemented(),
new SelfStatusMove(Moves.METRONOME, Type.NORMAL, -1, 10, -1, 0, 1) new SelfStatusMove(Moves.METRONOME, Type.NORMAL, -1, 10, -1, 0, 1)
.attr(RandomMoveAttr) .attr(RandomMoveAttr)
.callsOtherMoves()
.ignoresVirtual(), .ignoresVirtual(),
new StatusMove(Moves.MIRROR_MOVE, Type.FLYING, -1, 20, -1, 0, 1) new StatusMove(Moves.MIRROR_MOVE, Type.FLYING, -1, 20, -1, 0, 1)
.attr(CopyMoveAttr) .attr(CopyMoveAttr)
.callsOtherMoves()
.ignoresVirtual(), .ignoresVirtual(),
new AttackMove(Moves.SELF_DESTRUCT, Type.NORMAL, MoveCategory.PHYSICAL, 200, 100, 5, -1, 0, 1) new AttackMove(Moves.SELF_DESTRUCT, Type.NORMAL, MoveCategory.PHYSICAL, 200, 100, 5, -1, 0, 1)
.attr(SacrificialAttr) .attr(SacrificialAttr)
@ -4656,6 +4664,7 @@ export function initMoves() {
.attr(BypassSleepAttr) .attr(BypassSleepAttr)
.attr(RandomMovesetMoveAttr) .attr(RandomMovesetMoveAttr)
.condition((user, target, move) => user.status?.effect === StatusEffect.SLEEP) .condition((user, target, move) => user.status?.effect === StatusEffect.SLEEP)
.callsOtherMoves()
.ignoresVirtual(), .ignoresVirtual(),
new StatusMove(Moves.HEAL_BELL, Type.NORMAL, -1, 5, -1, 0, 2) new StatusMove(Moves.HEAL_BELL, Type.NORMAL, -1, 5, -1, 0, 2)
.attr(PartyStatusCureAttr, "A bell chimed!", Abilities.SOUNDPROOF) .attr(PartyStatusCureAttr, "A bell chimed!", Abilities.SOUNDPROOF)
@ -4817,6 +4826,7 @@ export function initMoves() {
.unimplemented(), .unimplemented(),
new StatusMove(Moves.NATURE_POWER, Type.NORMAL, -1, 20, -1, 0, 3) new StatusMove(Moves.NATURE_POWER, Type.NORMAL, -1, 20, -1, 0, 3)
.attr(NaturePowerAttr) .attr(NaturePowerAttr)
.callsOtherMoves()
.ignoresVirtual(), .ignoresVirtual(),
new SelfStatusMove(Moves.CHARGE, Type.ELECTRIC, -1, 20, -1, 0, 3) new SelfStatusMove(Moves.CHARGE, Type.ELECTRIC, -1, 20, -1, 0, 3)
.attr(StatChangeAttr, BattleStat.SPDEF, 1, true) .attr(StatChangeAttr, BattleStat.SPDEF, 1, true)
@ -4835,6 +4845,7 @@ export function initMoves() {
.attr(AddArenaTagAttr, ArenaTagType.WISH, 2, true), .attr(AddArenaTagAttr, ArenaTagType.WISH, 2, true),
new SelfStatusMove(Moves.ASSIST, Type.NORMAL, -1, 20, -1, 0, 3) new SelfStatusMove(Moves.ASSIST, Type.NORMAL, -1, 20, -1, 0, 3)
.attr(RandomMovesetMoveAttr, true) .attr(RandomMovesetMoveAttr, true)
.callsOtherMoves()
.ignoresVirtual(), .ignoresVirtual(),
new SelfStatusMove(Moves.INGRAIN, Type.GRASS, -1, 20, -1, 0, 3) new SelfStatusMove(Moves.INGRAIN, Type.GRASS, -1, 20, -1, 0, 3)
.attr(AddBattlerTagAttr, BattlerTagType.INGRAIN, true, true), .attr(AddBattlerTagAttr, BattlerTagType.INGRAIN, true, true),
@ -4870,6 +4881,7 @@ export function initMoves() {
new SelfStatusMove(Moves.GRUDGE, Type.GHOST, -1, 5, -1, 0, 3) new SelfStatusMove(Moves.GRUDGE, Type.GHOST, -1, 5, -1, 0, 3)
.unimplemented(), .unimplemented(),
new SelfStatusMove(Moves.SNATCH, Type.DARK, -1, 10, -1, 4, 3) new SelfStatusMove(Moves.SNATCH, Type.DARK, -1, 10, -1, 4, 3)
.callsOtherMoves()
.unimplemented(), .unimplemented(),
new AttackMove(Moves.SECRET_POWER, Type.NORMAL, MoveCategory.PHYSICAL, 70, 100, 20, 30, 0, 3) new AttackMove(Moves.SECRET_POWER, Type.NORMAL, MoveCategory.PHYSICAL, 70, 100, 20, 30, 0, 3)
.makesContact(false) .makesContact(false)
@ -5127,11 +5139,13 @@ export function initMoves() {
.target(MoveTarget.USER_SIDE) .target(MoveTarget.USER_SIDE)
.unimplemented(), .unimplemented(),
new StatusMove(Moves.ME_FIRST, Type.NORMAL, -1, 20, -1, 0, 4) new StatusMove(Moves.ME_FIRST, Type.NORMAL, -1, 20, -1, 0, 4)
.callsOtherMoves()
.ignoresVirtual() .ignoresVirtual()
.target(MoveTarget.NEAR_ENEMY) .target(MoveTarget.NEAR_ENEMY)
.unimplemented(), .unimplemented(),
new SelfStatusMove(Moves.COPYCAT, Type.NORMAL, -1, 20, -1, 0, 4) new SelfStatusMove(Moves.COPYCAT, Type.NORMAL, -1, 20, -1, 0, 4)
.attr(CopyMoveAttr) .attr(CopyMoveAttr)
.callsOtherMoves()
.ignoresVirtual(), .ignoresVirtual(),
new StatusMove(Moves.POWER_SWAP, Type.PSYCHIC, -1, 10, -1, 0, 4) new StatusMove(Moves.POWER_SWAP, Type.PSYCHIC, -1, 10, -1, 0, 4)
.unimplemented(), .unimplemented(),

View File

@ -27,7 +27,7 @@ import { TempBattleStat } from '../data/temp-battle-stat';
import { ArenaTagSide, WeakenMoveScreenTag, WeakenMoveTypeTag } from '../data/arena-tag'; import { ArenaTagSide, WeakenMoveScreenTag, WeakenMoveTypeTag } from '../data/arena-tag';
import { ArenaTagType } from "../data/enums/arena-tag-type"; import { ArenaTagType } from "../data/enums/arena-tag-type";
import { Biome } from "../data/enums/biome"; import { Biome } from "../data/enums/biome";
import { Ability, AbAttr, BattleStatMultiplierAbAttr, BlockCritAbAttr, BonusCritAbAttr, BypassBurnDamageReductionAbAttr, FieldPriorityMoveImmunityAbAttr, FieldVariableMovePowerAbAttr, IgnoreOpponentStatChangesAbAttr, MoveImmunityAbAttr, MoveTypeChangeAttr, NonSuperEffectiveImmunityAbAttr, PreApplyBattlerTagAbAttr, PreDefendFullHpEndureAbAttr, ReceivedMoveDamageMultiplierAbAttr, ReduceStatusEffectDurationAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, VariableMovePowerAbAttr, VariableMoveTypeAbAttr, WeightMultiplierAbAttr, allAbilities, applyAbAttrs, applyBattleStatMultiplierAbAttrs, applyPostDefendAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs, UnsuppressableAbilityAbAttr, SuppressFieldAbilitiesAbAttr, NoFusionAbilityAbAttr, MultCritAbAttr, IgnoreTypeImmunityAbAttr } from '../data/ability'; import { Ability, AbAttr, BattleStatMultiplierAbAttr, BlockCritAbAttr, BonusCritAbAttr, BypassBurnDamageReductionAbAttr, FieldPriorityMoveImmunityAbAttr, FieldVariableMovePowerAbAttr, IgnoreOpponentStatChangesAbAttr, MoveImmunityAbAttr, MoveTypeChangeAttr, NonSuperEffectiveImmunityAbAttr, PreApplyBattlerTagAbAttr, PreDefendFullHpEndureAbAttr, ReceivedMoveDamageMultiplierAbAttr, ReduceStatusEffectDurationAbAttr, StabBoostAbAttr, StatusEffectImmunityAbAttr, TypeImmunityAbAttr, VariableMovePowerAbAttr, VariableMoveTypeAbAttr, WeightMultiplierAbAttr, allAbilities, applyAbAttrs, applyBattleStatMultiplierAbAttrs, applyPostDefendAbAttrs, applyPreApplyBattlerTagAbAttrs, applyPreAttackAbAttrs, applyPreDefendAbAttrs, applyPreSetStatusAbAttrs, UnsuppressableAbilityAbAttr, SuppressFieldAbilitiesAbAttr, NoFusionAbilityAbAttr, MultCritAbAttr, IgnoreTypeImmunityAbAttr, PokemonTypeChangeAttr } from '../data/ability';
import { Abilities } from "#app/data/enums/abilities"; import { Abilities } from "#app/data/enums/abilities";
import PokemonData from '../system/pokemon-data'; import PokemonData from '../system/pokemon-data';
import Battle, { BattlerIndex } from '../battle'; import Battle, { BattlerIndex } from '../battle';
@ -1288,6 +1288,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
applyMoveAttrs(VariableMoveTypeAttr, source, this, move, variableType); applyMoveAttrs(VariableMoveTypeAttr, source, this, move, variableType);
// 2nd argument is for MoveTypeChangePowerMultiplierAbAttr // 2nd argument is for MoveTypeChangePowerMultiplierAbAttr
applyAbAttrs(VariableMoveTypeAbAttr, source, null, variableType, typeChangeMovePowerMultiplier); applyAbAttrs(VariableMoveTypeAbAttr, source, null, variableType, typeChangeMovePowerMultiplier);
applyPreAttackAbAttrs(PokemonTypeChangeAttr, source, this, battlerMove, variableType, typeChangeMovePowerMultiplier);
applyPreAttackAbAttrs(MoveTypeChangeAttr, source, this, battlerMove, variableType, typeChangeMovePowerMultiplier); applyPreAttackAbAttrs(MoveTypeChangeAttr, source, this, battlerMove, variableType, typeChangeMovePowerMultiplier);
const type = variableType.value as Type; const type = variableType.value as Type;
const types = this.getTypes(true, true); const types = this.getTypes(true, true);