# Dynamax: Move Data

When a Pokemon Dynamaxes, all of its base moves are replaced with Max Moves. The specific Max Moves the Pokemon's moves convert into depends on the type of the original move. In this subsection, I'll go over everything related to Max Moves as well as other move data related to Dynamax.

***

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

Upon installing the plugin for the first time, you *must* recompile your game. This is not an optional step. This will update all of your relevant PBS files with the necessary data. If you're unaware of how to recompile your game, simply hold down the `CTRL` key while the game is loading in debug mode and the game window is in focus.

<details>

<summary>Installation Details</summary>

If done correctly, your game should recompile. However, you will also notice lines of yellow text above the recompiled files, like this:

<img src="https://2153694798-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvzqYxbzoSOVtGkOgfRUQ%2Fuploads%2FlTHKCd1qWKU4U5OfrAnt%2FCapture.JPG?alt=media&#x26;token=0e84aca6-15d3-45e0-af2d-e7fab6fead62" alt="Yellow text in the debug console." data-size="original">

This indicates that the appropriate data have been added to the following PBS files:

* `map_metadata.txt`
* `moves.txt`
* `pokemon.txt`
* `pokemon_forms.txt`
* `pokemon_metrics.txt`
* `pokemon_metrics_Gen_9_Pack.txt` (if the Gen 9 Pack is installed)

Most of these changes will only occur the first time you install the plugin. If you for whatever reason ever need to re-apply the data this plugin adds to these PBS files, you can force this to happen again by holding the `SHIFT` key while loading your game in debug mode. This will recompile all your plugins, and the data will be re-added by this plugin as if it was your first time installing.

</details>

In addition to the changes made to existing files, this plugin adds several new PBS files.

* `items_dynamax.txt`
* `moves_dynamax.txt`
* `pokemon_forms_gmax.txt`
* `pokemon_metrics_gmax.txt`

The `moves_dynamax.txt` file is where all of the Max Moves introduced by this plugin are stored. If you're adding any of your own custom Max Moves, you may do so there.

***

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

When a Pokemon is Dynamaxed, all of their base moves that deal damage are converted into Max Moves based on the type of each move. Any of the user's status moves are instead converted into the move Max Guard.

If the Pokemon is Gigantamaxed however, then moves of a specific type may be converted into a G-Max Move instead. G-Max Moves are functionally identical to a Max Move, except they often have unique effects instead of the typical Max Move of that type.

Below, I'll go over each kind of Max Move and how they are set up.

<details>

<summary>Max Moves</summary>

Each of the 18 base types in the game have their own corresponding generic Max Move that any offensive move of that type will be converted into when Dynamaxed. For example, when a Pokemon is Dynamaxed, all of its damaging-dealing Normal-type moves will be converted into the Max Move known as Max Strike.

```
[MAXSTRIKE]
Name = Max Strike
Type = NORMAL
Category = Physical
Power = 1
Accuracy = 0
TotalPP = 1
Target = NearFoe
FunctionCode = LowerTargetSideSpeed1
Flags = DynamaxMove_NORMAL,CannotMetronome
Description = A Normal-type attack Dynamax Pokémon use. This lowers the target's Speed stat.
```

Here's an example of how Max Strike is set up in the `moves_dynamax.txt` PBS file. This is mostly set up like any other move, but there are a few key things to note:

* The `Category` you set for any Max Move ***doesn't matter***. By default, all of them are set to Physical. However, in practice, what you set doesn't make any difference since the category will always be inherited from the base move.
* Generic Max Moves ***must*** have a `Power` of 1. This is what allows the move's power to scale depending on what the base move was. For example, if converting a high base power move like Hyper Beam into this Max Move, it'll have a much higher power than if the base move was Tackle.
* All Max Moves ***must*** have an `Accuracy` of 0. This allows it to ignore Accuracy checks.
* The `TotalPP` set for any Max Move ***doesn't matter***. This is because the PP for each Max Move will always be inherited from the base move.
* All Max Moves ***must*** have the `CannotMetronome` flag.
* Generic Max Moves ***must*** have the `DynamaxMove_TYPE` flag, where `TYPE` is the ID of the specific type of move this Max Move will replace. This type should ***always*** be the same type as the Max Move's type.

***

<mark style="background-color:yellow;">**Max Guard**</mark>

Instead of converting into a generic Max Move when Dynamaxed, all of the user's status moves will instead be converted into the move Max Guard. This is a unique Max Move that functions as a Protect move. However, unlike other Protect variants, this move will even block the effects of other Max Moves, which other Protect moves cannot fully negate.

However, there is a small list of moves that may bypass Max Guard. Any status move with the function code `TrapTargetInBattle` will not be blocked by Max Guard. By default, these moves include:

* Mean Look
* Block
* Spider Web

