mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-06 08:22: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{
|
export class PreAttackChangeType extends PreAttackAbAttr{
|
||||||
applyPreAttack(pokemon:Pokemon,passive:boolean,defender:Pokemon,move:PokemonMove): boolean {
|
private condition: PokemonAttackCondition;
|
||||||
const MoveType = move.getMove().type;
|
constructor (condition:PokemonAttackCondition){
|
||||||
const originalType = pokemon.getTypes();
|
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)){
|
if (originalType.length > 1 || !pokemon.isOfType(MoveType)){
|
||||||
pokemon.summonData.types = [MoveType];
|
pokemon.summonData.types = [MoveType];
|
||||||
pokemon.updateInfo();
|
pokemon.updateInfo();
|
||||||
pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` tranformed\ninto the ${Utils.toReadableString(Type[MoveType])} type!`));
|
pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` tranformed\ninto the ${Utils.toReadableString(Type[MoveType])} type!`));
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
export class VariableMoveTypeAbAttr extends AbAttr {
|
export class VariableMoveTypeAbAttr extends AbAttr {
|
||||||
apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
apply(pokemon: Pokemon, passive: boolean, cancelled: Utils.BooleanHolder, args: any[]): boolean {
|
||||||
//const power = args[0] as Utils.IntegerHolder;
|
//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 {
|
export class PostVictoryAbAttr extends AbAttr {
|
||||||
applyPostVictory(pokemon: Pokemon, passive: boolean, args: any[]): boolean | Promise<boolean> {
|
applyPostVictory(pokemon: Pokemon, passive: boolean, args: any[]): boolean | Promise<boolean> {
|
||||||
return false;
|
return false;
|
||||||
@ -2996,8 +2988,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)
|
||||||
|
.attr(PreAttackChangeType,(user,target,move) => move.name !== 'Struggle' && !user.isTerastallized()),
|
||||||
//.attr(PostSummonMessageAbAttr,(pokemon: Pokemon) => getPokemonMessage(pokemon,' Testing out the text!'))
|
//.attr(PostSummonMessageAbAttr,(pokemon: Pokemon) => getPokemonMessage(pokemon,' Testing out the text!'))
|
||||||
.attr(PreAttackChangeType),
|
|
||||||
//.unimplemented(),
|
//.unimplemented(),
|
||||||
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)
|
||||||
|
@ -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 } 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 { 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';
|
||||||
@ -1230,6 +1230,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
// 2nd argument is for MoveTypeChangePowerMultiplierAbAttr
|
// 2nd argument is for MoveTypeChangePowerMultiplierAbAttr
|
||||||
applyAbAttrs(VariableMoveTypeAbAttr, source, null, variableType, typeChangeMovePowerMultiplier);
|
applyAbAttrs(VariableMoveTypeAbAttr, source, null, variableType, typeChangeMovePowerMultiplier);
|
||||||
applyPreAttackAbAttrs(MoveTypeChangeAttr, source, this, battlerMove, variableType, typeChangeMovePowerMultiplier);
|
applyPreAttackAbAttrs(MoveTypeChangeAttr, source, this, battlerMove, variableType, typeChangeMovePowerMultiplier);
|
||||||
|
applyPreAttackAbAttrs(PreAttackChangeType,source,null,battlerMove,)
|
||||||
const type = variableType.value as Type;
|
const type = variableType.value as Type;
|
||||||
const types = this.getTypes(true, true);
|
const types = this.getTypes(true, true);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user