# Rules: Editing Wild Pokemon

These are rules related to editing certain attributes on wild Pokemon to customize encounters.

<details>

<summary><mark style="background-color:green;"><strong>"editWildPokemon"</strong></mark></summary>

You can use this rule to edit various attributes of wild Pokemon prior to initiating battle. This allows you to customize their Natures, IV's, shinyness, and more. In double or triple wild battles, this only edits the attributes of the primary wild Pokemon that appears in the first slot.\
\
This is entered as `setBattleRule("editWildPokemon", Attributes)`, where "Attributes" is a hash containing all the settings you want to apply to the wild Pokemon. More details on this found below.

</details>

<details>

<summary><mark style="background-color:green;"><strong>"editWildPokemon2"</strong></mark></summary>

This rule functions identically to <mark style="background-color:green;">"editWildPokemon"</mark>, ​accept this rule only edits the attributes of the second wild Pokemon in a double or triple battle.

</details>

<details>

<summary><mark style="background-color:green;"><strong>"editWildPokemon3"</strong></mark></summary>

This rule functions identically to <mark style="background-color:green;">"editWildPokemon"</mark>, accept this rule only edits the attributes of the third wild Pokemon in a triple battle.

</details>

***

Here are all of the possible attributes you may set in a hash for any of the above rules:

<table><thead><tr><th width="145">Key</th><th width="197" align="center">Value</th><th>Description</th></tr></thead><tbody><tr><td><mark style="background-color:yellow;">:species</mark></td><td align="center">Species ID</td><td>Changes the species of the wild Pokemon.</td></tr><tr><td><mark style="background-color:yellow;">:form</mark></td><td align="center">Integer</td><td>Sets the form of the wild Pokemon.</td></tr><tr><td><mark style="background-color:yellow;">:form_simple</mark></td><td align="center">Integer</td><td>Sets the form of the wild Pokemon. Use this instead of <mark style="background-color:yellow;">:form</mark> to skip the move learning prompt for species like Rotom.</td></tr><tr><td><mark style="background-color:yellow;">:name</mark></td><td align="center">String</td><td>Sets the nickname of the wild Pokemon.</td></tr><tr><td><mark style="background-color:yellow;">:level</mark></td><td align="center">Integer</td><td>Sets the level of the wild Pokemon.</td></tr><tr><td><mark style="background-color:yellow;">:gender</mark></td><td align="center">Integer</td><td>Sets the gender of the wild Pokemon (0 = Male, 1 = Female).</td></tr><tr><td><mark style="background-color:yellow;">:hp</mark></td><td align="center">Integer</td><td>Sets the HP of the wild Pokemon (out of its total HP).</td></tr><tr><td><mark style="background-color:yellow;">:status</mark></td><td align="center">Status ID</td><td>Sets the status condition of the wild Pokemon.</td></tr><tr><td><mark style="background-color:yellow;">:statusCount</mark></td><td align="center">Integer</td><td>Sets the status counter of the wild Pokemon (for Sleep and Poison).</td></tr><tr><td><mark style="background-color:yellow;">:shiny</mark></td><td align="center">Boolean</td><td>Sets whether this wild Pokemon should be shiny or not.</td></tr><tr><td><mark style="background-color:yellow;">:super_shiny</mark></td><td align="center">Boolean</td><td>Sets whether this wild Pokemon should be super shiny or not.</td></tr><tr><td><mark style="background-color:yellow;">:nature</mark></td><td align="center">Nature ID</td><td>Sets the Nature of the wild Pokemon.</td></tr><tr><td><mark style="background-color:yellow;">:item</mark></td><td align="center">Item ID</td><td>Sets the Item of the wild Pokemon.</td></tr><tr><td><mark style="background-color:yellow;">:mail</mark></td><td align="center">Mail Object</td><td>Sets the held mail of the wild Pokemon. You must create the mail object prior to this rule.</td></tr><tr><td><mark style="background-color:yellow;">:ability</mark></td><td align="center">Ability ID</td><td>Sets the Ability of the wild Pokemon.</td></tr><tr><td><mark style="background-color:yellow;">:ability_index</mark></td><td align="center">Integer</td><td>Sets the Ability index of the wild Pokemon.</td></tr><tr><td><mark style="background-color:yellow;">:moves</mark></td><td align="center">Move ID (or Array)</td><td>Sets the moves this wild Pokemon will have.</td></tr><tr><td><mark style="background-color:yellow;">:ribbons</mark></td><td align="center">Ribbon ID (or Array)</td><td>Sets the ribbons this wild Pokemon will have.</td></tr><tr><td><mark style="background-color:yellow;">:pokerus</mark></td><td align="center">Boolean</td><td>Sets whether the wild Pokemon will have Pokerus or not.</td></tr><tr><td><mark style="background-color:yellow;">:happiness</mark></td><td align="center">Integer</td><td>Sets the happiness level of this wild Pokemon (0-255).</td></tr><tr><td><mark style="background-color:yellow;">:iv</mark></td><td align="center">Integer, Array or Hash</td><td>Sets the IV's of the wild Pokemon.<br>When set as an integer, all of the Pokemon's IV's are set to the same number.<br>When set as an array, each of the Pokemon's IV's are set to the number in the array (in PBS stat order).<br>When set as a hash, directly sets the IV's of each stat ID in the hash.</td></tr><tr><td><mark style="background-color:yellow;">:ev</mark></td><td align="center">Integer, Array or Hash</td><td>Sets the EV's of the wild Pokemon.<br>When set as an integer, all of the Pokemon's EV's are set to the same number.<br>When set as an array, each of the Pokemon's EV's are set to the number in the array (in PBS stat order).<br>When set as a hash, directly sets the EV's of each stat ID in the hash.</td></tr><tr><td><mark style="background-color:yellow;">:obtain_text</mark></td><td align="center">String</td><td>Sets the met location text that will appear in the memo page of the Summary once this wild Pokemon has been captured.</td></tr></tbody></table>

