# Animated: Mid-Battle Scripting

<mark style="background-color:orange;">**Command Keys**</mark>

These are keys which trigger certain actions related to animated Pokemon sprites.

<details>

<summary><mark style="background-color:blue;">"spriteSpeed"</mark> => <mark style="background-color:yellow;">Integer</mark></summary>

Forces a battler's sprite to animate at the entered speed. This must be set to an integer ranging from 0-4.

* 0: No animation (static sprite)
* 1: Fast animation
* 2: Normal animation
* 3: Slow animation
* 4: Very slow animation

</details>

<details>

<summary><mark style="background-color:blue;">"spriteReverse"</mark> => <mark style="background-color:yellow;">Boolean</mark></summary>

Forces a battler's sprite to begin animating backwards. This must be set to either `true` to begin animating in reverse, or `false` to return to its original animation.

</details>

<details>

<summary><mark style="background-color:blue;">"spriteHue"</mark> => <mark style="background-color:yellow;">Integer</mark></summary>

Forces a battler's sprite to change hue. This must be set to a number ranging from -255 to 255 to set the desired hue.

</details>

***

<mark style="background-color:orange;">**Hardcoding**</mark>

Here's a list of methods and/or properties that you might want to reference when hardcoding a midbattle script, since this plugin adds a lot of new custom content which you may need to call on to make certain things happen:

<details>

<summary>GameData::Species</summary>

* `has_gendered_sprites?`\
  Returns true if the species has the `"HasGenderedSprites"` flag, which is automatically assigned if the species has female-exclusive sprites that aren't tied to a form.<br>
* `shows_shadow?(back = false)`\
  Returns true if the species' sprites should cast a viewable shadow. This will only return false when a species has its `ShadowSize` metrics set to 0, or if `back` is true and the `SHOW_PLAYER_SIDE_SHADOW_SPRITES` plugin setting is disabled.

</details>

<details>

<summary>GameData::SpeciesMetrics</summary>

* `back_sprite_scale`\
  Returns the scaling applied to a species' back sprite.<br>
* `front_sprite_scale`\
  Returns the scaling applied to a species' front sprite.<br>
* `back_sprite_speed`\
  Returns the animation speed applied to a species' back sprite.<br>
* `front_sprite_speed`\
  Returns the animation speed applied to a species' front sprite.<br>
* `sprite_super_hue`\
  Returns the Super Shiny hue applied to a species' sprites.<br>
* `get_random_hue`\
  Re-randomizes the Super Shiny hue applied to a species' sprites if one has not been set.<br>
* `shows_shadow?(back = false)`\
  Returns true if the species' sprites should cast a viewable shadow. This will only return false when a species has its `ShadowSize` metrics set to 0, or if `back` is true and the `SHOW_PLAYER_SIDE_SHADOW_SPRITES` plugin setting is disabled.

</details>

<details>

<summary>Battle::Scene class</summary>

* `pbGetBattlerSprites(idxBattler)`\
  Returns the sprite and shadow sprite objects of the bounder found at the index idxBattler.<br>
* `pbAnimateSubstitute(idxBattler, mode, delay = false)`\
  Animates the Substitute doll for the battler found at the index `idxBattler`. Details on this method can be found in the "Dynamic Sprite Effects" subsection in the write-up related to the Substitute Doll. <br>
* `pbUpdateSubstituteSprite(battler, mode)`\
  Updates the state of the Substitute doll for the battler found at the index `idxBattler`, but without playing any animations. The mode argument functions the same way as it does for the `pbAnimateSubstitute` method.

</details>

<details>

<summary>Battle::Battler class</summary>

* `airborneOffScreen?`\
  Returns true if the battler's sprite is currently hidden due to being in the middle of a two-turn attack that sends the user airborne (Fly, Bounce, Sky Drop).<br>
* `vanishedOffScreen?(ignoreAirborne = false)`\
  Returns true if the battler's sprite is currently hidden due to being in the middle of a two-turn attack that puts the user in a semi-invulnerable state. If `ignoreAirborne` is true, this will not return true if the battler's shadow is still visible due to being airborne during their semi-invulnerable phase.

</details>

<details>

<summary>Battle::Scene::BattlerSprite class</summary>

* `speed`\
  Sets the animation speed of a battler's sprite, overriding its natural speed. This can be a value ranging from 0-4.<br>
* `reversed`\
  Toggles whether the battler's sprite should animate in reverse or not. This is set to false by default.<br>
* `hue`\
  Sets the hue of a battler's sprite. This can be a value ranging from -255 to 255. This cannot be overwritten if the battler's hue is already being altered due to being Super Shiny.

</details>
