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 {
private newType: Type;
private powerMultiplier: number;
@ -3236,7 +3264,8 @@ export function initAbilities() {
new Ability(Abilities.CHEEK_POUCH, 6)
.unimplemented(),
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)
.attr(ReceivedMoveDamageMultiplierAbAttr, (target, user, move) => move.category === MoveCategory.PHYSICAL, 0.5)
.ignorable(),
@ -3458,7 +3487,8 @@ export function initAbilities() {
.attr(PostSummonStatChangeAbAttr, BattleStat.DEF, 1, true)
.condition(getOncePerBattleCondition(Abilities.DAUNTLESS_SHIELD)),
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)
.unimplemented(),
new Ability(Abilities.COTTON_DOWN, 8)

View File

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

View File

@ -27,7 +27,7 @@ import { TempBattleStat } from '../data/temp-battle-stat';
import { ArenaTagSide, WeakenMoveScreenTag, WeakenMoveTypeTag } from '../data/arena-tag';
import { ArenaTagType } from "../data/enums/arena-tag-type";
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 PokemonData from '../system/pokemon-data';
import Battle, { BattlerIndex } from '../battle';
@ -1288,6 +1288,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
applyMoveAttrs(VariableMoveTypeAttr, source, this, move, variableType);
// 2nd argument is for MoveTypeChangePowerMultiplierAbAttr
applyAbAttrs(VariableMoveTypeAbAttr, source, null, variableType, typeChangeMovePowerMultiplier);
applyPreAttackAbAttrs(PokemonTypeChangeAttr, source, this, battlerMove, variableType, typeChangeMovePowerMultiplier);
applyPreAttackAbAttrs(MoveTypeChangeAttr, source, this, battlerMove, variableType, typeChangeMovePowerMultiplier);
const type = variableType.value as Type;
const types = this.getTypes(true, true);