Move data structure (Generation III): Difference between revisions

m
(Fixed an error on the Accuracy section, related to the scale, after checking the values in the actual game.)
(24 intermediate revisions by 19 users not shown)
Line 1: Line 1:
<!--Linkify. -->
<!--Linkify. -->
=Format=
{{cleanup}}
 
==Format==
Every move in Ruby, Sapphire, FireRed, LeafGreen, and Emerald has a 12-byte data structure.
Every move in [[Pokémon Ruby and Sapphire Versions|Ruby, Sapphire]], [[Pokémon FireRed and LeafGreen Versions|FireRed, LeafGreen]], and [[Pokémon Emerald Version|Emerald]] has a 12-byte data structure.


{| align="center" style="border: 1px solid #88a; background: #f8f8ff; padding: 0.5em;" cellspacing="1"
{| align="center" style="border: 1px solid #88a; background: #f8f8ff; padding: 0.5em;" cellspacing="1"
Line 10: Line 10:
| Effect || byte
| Effect || byte
|-
|-
| Base power || byte
| [[power|Base Power]] || byte
|-
|-
| Type || byte
| [[Type]] || byte
|-
|-
| Accuracy || byte
| [[Accuracy]] || byte
|-
|-
| PP || byte
| {{PP}} || byte
|-
|-
| Effect accuracy || byte
| Effect accuracy || byte
Line 22: Line 22:
| Affects whom || byte
| Affects whom || byte
|-
|-
| Priority || byte
| [[Priority]] || byte
|-
|-
| Contact || byte
| Flags || byte
|-
|-
| Padding || 3 bytes
| Padding || 3 bytes
Line 35: Line 35:
# Numbers with no specific prefix or suffix are decimal.
# Numbers with no specific prefix or suffix are decimal.


* '''Accuracy''' determines the move's accuracy. Divide this value by 100 to get the actual accuracy. In [[Generation I]], this value was 0-255 and divided by 256, which explains why sometimes attacks like {{M|Swift}} missed. This no longer happens in [[Generation III]]. This value is also set to 0 to reach 100% accuracy.
* '''Effect accuracy''' determines probability that the effect associated with a given move will happen. Divide this value by 100 to get the actual effect's accuracy. So that, for instance, a value of 100 gives the player 100% chances for the effect to trigger. For yet-unknown reasons, some moves have this value set to 0 which results in 100% accuracy as well.
* '''Affects whom''' determines who the move will hit on a 2 on 2 battle. It can be selected target, user, both foes, random foe, both foes and partner, field, opponent field (Spikes) and last opponent who moved. The following table indicates which value matches a certain target type.


* '''Accuracy''' determines move's accuracy. Divide this value by 100 to get the actual accuracy. In RGBY Games, this value was 0-255 and divided by 256, which explains why sometimes attacks like Swift missed. This no longer happens in RSE/LGFR. This value is also set to 0 to reach 100% accuracy.
* '''Effect accuracy''' determines probability that the effect associated with a given move will happen. Divide this value by 100 to get the actual effect's accuracy. So that, for instance, a value of 100 gives you 100% chances for the effect to trigger. For yet-unknowned reasons, some moves have this value set to 0 which results in 100% accuracy as well.
* '''Affects whom''' determines who the move will hit on a 2 on 2 battle. It can be selected target, user, both foes, random foe, both foes and partner, field, opponent field (Spikes) and last opponent who moved. The following table indicates which value matches a certain target type.
{| align="center" style="border: 1px solid #88a; background: #f8f8ff; padding: 0.5em;" cellspacing="1"
{| align="center" style="border: 1px solid #88a; background: #f8f8ff; padding: 0.5em;" cellspacing="1"
|-
|-
| 0x00 || Selected target
| 0x00 || Selected target
|-
|-
| 0x01 || Last opponent who moved
| 0x01 || Depends on the attack
|-
|-
| 0x02 || Unused (?)
| 0x02 || Unused
|-
|-
| 0x04 || Random target
| 0x04 || Random target
Line 57: Line 56:
|-
|-
| 0x40 || Opponent field
| 0x40 || Opponent field
|-
| 0x80 || Unused (?)
|}
|}
Please note that it is theorically possible to combine those values. For example, you could have a move with this value set to 0x18. This would mean it would affect everyone except partner. But, no move seems to use such a combination in the games.
 
* '''Priority''' determines the moves speed, for example EXTREMESPEED is faster than any other move. This byte is signed, i.e. this value can be either positive or negative. If it is stricly less than 0x80 (128) then you got the actual value. If not, the actual value equals: -1 * (256 - Current Value). Thus, value 0xFE (254) must be treated as -2 instead.
Please note that it is theoretically possible to combine those values. For example, the player could have a move with this value set to 0x18. This would mean it would affect everyone except the partner. But, no move seems to use such a combination in the games. Also, the special case 0x01 has a different target depending on the move. Counter targets the last attacker, while Metronome could target anything.
* '''Contact''' determines whether there is physical contact during the attack or not, for determining effects of certain [[abilities]] such as Static and Rough Skin. This byte also determines whether this move is affected by items such as King's Rock or Brightpowder.
* '''Priority''' determines the moves speed. For example, {{M|ExtremeSpeed}} is faster than most other moves. This byte is signed, i.e. this value can be either positive or negative. If it is strictly less than 0x80 (128), then the player got the actual value. If not, the actual value equals: -1 * (256 - Current Value). Thus, value 0xFE (254) must be treated as -2 instead.
* '''Flags''' determine additional properties of the move:
 
<code>--fedcba</code><br>
WARNING: Flags '''c''' and '''d''' are mutually exclusive.
**'''a''' - This moves makes [[contact]] with the target.
**'''b''' - This move is affected by {{m|Protect}}.
**'''c''' - This move is affected by {{m|Magic Coat}}.
**'''d''' - This move is affected by {{m|Snatch}}.
**'''e''' - This move may be used with {{m|Mirror Move}}
**'''f''' - This move is affected by the effects of [[King's Rock]].  The flinch effect is considered an additional effect for the purposes of {{a|Shield Dust}}, but not {{a|Serene Grace}}.
 
* '''Padding''' consists of a sequence of 3 bytes. Each one of those bytes should be set to 0x00.
* '''Padding''' consists of a sequence of 3 bytes. Each one of those bytes should be set to 0x00.


[[Category:Structures]]
==Fingerprint==
[[Category:Game mechanics]]
 
<pre>
00 00 00 00 00 00 00 00 00 00 00 00  // - (used for unknown moves)
00 28 00 64 23 00 00 00 33 00 00 00  // POUND
2B 32 01 64 19 00 00 00 33 00 00 00  // KARATE CHOP
1D 0F 00 55 0A 00 00 00 33 00 00 00  // DOUBLESLAP
1D 12 00 55 0F 00 00 00 33 00 00 00  // COMET PUNCH
00 50 00 55 14 00 00 00 33 00 00 00  // MEGA PUNCH
22 28 00 64 14 64 00 00 32 00 00 00  // PAY DAY
04 4B 0A 64 0F 0A 00 00 13 00 00 00  // FIRE PUNCH
05 4B 0F 64 0F 0A 00 00 13 00 00 00  // ICE PUNCH
06 4B 0D 64 0F 0A 00 00 13 00 00 00  // THUNDERPUNCH
...
</pre>
 
{{data structure}}<br>
{{Project Games notice|data structure}}
1,443

edits