In addition, any move with the function code `RemoveProtections` will hit through Max Guard. However, this will not remove the protection effect of Max Guard, unlike when used on other protection moves. Similarly, any move with the function code `IgnoreProtections` will also bypass Max Guard entirely. By default, these moves include:

* Feint
* G-Max One Blow
* G-Max Rapid Flow

Finally, any move that is given the flag `IgnoresMaxGuard` will be able to fully ignore Max Guard's protection, too. Here's a list of all moves that are given this flag by default:

* Decorate
* Role Play
* Perish Song

Any other move not listed above as exceptions will be fully negated by Max Guard, even if they would normally hit through Protect, such as Hyper Drill or Mighty Cleave. If you want to allow a move to bypass Max Guard, you simply have to give it the `IgnoresMaxGuard` flag.

</details>

<details>

<summary>G-Max Moves</summary>

Some Max Moves are exclusive to certain species that are only available when that species is in Gigantamax form. This variant of Max Moves are known as G-Max Moves. For example, when a Rillaboom with G-Max Factor uses Dynamax, it will instead enter its Gigantamax form and its damage-dealing Grass-type moves will all be converted to the the exclusive G-Max Move known as G-Max Drum Solo.

```
[GMAXDRUMSOLO]
Name = G-Max Drum Solo
Type = GRASS
Category = Physical
Power = 160
Accuracy = 0
TotalPP = 1
Target = NearFoe
FunctionCode = IgnoreTargetAbility
Flags = GmaxMove,CannotMetronome
Description = A G-Max Move used by G-Max Rillaboom. Ignores opponent's Abilities that would reduce damage.
```

Here's an example of how G-Max Drum Solo is set up in the `moves_dynamax.txt` PBS file. This is mostly set up like a generic Max Move, but there are a few key things to note:

* Unlike generic Max Moves, exclusive G-Max Moves ***can*** have a set `Power`, if you wish. Certain G-Max Moves such as this one have a set power regardless of what the base move's power was. If you set it to 1 however, its power will scale like generic Max Moves do.
* Unlike generic Max Moves, exclusive G-Max Moves ***must*** have the `GmaxMove` flag without a type ID attached.

Now that we have an example of an exclusive G-Max Move, we need to actually give this move to a Gigantamax form to allow that form to use it. This is done by entering this move ID in the PBS data in that form's entry by using the `GmaxMove` field.

```
[RILLABOOM,1]
FormName = Gigantamax
Height = 28.0
Pokedex = Gigantamax energy has caused Rillaboom's stump to grow into a drum set that resembles a forest.
GmaxMove = GMAXDRUMSOLO
```

As seen here, Rillaboom's G-Max form has the field `GmaxMove = GMAXDRUMSOLO`. This is what allows it to have this exclusive G-Max Move replace its other Grass-type moves when it enters Gigantamax form. More details on how to set up these forms can be found in the subsection "Dynamax: Form Data."

</details>

<details>

<summary>Max Move power scaling</summary>

All Max Moves that have a `Power` set to 1 in their PBS data will scale their damage based on the power of the base move that is being converted into that Max Move. This converted power can never be higher than 150, and never lower than 90.

However, there are exceptions to this. Certain types of Max Moves actually have their converted power reduced due to the fact that the effects of these moves would be too powerful if combined with a high-powered move. For example, Fighting-type moves converted into Max Knuckle would increase the Attack stat of the user and their allies after each use. If this was stacked on top of a high base power, this would be absurdly strong.

To address this, Game Freak implemented a feature where Fighting-type and Poison-type Max Moves will significantly tone down the way these types of Max Moves scale their power in comparison to other types. For these types of moves, the converted power can never be higher than 100, and never lower than 70.

This mechanic has been replicated by this plugin. However, you have the ability to completely customize which types of Max Moves will be scaled down, and which types won't. This is handled with the plugin setting `DYNAMAX_TYPES_TO_WEAKEN`.

This setting is an array which can contain any number of type ID's you'd like. Any type ID entered here will have their power scaling reduced when converted into a Max Move. By default, the only types entered here are `:FIGHTING` and `:POISON`, to mirror how this worked in Sword & Shield. But you're free to add or remove whichever types you want in this array if you'd like to customize the way certain types scale their power as Max Moves.

</details>

<details>

<summary>Coding custom Max Move effects</summary>

If you decide you want to create your own custom Max Move that have some sort of effect, this is done the same way you would code the move function for any other regular move. However, there is one key difference. A typical battle move is defined in the class `Battle::Move`. All Max Moves however use a subclass of this called `Battle::DynamaxMove`.

This means that when you are coding a move function, this is the class you need to use, rather than `Battle::Move`. For example, here's the move function for Max Guard:

