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

# Class SacrificialAttrOnHit

Attribute used for moves which self KO the user but only if the move hits a target

#### See

`apply`

#### Hierarchy (View Summary)

- MoveEffectAttr
  - SacrificialAttrOnHit

- Defined in src/data/moves/move.ts:1698

##### Index

### Constructors

constructor

### Properties

options?
selfTarget

### Accessors

effectChanceOverride
firstHitOnly
firstTargetOnly
lastHitOnly
trigger

### Methods

apply
canApply
getCondition
getFailedText
getMoveChance
getTargetBenefitScore
getUserBenefitScore

## Constructors

### constructor

- new SacrificialAttrOnHit(): SacrificialAttrOnHit

  #### Returns SacrificialAttrOnHit

  Overrides MoveEffectAttr.constructor

  - Defined in src/data/moves/move.ts:1699

## Properties

### `Protected` `Optional` options

options?: MoveEffectAttrOptions

A container for this attribute's optional parameters

#### See

MoveEffectAttrOptions for supported params.

Inherited from MoveEffectAttr.options

- Defined in src/data/moves/move.ts:1154

### selfTarget

selfTarget: boolean

Should this `Move` target the user?

Inherited from MoveEffectAttr.selfTarget

- Defined in src/data/moves/move.ts:1071

## Accessors

### effectChanceOverride

- get effectChanceOverride(): undefined | number

  If defined, overrides the move's base chance for this secondary effect to trigger.

  #### Returns undefined | number

  Inherited from MoveEffectAttr.effectChanceOverride

  - Defined in src/data/moves/move.ts:1201

### firstHitOnly

- get firstHitOnly(): boolean

  `true` if this effect should only trigger on the first hit of multi-hit moves.

  #### Returns boolean

  #### Default

      false

  Inherited from MoveEffectAttr.firstHitOnly

  - Defined in src/data/moves/move.ts:1175

### firstTargetOnly

- get firstTargetOnly(): boolean

  `true` if this effect should apply only upon hitting a target for the first time when targeting multiple `Pokemon`.

  #### Returns boolean

  #### Default

      false

  Inherited from MoveEffectAttr.firstTargetOnly

  - Defined in src/data/moves/move.ts:1193

### lastHitOnly

- get lastHitOnly(): boolean

  `true` if this effect should only trigger on the last hit of multi-hit moves.

  #### Returns boolean

  #### Default

      false

  Inherited from MoveEffectAttr.lastHitOnly

  - Defined in src/data/moves/move.ts:1184

### trigger

- get trigger(): MoveEffectTrigger

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

  #### Returns MoveEffectTrigger

  #### Default

      MoveEffectTrigger.POST_APPLY

  #### See

  `MoveEffectTrigger`

  Inherited from MoveEffectAttr.trigger

  - Defined in src/data/moves/move.ts:1166

## Methods

### apply

- apply(user: default , target: default , move: default , args: any[]): boolean

  Deals damage to the user equal to their current hp if the move lands

  #### Parameters

  - user: default

    `Pokemon` that used the move

  - target: default

    `Pokemon` target of the move

  - move: default

    `Move` with this attribute

  - args: any[]

    N/A

  #### Returns boolean

  true if the function succeeds

  Overrides MoveEffectAttr.apply

  - Defined in src/data/moves/move.ts:1711

### canApply

- canApply(user: default , target: default , move: default , args?: any[]): 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

  - `Optional` 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/moves/move.ts:1214

### getCondition

- getCondition(): null | MoveCondition | MoveConditionFunc

  #### Returns null | MoveCondition | MoveConditionFunc

  the `MoveCondition` or MoveConditionFunc for this `Move`

  Inherited from MoveEffectAttr.getCondition

  - Defined in src/data/moves/move.ts:1095

### getFailedText

- getFailedText(user: default , target: default , move: default ): undefined | string

  #### Parameters

  - user: default

    `Pokemon` using the move

  - target: default

    `Pokemon` target of the move

  - move: default

    `Move` with this attribute

  #### Returns undefined | string

  the string representing failure of this `Move`

  Inherited from MoveEffectAttr.getFailedText

  - Defined in src/data/moves/move.ts:1106

### getMoveChance

- getMoveChance(
  user: default ,
  target: default ,
  move: default ,
  selfEffect?: Boolean,
  showAbility?: Boolean,
  ): number

  Gets the used move's additional effect chance. Chance is modified by `MoveEffectChanceMultiplierAbAttr` and `IgnoreMoveEffectsAbAttr`.

  #### Parameters

  - user: default

    `Pokemon` using this move

  - target: default

    `Target` of this move

  - move: default

    `Move` being used

  - `Optional` selfEffect: Boolean

    `true` if move targets user.

  - `Optional` showAbility: Boolean

  #### Returns number

  Move effect chance value.

  Inherited from MoveEffectAttr.getMoveChance

  - Defined in src/data/moves/move.ts:1234

### getTargetBenefitScore

- getTargetBenefitScore(user: default , target: default , move: default ): 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/moves/move.ts:1124

### getUserBenefitScore

- getUserBenefitScore(user: default , target: default , move: default ): number

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

  #### Parameters

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

  #### Returns number

  #### See

  `EnemyPokemon.getNextMove`

  Overrides MoveEffectAttr.getUserBenefitScore

  - Defined in src/data/moves/move.ts:1723