mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-06 00:12:16 +02:00
Changing works, need to make 1 time use
Now applies type change correctly, but need to find right condition to make it only apply once per switch.
This commit is contained in:
parent
ed08dc5d21
commit
a78186aa8c
@ -841,20 +841,27 @@ export class VariableMovePowerAbAttr extends PreAttackAbAttr {
|
||||
}
|
||||
|
||||
export class PreAttackChangeType extends PreAttackAbAttr{
|
||||
applyPreAttack(pokemon:Pokemon,passive:boolean,defender:Pokemon,move:PokemonMove): boolean {
|
||||
const MoveType = move.getMove().type;
|
||||
const originalType = pokemon.getTypes();
|
||||
|
||||
private condition: PokemonAttackCondition;
|
||||
constructor (condition:PokemonAttackCondition){
|
||||
super(true);
|
||||
this.condition = condition;
|
||||
}
|
||||
applyPreAttack(pokemon:Pokemon,passive:boolean,defender:Pokemon,move:PokemonMove): boolean{
|
||||
console.log("Made it here within the function!!")
|
||||
//console.log(pokemon.battleData.hitCount)
|
||||
console.log(this.condition(pokemon,defender,move.getMove()))
|
||||
const MoveType = move.getMove().type;
|
||||
const originalType = pokemon.getTypes();
|
||||
if (this.condition(pokemon,defender,move.getMove())){
|
||||
if (originalType.length > 1 || !pokemon.isOfType(MoveType)){
|
||||
pokemon.summonData.types = [MoveType];
|
||||
pokemon.updateInfo();
|
||||
pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` tranformed\ninto the ${Utils.toReadableString(Type[MoveType])} type!`));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
@ -1139,21 +1146,6 @@ export class PostDefendStealHeldItemAbAttr extends PostDefendAbAttr {
|
||||
}
|
||||
}
|
||||
|
||||
export class PostAttackChangeType extends PostAttackAbAttr{
|
||||
applyPostAttack(pokemon:Pokemon,passive:boolean,defender:Pokemon,move:PokemonMove): boolean {
|
||||
//if (this.condition(pokemon,defender,move.getMove())){
|
||||
const MoveType = move.getMove().type;
|
||||
const originalType = pokemon.getTypes();
|
||||
|
||||
if (originalType.length > 1 || !pokemon.isOfType(MoveType)){
|
||||
pokemon.summonData.types = [MoveType];
|
||||
pokemon.updateInfo();
|
||||
pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` tranformed\ninto the ${Utils.toReadableString(Type[MoveType])} type!`));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
export class PostVictoryAbAttr extends AbAttr {
|
||||
applyPostVictory(pokemon: Pokemon, passive: boolean, args: any[]): boolean | Promise<boolean> {
|
||||
return false;
|
||||
@ -2996,8 +2988,8 @@ export function initAbilities() {
|
||||
new Ability(Abilities.CHEEK_POUCH, 6)
|
||||
.unimplemented(),
|
||||
new Ability(Abilities.PROTEAN, 6)
|
||||
.attr(PreAttackChangeType,(user,target,move) => move.name !== 'Struggle' && !user.isTerastallized()),
|
||||
//.attr(PostSummonMessageAbAttr,(pokemon: Pokemon) => getPokemonMessage(pokemon,' Testing out the text!'))
|
||||
.attr(PreAttackChangeType),
|
||||
//.unimplemented(),
|
||||
new Ability(Abilities.FUR_COAT, 6)
|
||||
.attr(ReceivedMoveDamageMultiplierAbAttr, (target, user, move) => move.category === MoveCategory.PHYSICAL, 0.5)
|
||||
|
@ -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 } 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, PreAttackChangeType } from '../data/ability';
|
||||
import { Abilities } from "#app/data/enums/abilities";
|
||||
import PokemonData from '../system/pokemon-data';
|
||||
import Battle, { BattlerIndex } from '../battle';
|
||||
@ -1230,6 +1230,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,null,battlerMove,)
|
||||
const type = variableType.value as Type;
|
||||
const types = this.getTypes(true, true);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user