mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-06 08:22:16 +02:00
Final Version
Working implementation of PreAttackChangeType class that has been applied to libero and protean
This commit is contained in:
parent
a542f742fd
commit
b5206ff9d1
@ -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)
|
||||||
|
@ -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);
|
||||||
|
|
||||||
@ -3044,12 +3044,13 @@ export class PokemonSummonData {
|
|||||||
export class PokemonBattleData {
|
export class PokemonBattleData {
|
||||||
public hitCount: integer = 0;
|
public hitCount: integer = 0;
|
||||||
public endured: boolean = false;
|
public endured: boolean = false;
|
||||||
public berriesEaten: BerryType[] = [];
|
public berriesEaten: BerryType[] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user