From eb1f2372231ba290225151b07b1e31cc9073a54a Mon Sep 17 00:00:00 2001 From: Luc Date: Wed, 24 Apr 2024 15:39:48 -0400 Subject: [PATCH 1/5] implemented pollen puff --- src/data/move.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/data/move.ts b/src/data/move.ts index 3f7bed996..ba1939bfe 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -1947,6 +1947,20 @@ export class PresentPowerAttr extends VariablePowerAttr { } } +export class ConditionalHealAttr extends VariablePowerAttr { + apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { + + if((user.isPlayer() && target.isPlayer()) || (!user.isPlayer() && !target.isPlayer())){ + (args[0] as Utils.NumberHolder).value = 0; + target.scene.unshiftPhase(new PokemonHealPhase(target.scene, target.getBattlerIndex(), + Math.max(Math.floor(target.getMaxHp() / 2), 1), getPokemonMessage(target, ' regained\nhealth!'), true)); + return true; + } + + return false; + } +} + export class VariableAtkAttr extends MoveAttr { constructor() { super(); @@ -5437,8 +5451,8 @@ export function initMoves() { new AttackMove(Moves.THROAT_CHOP, Type.DARK, MoveCategory.PHYSICAL, 80, 100, 15, 100, 0, 7) .partial(), new AttackMove(Moves.POLLEN_PUFF, Type.BUG, MoveCategory.SPECIAL, 90, 100, 15, -1, 0, 7) - .ballBombMove() - .partial(), + .attr(ConditionalHealAttr) + .ballBombMove(), new AttackMove(Moves.ANCHOR_SHOT, Type.STEEL, MoveCategory.PHYSICAL, 80, 100, 20, -1, 0, 7) .attr(AddBattlerTagAttr, BattlerTagType.TRAPPED, false, false, 1), new StatusMove(Moves.PSYCHIC_TERRAIN, Type.PSYCHIC, -1, 10, -1, 0, 7) From bce4e0167da95c6094805dd157c2b66302b5e172 Mon Sep 17 00:00:00 2001 From: Luc Date: Wed, 24 Apr 2024 16:25:28 -0400 Subject: [PATCH 2/5] renamed to HealTargetAllyAttr --- src/data/move.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/data/move.ts b/src/data/move.ts index ba1939bfe..df90ea0b5 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -1947,7 +1947,7 @@ export class PresentPowerAttr extends VariablePowerAttr { } } -export class ConditionalHealAttr extends VariablePowerAttr { +export class HealTargetAllyAttr extends VariablePowerAttr { apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { if((user.isPlayer() && target.isPlayer()) || (!user.isPlayer() && !target.isPlayer())){ @@ -1956,7 +1956,7 @@ export class ConditionalHealAttr extends VariablePowerAttr { Math.max(Math.floor(target.getMaxHp() / 2), 1), getPokemonMessage(target, ' regained\nhealth!'), true)); return true; } - + return false; } } @@ -5451,7 +5451,7 @@ export function initMoves() { new AttackMove(Moves.THROAT_CHOP, Type.DARK, MoveCategory.PHYSICAL, 80, 100, 15, 100, 0, 7) .partial(), new AttackMove(Moves.POLLEN_PUFF, Type.BUG, MoveCategory.SPECIAL, 90, 100, 15, -1, 0, 7) - .attr(ConditionalHealAttr) + .attr(HealTargetAllyAttr) .ballBombMove(), new AttackMove(Moves.ANCHOR_SHOT, Type.STEEL, MoveCategory.PHYSICAL, 80, 100, 20, -1, 0, 7) .attr(AddBattlerTagAttr, BattlerTagType.TRAPPED, false, false, 1), From 4ee5d0146f926ef2379c82c5c3dd6bb8df8087d2 Mon Sep 17 00:00:00 2001 From: Luc Date: Wed, 24 Apr 2024 16:40:43 -0400 Subject: [PATCH 3/5] reverted + made ConditionalHealAttr more robust --- src/data/move.ts | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/data/move.ts b/src/data/move.ts index df90ea0b5..289deb1b7 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -1947,16 +1947,25 @@ export class PresentPowerAttr extends VariablePowerAttr { } } -export class HealTargetAllyAttr extends VariablePowerAttr { +export class ConditionalHealAttr extends VariablePowerAttr { + private callback: (user: Pokemon, target: Pokemon, move: Move) => boolean; + private healRatio: number; + + constructor(callback: (user: Pokemon, target: Pokemon, move: Move) => boolean, healRatio?: number, showAnim?: boolean, selfTarget?: boolean) { + super(); + this.callback = callback; + this.healRatio = healRatio; + } + apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { - if((user.isPlayer() && target.isPlayer()) || (!user.isPlayer() && !target.isPlayer())){ + if (this.callback(user, target, move)) { (args[0] as Utils.NumberHolder).value = 0; target.scene.unshiftPhase(new PokemonHealPhase(target.scene, target.getBattlerIndex(), - Math.max(Math.floor(target.getMaxHp() / 2), 1), getPokemonMessage(target, ' regained\nhealth!'), true)); + Math.max(Math.floor(target.getMaxHp() * this.healRatio), 1), getPokemonMessage(target, ' regained\nhealth!'), true)); return true; } - + return false; } } @@ -5451,7 +5460,7 @@ export function initMoves() { new AttackMove(Moves.THROAT_CHOP, Type.DARK, MoveCategory.PHYSICAL, 80, 100, 15, 100, 0, 7) .partial(), new AttackMove(Moves.POLLEN_PUFF, Type.BUG, MoveCategory.SPECIAL, 90, 100, 15, -1, 0, 7) - .attr(HealTargetAllyAttr) + .attr(ConditionalHealAttr, (user, target, move) => (!user.isPlayer() && !target.isPlayer()) || (user.isPlayer() && target.isPlayer()) ? true : false, 0.5, true, false) .ballBombMove(), new AttackMove(Moves.ANCHOR_SHOT, Type.STEEL, MoveCategory.PHYSICAL, 80, 100, 20, -1, 0, 7) .attr(AddBattlerTagAttr, BattlerTagType.TRAPPED, false, false, 1), From 241f0d898a2bf11277f3c0642ad1e20a3a39baf4 Mon Sep 17 00:00:00 2001 From: Luc Date: Wed, 24 Apr 2024 16:42:02 -0400 Subject: [PATCH 4/5] removed unnecessary args --- src/data/move.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/data/move.ts b/src/data/move.ts index 289deb1b7..40e8afd91 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -1951,7 +1951,7 @@ export class ConditionalHealAttr extends VariablePowerAttr { private callback: (user: Pokemon, target: Pokemon, move: Move) => boolean; private healRatio: number; - constructor(callback: (user: Pokemon, target: Pokemon, move: Move) => boolean, healRatio?: number, showAnim?: boolean, selfTarget?: boolean) { + constructor(callback: (user: Pokemon, target: Pokemon, move: Move) => boolean, healRatio?: number) { super(); this.callback = callback; this.healRatio = healRatio; @@ -5460,7 +5460,7 @@ export function initMoves() { new AttackMove(Moves.THROAT_CHOP, Type.DARK, MoveCategory.PHYSICAL, 80, 100, 15, 100, 0, 7) .partial(), new AttackMove(Moves.POLLEN_PUFF, Type.BUG, MoveCategory.SPECIAL, 90, 100, 15, -1, 0, 7) - .attr(ConditionalHealAttr, (user, target, move) => (!user.isPlayer() && !target.isPlayer()) || (user.isPlayer() && target.isPlayer()) ? true : false, 0.5, true, false) + .attr(ConditionalHealAttr, (user, target, move) => (!user.isPlayer() && !target.isPlayer()) || (user.isPlayer() && target.isPlayer()) ? true : false, 0.5) .ballBombMove(), new AttackMove(Moves.ANCHOR_SHOT, Type.STEEL, MoveCategory.PHYSICAL, 80, 100, 20, -1, 0, 7) .attr(AddBattlerTagAttr, BattlerTagType.TRAPPED, false, false, 1), From 3dc8cc7f558b52a4c1cf2452a44540aa0fc40217 Mon Sep 17 00:00:00 2001 From: Luc Date: Thu, 25 Apr 2024 01:23:43 -0400 Subject: [PATCH 5/5] adjusted initial values of ConditionalHealAttr's optional params --- src/data/move.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data/move.ts b/src/data/move.ts index 40e8afd91..9e3c9a41a 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -1951,7 +1951,7 @@ export class ConditionalHealAttr extends VariablePowerAttr { private callback: (user: Pokemon, target: Pokemon, move: Move) => boolean; private healRatio: number; - constructor(callback: (user: Pokemon, target: Pokemon, move: Move) => boolean, healRatio?: number) { + constructor(callback: (user: Pokemon, target: Pokemon, move: Move) => boolean, healRatio: number = 0.5) { super(); this.callback = callback; this.healRatio = healRatio;