***

Example:

```
setBattleRule("editWildPokemon", {
  :name    => "Sparky",
  :shiny   => true,
  :ability => :VOLTABSORB,
  :item    => :LIGHTBALL,
  :nature  => :HASTY,
  :moves   => [:VOLTTACKLE, :SURF, :WISH, :ENCORE],
  :iv      => 31
})
WildBattle.start(:PIKACHU, 35)
```

***

<mark style="background-color:orange;">**Exclusive Attributes for Supported Plugins**</mark>

{% tabs %}
{% tab title="Enhanced Pokemon UI" %}

<table><thead><tr><th width="129">Key</th><th width="146" align="center">Value</th><th>Description</th></tr></thead><tbody><tr><td><mark style="background-color:yellow;">:shiny_leaf</mark></td><td align="center">Integer (0-6)</td><td>Sets a number of shiny leaves on the wild Pokemon. Six leaves will apply a shiny leaf crown.</td></tr></tbody></table>
{% endtab %}

{% tab title="Improved Mementos" %}

<table><thead><tr><th width="124.66666666666666">Key</th><th width="167" align="center">Value</th><th>Description</th></tr></thead><tbody><tr><td><mark style="background-color:yellow;">:memento</mark></td><td align="center">Ribbon or Mark ID</td><td>Sets the memento that should be adorned on this wild Pokemon. If the memento has a title, that title will be automatically given to the Pokemon.</td></tr><tr><td><mark style="background-color:yellow;">:scale</mark></td><td align="center">Integer (0-255)</td><td>Sets the size of the wild Pokemon, where 0 is the smallest and 255 is the largest. </td></tr></tbody></table>
{% endtab %}

{% tab title="Dynamax" %}

<table><thead><tr><th width="168">Key</th><th width="139" align="center">Value</th><th>Description</th></tr></thead><tbody><tr><td><mark style="background-color:yellow;">:dynamax_able</mark></td><td align="center">Boolean</td><td>Toggles whether the wild Pokemon is capable of using Dynamax.</td></tr><tr><td><mark style="background-color:yellow;">:dynamax_lvl</mark></td><td align="center">Integer (0-10)</td><td>Sets the Dynamax level of the wild Pokemon.</td></tr><tr><td><mark style="background-color:yellow;">:gmax_factor</mark></td><td align="center">Boolean</td><td>Sets whether the wild Pokemon has G-Max Factor.</td></tr><tr><td><mark style="background-color:yellow;">:dynamax</mark></td><td align="center">Boolean</td><td>Sets whether the wild Pokemon is Dynamaxed.</td></tr></tbody></table>
{% endtab %}

{% tab title="Terastallization" %}

<table><thead><tr><th width="154">Key</th><th width="112" align="center">Value</th><th>Description</th></tr></thead><tbody><tr><td><mark style="background-color:yellow;">:terastal_able</mark></td><td align="center">Boolean</td><td>Toggles whether the wild Pokemon is capable of using Terastallization.</td></tr><tr><td><mark style="background-color:yellow;">:tera_type</mark></td><td align="center">Type ID</td><td>Sets the Tera type of the wild Pokemon.</td></tr><tr><td><mark style="background-color:yellow;">:terastallized</mark></td><td align="center">Boolean</td><td>Sets whether the wild Pokemon is Terastallized.</td></tr></tbody></table>
{% endtab %}
{% endtabs %}
