# HitHealAttr | pokemon-rogue-battle
Documentation for pokemon-rogue-battle

# Class HitHealAttr

Heals user as a side effect of a move that hits a target. Healing is based on `healRatio` * the amount of damage dealt or a stat of the target.

#### See

- `apply`
- `getUserBenefitScore`

#### Hierarchy (view full)

- MoveEffectAttr
  - HitHealAttr

- Defined in src/data/move.ts:1439

#####
Index

### Constructors

constructor

### Properties

firstHitOnly
healRatio
healStat
message
selfTarget
trigger

### Methods

apply
canApply
getCondition
getFailedText
getTargetBenefitScore
getUserBenefitScore

## Constructors

### constructor

- new HitHealAttr(healRatio?, healStat?): HitHealAttr

- #### Parameters

  - `Optional` healRatio: number
  - `Optional` healStat: Stat

  #### Returns HitHealAttr

  Overrides MoveEffectAttr.constructor

  - Defined in src/data/move.ts:1444

## Properties

### firstHitOnly

firstHitOnly: boolean

Should this effect only apply on the first hit?

Inherited from MoveEffectAttr.firstHitOnly

- Defined in src/data/move.ts:795

### `Private` healRatio

healRatio: number

- Defined in src/data/move.ts:1440

### `Private` healStat

healStat: Stat

- Defined in src/data/move.ts:1442

### `Private` message

message: string

- Defined in src/data/move.ts:1441

### selfTarget

selfTarget: boolean

Should this `Move` target the user?

Inherited from MoveEffectAttr.selfTarget

- Defined in src/data/move.ts:718

### trigger

trigger: MoveEffectTrigger

Defines when this effect should trigger in the move's effect order

#### See

MoveEffectPhase.start

Inherited from MoveEffectAttr.trigger

- Defined in src/data/move.ts:793

## Methods

### apply

- apply(user, target, move, args): boolean

- Heals the user the determined amount and possibly displays a message about regaining health. If the target has the `ReverseDrainAbAttr`, all healing is instead converted to damage to the user.

  #### Parameters

  - user: default

    `Pokemon` using this move

  - target: default

    `Pokemon` target of this move

  - move: default

    `Move` being used

  - args: any[]

    N/A

  #### Returns boolean

  true if the function succeeds

  Overrides MoveEffectAttr.apply

  - Defined in src/data/move.ts:1460

### canApply

- canApply(user, target, move, args): boolean

- Determines whether the `Move`'s effects are valid to `apply`

  #### Parameters

  - user: default

    `Pokemon` using the move

  - target: default

    `Pokemon` target of the move

  - move: default

    `Move` with this attribute

  - args: any[]

    Set of unique arguments needed by this attribute

  #### Returns boolean

  true if basic application of the ability attribute should be possible

  Inherited from MoveEffectAttr.canApply

  - Defined in src/data/move.ts:812

### getCondition

- getCondition(): MoveCondition | MoveConditionFunc

- #### Returns MoveCondition | MoveConditionFunc

  the `MoveCondition` or MoveConditionFunc for this `Move`

  Inherited from MoveEffectAttr.getCondition

  - Defined in src/data/move.ts:742

### getFailedText

- getFailedText(user, target, move, cancelled): string

- #### Parameters

  - user: default

    `Pokemon` using the move

  - target: default

    `Pokemon` target of the move

  - move: default

    `Move` with this attribute

  - cancelled: BooleanHolder

    `Utils.BooleanHolder` which stores if the move should fail

  #### Returns string

  the string representing failure of this `Move`

  Inherited from MoveEffectAttr.getFailedText

  - Defined in src/data/move.ts:754

### getTargetBenefitScore

- getTargetBenefitScore(user, target, move): number

- Used by the Enemy AI to rank an attack based on a given target

  #### Parameters

  - user: default
  - target: default
  - move: default

  #### Returns number

  #### See

  `EnemyPokemon.getNextMove`

  Inherited from MoveEffectAttr.getTargetBenefitScore

  - Defined in src/data/move.ts:772

### getUserBenefitScore

- getUserBenefitScore(user, target, move): number

- Used by the Enemy AI to rank an attack based on a given user

  #### Parameters

  - user: default

    `Pokemon` using this move

  - target: default

    `Pokemon` target of this move

  - move: default

    `Move` being used

  #### Returns number

  an integer. Higher means enemy is more likely to use that move.

  Overrides MoveEffectAttr.getUserBenefitScore

  - Defined in src/data/move.ts:1489