Fully implemented floral healing (#250)
* Created BoostedHealAttr and implemented Floral Healing * Update move.ts --------- Co-authored-by: Benjamin Odom <bennybroseph@gmail.com>pull/281/merge
parent
21a0a0276d
commit
3cc990f5d2
|
@ -824,7 +824,7 @@ export class HealAttr extends MoveEffectAttr {
|
|||
|
||||
addHealPhase(target: Pokemon, healRatio: number) {
|
||||
target.scene.unshiftPhase(new PokemonHealPhase(target.scene, target.getBattlerIndex(),
|
||||
Math.max(Math.floor(target.getMaxHp() * healRatio), 1), getPokemonMessage(target, ' regained\nhealth!'), true, !this.showAnim));
|
||||
Math.max(Math.floor(target.getMaxHp() * healRatio), 1), getPokemonMessage(target, ' \nhad its HP restored.'), true, !this.showAnim));
|
||||
}
|
||||
|
||||
getTargetBenefitScore(user: Pokemon, target: Pokemon, move: Move): integer {
|
||||
|
@ -962,6 +962,42 @@ export class SandHealAttr extends WeatherHealAttr {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Heals the target by either {@link normalHealRatio} or {@link boostedHealRatio}
|
||||
* depending on the evaluation of {@link condition}
|
||||
* @see {@link apply}
|
||||
* @param user The Pokemon using this move
|
||||
* @param target The target Pokemon of this move
|
||||
* @param move This move
|
||||
* @param args N/A
|
||||
* @returns if the move was successful
|
||||
*/
|
||||
export class BoostHealAttr extends HealAttr {
|
||||
private normalHealRatio?: number;
|
||||
private boostedHealRatio?: number;
|
||||
private condition?: MoveConditionFunc;
|
||||
|
||||
/**
|
||||
* @param normalHealRatio Healing received when {@link condition} is false
|
||||
* @param boostedHealRatio Healing received when {@link condition} is true
|
||||
* @param showAnim Should a healing animation be showed?
|
||||
* @param selfTarget Should the move target the user?
|
||||
* @param condition The condition to check against when boosting the healing value
|
||||
*/
|
||||
constructor(normalHealRatio?: number, boostedHealRatio?: number, showAnim?: boolean, selfTarget?: boolean, condition?: MoveConditionFunc) {
|
||||
super(normalHealRatio, showAnim, selfTarget);
|
||||
this.normalHealRatio = normalHealRatio;
|
||||
this.boostedHealRatio = boostedHealRatio;
|
||||
this.condition = condition;
|
||||
}
|
||||
|
||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||
const healRatio = this.condition(user, target, move) ? this.boostedHealRatio : this.normalHealRatio;
|
||||
this.addHealPhase(target, healRatio);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
export class HitHealAttr extends MoveEffectAttr {
|
||||
private healRatio: number;
|
||||
|
||||
|
@ -5977,9 +6013,8 @@ export function initMoves() {
|
|||
.attr(StatChangeAttr, BattleStat.SPD, -1, true)
|
||||
.punchingMove(),
|
||||
new StatusMove(Moves.FLORAL_HEALING, Type.FAIRY, -1, 10, -1, 0, 7)
|
||||
.attr(HealAttr, 0.5, true, false)
|
||||
.triageMove()
|
||||
.partial(),
|
||||
.attr(BoostHealAttr, 0.5, 2/3, true, false, (user, target, move) => user.scene.arena.terrain?.terrainType === TerrainType.GRASSY)
|
||||
.triageMove(),
|
||||
new AttackMove(Moves.HIGH_HORSEPOWER, Type.GROUND, MoveCategory.PHYSICAL, 95, 95, 10, -1, 0, 7),
|
||||
new StatusMove(Moves.STRENGTH_SAP, Type.GRASS, 100, 10, 100, 0, 7)
|
||||
.attr(StrengthSapHealAttr)
|
||||
|
|
Loading…
Reference in New Issue