Final Version

Working implementation of PreAttackChangeType class that has been applied to libero and protean
This commit is contained in:
takeyourt1me 2024-05-03 14:09:11 -07:00
parent a542f742fd
commit b5206ff9d1
2 changed files with 8 additions and 10 deletions

View File

@ -860,14 +860,13 @@ export class PreAttackChangeType extends PreAttackAbAttr{
this.condition = condition; this.condition = condition;
} }
applyPreAttack(pokemon:Pokemon,passive:boolean,defender:Pokemon,move:PokemonMove): boolean{ 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 MoveType = move.getMove().type;
const originalType = pokemon.getTypes(); const originalType = pokemon.getTypes();
if (this.condition(pokemon,defender,move.getMove())){ if (this.condition(pokemon,defender,move.getMove())){
if (originalType.length > 1 || !pokemon.isOfType(MoveType)){ if (originalType.length > 1 || originalType[0] !== MoveType){
pokemon.summonData.types = [MoveType]; pokemon.summonData.types = [MoveType];
pokemon.battleSummonData.abilityTriggeredThisSwitch = true;
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!`));
} }
@ -3001,9 +3000,7 @@ 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(PreAttackChangeType,(user,target,move) => move.name !== 'Struggle' && !user.isTerastallized() && user.battleSummonData.abilityTriggeredThisSwitch === false),
//.attr(PostSummonMessageAbAttr,(pokemon: Pokemon) => getPokemonMessage(pokemon,' Testing out the text!'))
//.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)
.ignorable(), .ignorable(),
@ -3224,7 +3221,7 @@ export function initAbilities() {
new Ability(Abilities.DAUNTLESS_SHIELD, 8) new Ability(Abilities.DAUNTLESS_SHIELD, 8)
.attr(PostSummonStatChangeAbAttr, BattleStat.DEF, 1, true), .attr(PostSummonStatChangeAbAttr, BattleStat.DEF, 1, true),
new Ability(Abilities.LIBERO, 8) new Ability(Abilities.LIBERO, 8)
.unimplemented(), .attr(PreAttackChangeType,(user,target,move) => move.name !== 'Struggle' && !user.isTerastallized() && user.battleSummonData.abilityTriggeredThisSwitch === false),
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

@ -1247,7 +1247,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,) applyPreAttackAbAttrs(PreAttackChangeType,source,this,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);
@ -3050,6 +3050,7 @@ export class PokemonBattleData {
export class PokemonBattleSummonData { export class PokemonBattleSummonData {
public turnCount: integer = 1; public turnCount: integer = 1;
public moveHistory: TurnMove[] = []; public moveHistory: TurnMove[] = [];
public abilityTriggeredThisSwitch: boolean = false;
} }
export class PokemonTurnData { export class PokemonTurnData {