pull/432/merge
takeyourt1me 2024-05-05 20:40:00 -07:00 committed by GitHub
commit d0faaa0a66
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 31 additions and 4 deletions

View File

@ -887,6 +887,30 @@ export class VariableMovePowerAbAttr extends PreAttackAbAttr {
}
}
export class PreAttackChangeType extends PreAttackAbAttr{
private condition: PokemonAttackCondition;
constructor (condition:PokemonAttackCondition) {
super(true);
this.condition = condition;
}
applyPreAttack(pokemon:Pokemon,passive:boolean,defender:Pokemon,move:PokemonMove): boolean{
const MoveType = move.getMove().type;
const originalType = pokemon.getTypes();
if (this.condition(pokemon,defender,move.getMove())){
if (originalType.length > 1 || originalType[0] !== MoveType){
pokemon.summonData.types = [MoveType];
pokemon.battleSummonData.abilityTriggered = true;
pokemon.updateInfo();
pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` tranformed\ninto the ${Utils.toReadableString(Type[MoveType])} type!`));
}
}
return false;
}
}
export class VariableMoveTypeAbAttr extends AbAttr {
apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean {
//const power = args[0] as Utils.IntegerHolder;
@ -3144,7 +3168,7 @@ export function initAbilities() {
new Ability(Abilities.CHEEK_POUCH, 6)
.unimplemented(),
new Ability(Abilities.PROTEAN, 6)
.unimplemented(),
.attr(PreAttackChangeType,(user,target,move) => move.id !== Moves.STRUGGLE && !user.isTerastallized() && user.battleSummonData.abilityTriggered === false),
new Ability(Abilities.FUR_COAT, 6)
.attr(ReceivedMoveDamageMultiplierAbAttr, (target, user, move) => move.category === MoveCategory.PHYSICAL, 0.5)
.ignorable(),
@ -3364,7 +3388,7 @@ export function initAbilities() {
new Ability(Abilities.DAUNTLESS_SHIELD, 8)
.attr(PostSummonStatChangeAbAttr, BattleStat.DEF, 1, true),
new Ability(Abilities.LIBERO, 8)
.unimplemented(),
.attr(PreAttackChangeType,(user,target,move) => move.id !== Moves.STRUGGLE && !user.isTerastallized() && user.battleSummonData.abilityTriggered === false),
new Ability(Abilities.BALL_FETCH, 8)
.unimplemented(),
new Ability(Abilities.COTTON_DOWN, 8)

View File

@ -27,6 +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, PreAttackChangeType } 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 } from '../data/ability';
import { Abilities } from "#app/data/enums/abilities";
import PokemonData from '../system/pokemon-data';
@ -1256,6 +1257,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
// 2nd argument is for MoveTypeChangePowerMultiplierAbAttr
applyAbAttrs(VariableMoveTypeAbAttr, source, null, variableType, typeChangeMovePowerMultiplier);
applyPreAttackAbAttrs(MoveTypeChangeAttr, source, this, battlerMove, variableType, typeChangeMovePowerMultiplier);
applyPreAttackAbAttrs(PreAttackChangeType,source,this,battlerMove,)
const type = variableType.value as Type;
const types = this.getTypes(true, true);
@ -3115,6 +3117,7 @@ export class PokemonBattleData {
export class PokemonBattleSummonData {
public turnCount: integer = 1;
public moveHistory: TurnMove[] = [];
public abilityTriggered: boolean = false;
}
export class PokemonTurnData {