mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-13 11:52:18 +02:00
Implemented Power Split and Guard Split
This commit is contained in:
parent
7f0362e124
commit
5a8c0d81e9
@ -1755,6 +1755,59 @@ export class HpSplitAttr extends MoveEffectAttr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class PowerSplitAttr extends MoveEffectAttr {
|
||||||
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]) : Promise<boolean> {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
|
||||||
|
if (!super.apply(user, target, move, args))
|
||||||
|
return resolve(false);
|
||||||
|
|
||||||
|
const infoUpdates = [];
|
||||||
|
|
||||||
|
const attackValue = Math.floor((target.getStat(Stat.ATK) + user.getStat(Stat.ATK)) / 2);
|
||||||
|
user.changeStat(Stat.ATK, attackValue);
|
||||||
|
infoUpdates.push(user.updateInfo());
|
||||||
|
target.changeStat(Stat.ATK, attackValue);
|
||||||
|
infoUpdates.push(target.updateInfo());
|
||||||
|
|
||||||
|
const specialAttackValue = Math.floor((target.getStat(Stat.SPATK) + user.getStat(Stat.SPATK)) / 2);
|
||||||
|
user.changeStat(Stat.SPATK, specialAttackValue);
|
||||||
|
infoUpdates.push(user.updateInfo());
|
||||||
|
target.changeStat(Stat.SPATK, specialAttackValue);
|
||||||
|
infoUpdates.push(target.updateInfo());
|
||||||
|
|
||||||
|
return Promise.all(infoUpdates).then(() => resolve(true));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class GuardSplitAttr extends MoveEffectAttr {
|
||||||
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): Promise<boolean> {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
if (!super.apply(user, target, move, args))
|
||||||
|
return resolve(false);
|
||||||
|
|
||||||
|
const infoUpdates = [];
|
||||||
|
|
||||||
|
const defenseValue = Math.floor((target.getStat(Stat.DEF) + user.getStat(Stat.DEF)) / 2);
|
||||||
|
user.changeStat(Stat.DEF, defenseValue);
|
||||||
|
infoUpdates.push(user.updateInfo());
|
||||||
|
target.changeStat(Stat.DEF, defenseValue);
|
||||||
|
infoUpdates.push(target.updateInfo());
|
||||||
|
|
||||||
|
const specialDefenseValue = Math.floor((target.getStat(Stat.SPDEF) + user.getStat(Stat.SPDEF)) / 2);
|
||||||
|
user.changeStat(Stat.SPDEF, specialDefenseValue);
|
||||||
|
infoUpdates.push(user.updateInfo());
|
||||||
|
target.changeStat(Stat.SPDEF, specialDefenseValue);
|
||||||
|
infoUpdates.push(target.updateInfo());
|
||||||
|
|
||||||
|
|
||||||
|
return Promise.all(infoUpdates).then(() => resolve(true));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
export class VariablePowerAttr extends MoveAttr {
|
export class VariablePowerAttr extends MoveAttr {
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||||
//const power = args[0] as Utils.NumberHolder;
|
//const power = args[0] as Utils.NumberHolder;
|
||||||
@ -5331,9 +5384,9 @@ export function initMoves() {
|
|||||||
.target(MoveTarget.USER_SIDE)
|
.target(MoveTarget.USER_SIDE)
|
||||||
.unimplemented(),
|
.unimplemented(),
|
||||||
new StatusMove(Moves.GUARD_SPLIT, Type.PSYCHIC, -1, 10, -1, 0, 5)
|
new StatusMove(Moves.GUARD_SPLIT, Type.PSYCHIC, -1, 10, -1, 0, 5)
|
||||||
.unimplemented(),
|
.attr(GuardSplitAttr),
|
||||||
new StatusMove(Moves.POWER_SPLIT, Type.PSYCHIC, -1, 10, -1, 0, 5)
|
new StatusMove(Moves.POWER_SPLIT, Type.PSYCHIC, -1, 10, -1, 0, 5)
|
||||||
.unimplemented(),
|
.attr(PowerSplitAttr),
|
||||||
new StatusMove(Moves.WONDER_ROOM, Type.PSYCHIC, -1, 10, -1, 0, 5)
|
new StatusMove(Moves.WONDER_ROOM, Type.PSYCHIC, -1, 10, -1, 0, 5)
|
||||||
.ignoresProtect()
|
.ignoresProtect()
|
||||||
.target(MoveTarget.BOTH_SIDES)
|
.target(MoveTarget.BOTH_SIDES)
|
||||||
|
@ -1552,6 +1552,11 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
return healAmount;
|
return healAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changeStat(stat: Stat, value: integer) : void
|
||||||
|
{
|
||||||
|
this.stats[stat] = value;
|
||||||
|
}
|
||||||
|
|
||||||
isBossImmune(): boolean {
|
isBossImmune(): boolean {
|
||||||
return this.isBoss();
|
return this.isBoss();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user