```ruby
class Battle::DynamaxMove::ProtectUserEvenFromDynamaxMoves < Battle::Move::ProtectMove
  def initialize(battle, move)
    super
    @effect = PBEffects::MaxGuard
  end
end
```

You'll see that `class Battle::DynamaxMove` is what's used here prior to the move's function code. This is required for Max Moves. However, Max Moves can access everything from the normal `Battle::Move` class, so you can still use this as a subclass as needed.

Because of this, it's possible to just inherit all of the attributes of a regular move's function code. As shown in the above example, Max Guard uses the subclass `Battle::Move::ProtectMove`, allowing it to inherit all of the traits that all other Protect moves have.

***

<mark style="background-color:orange;">**Generic Max Move Classes**</mark>

Many generic Max Moves share similar types of effects such as raising the stats for allies, lowering the stats of foes, or applying status effects. Because of this, it was much simpler to create generic move classes for these effects, rather than reinvent the wheel each time.

Below, I'll describe each generic move class that may be used as a subclass for Max Moves.

***

<mark style="background-color:yellow;">**Base Class**</mark>

`Battle::DynamaxMove::Move`

This class is the base class used for all Max Moves that are not inheriting its effects from another move (like the Max Guard example above), or not inheriting its effects from another generic Max Move class listed below. All this class is used for is making sure the effects of a Max Move should go off when `def pbEffectAfterAllHits` is used, which is the main method all Max Moves should be using to apply their effects.

Here's an example of this below, with the move Max Overgrowth.

```ruby
class Battle::DynamaxMove::DamageTargetStartGrassyTerrain < Battle::DynamaxMove::Move
  def pbEffectAfterAllHits(user, target)
    return if !super
    @battle.pbStartTerrain(user, :Grassy)
  end
end
```

Here, the line `return if !super` is used to make sure Max Overgrowth does not apply Grassy Terrain if it should not be able to. This super can only be used because the subclass `Battle::DynamaxMove::Move` is being used for this move.&#x20;

***

<mark style="background-color:yellow;">**Raising Stats on the User's Side**</mark>

`Battle::DynamaxMove::UserSideStatUpMove`

This class handles all Max Moves that raises the stats of all Pokemon on the user's side of the field, such as the move Max Knuckle, which can be seen below.

```ruby
class Battle::DynamaxMove::RaiseUserSideAtk1 < Battle::DynamaxMove::UserSideStatUpMove
  def initialize(battle, move)
    super
    @statUp = [:ATTACK, 1]
  end
end
```

Note that you can enter as many stat ID's in these arrays as you wish set the number of stages to whatever you wish. However, all default Max Moves that use this move class only increase a single stat by 1 stage.

***

<mark style="background-color:yellow;">**Lowering Stats on the Target's Side**</mark>

`Battle::DynamaxMove::TargetSideStatDownMove`

This class handles all Max Moves that lower the stats of all Pokemon on the target's side of the field, such as the move G-Max Foamburst, which can be seen below.

```ruby
class Battle::DynamaxMove::LowerTargetSideSpeed2 < Battle::DynamaxMove::TargetSideStatDownMove
  def initialize(battle, move)
    super
    @statDown = [:SPEED, 2]
  end
end
```

Note that you can enter as many stat ID's in these arrays as you wish set the number of stages to whatever you wish. However, all default Max Moves that use this move class only increase a single stat, and usually only by 1 stage.

***

<mark style="background-color:yellow;">**Inflicting Status Conditions on the Target's Side**</mark>

`Battle::DynamaxMove::TargetSideStatusEffectMove`

This class handles all Max Moves that inflict status conditions on all Pokemon on the target's side of the field, such as the move G-Max Volt Crash, which can be seen below.

```ruby
class Battle::DynamaxMove::ParalyzeTargetSide < Battle::DynamaxMove::TargetSideStatusEffectMove
  def initialize(battle, move)
    super
    @statuses = [:PARALYSIS]
  end
end
```

Note that the array here can accept multiple status conditions. If so, a random status within that array will be chosen for each opposing Pokemon. You may also input the symbols `:TOXIC`, `:CONFUSION`, or `:ATTRACT` in these arrays to inflict those conditions as well.

</details>

***

<mark style="background-color:orange;">**Anti-Dynamax Moves**</mark>

In *Pokemon Sword & Shield*, some moves had a unique property in that they would have their power doubled specifically when dealing damage to a Dynamaxed target. By default, the following moves have this property:

* Behemoth Blade
* Behemoth Bash
* Dynamax Cannon

This plugin replicates this by giving these moves the function code `DoubleDamageOnDynamaxTargets`. If you have any moves that you'd like to have this property as well, you may do so by giving that move this function code. Note however that Pokemon in an Eternamax form ignore this property, and will not take double damage despite being Dynamaxed.
