diff --git a/src/data/move.ts b/src/data/move.ts index 7d581cb42..1f8fad2c0 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -1807,6 +1807,28 @@ export class StatChangeCountPowerAttr extends VariablePowerAttr { } } +export class PresentPowerAttr extends VariablePowerAttr { + apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean { + + const powerSeed = Utils.randSeedInt(100); + if (powerSeed <= 40) { + (args[0] as Utils.NumberHolder).value = 40; + } + else if (40 < powerSeed && powerSeed <= 70) { + (args[0] as Utils.NumberHolder).value = 80; + } + else if (70 < powerSeed && powerSeed <= 80) { + (args[0] as Utils.NumberHolder).value = 120; + } + else if (80 < powerSeed && powerSeed <= 100) { + target.scene.unshiftPhase(new PokemonHealPhase(target.scene, target.getBattlerIndex(), + Math.max(Math.floor(target.getMaxHp() / 4), 1), getPokemonMessage(target, ' regained\nhealth!'), true)); + } + + return true; + } +} + export class VariableAtkAttr extends MoveAttr { constructor() { super(); @@ -3973,7 +3995,8 @@ export function initMoves() { .target(MoveTarget.USER_AND_ALLIES), new AttackMove(Moves.RETURN, "Return", Type.NORMAL, MoveCategory.PHYSICAL, -1, 100, 20, "This full-power attack grows more powerful the more the user likes its Trainer.", -1, 0, 2) .attr(FriendshipPowerAttr), - new AttackMove(Moves.PRESENT, "Present (N)", Type.NORMAL, MoveCategory.PHYSICAL, -1, 90, 15, "The user attacks by giving the target a gift with a hidden trap. It restores HP sometimes, however.", -1, 0, 2) + new AttackMove(Moves.PRESENT, "Present", Type.NORMAL, MoveCategory.PHYSICAL, -1, 90, 15, "The user attacks by giving the target a gift with a hidden trap. It restores HP sometimes, however.", -1, 0, 2) + .attr(PresentPowerAttr) .makesContact(false), new AttackMove(Moves.FRUSTRATION, "Frustration", Type.NORMAL, MoveCategory.PHYSICAL, -1, 100, 20, "This full-power attack grows more powerful the less the user likes its Trainer.", -1, 0, 2) .attr(FriendshipPowerAttr, true), diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 6b394d53b..bf7073ad0 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -1299,6 +1299,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container { applyMoveAttrs(ModifiedDamageAttr, source, this, move, damage); + if (power.value === 0) { + damage.value = 0; + } + console.log('damage', damage.value, move.name, power.value, sourceAtk, targetDef); if (damage.value) {