summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Cabral <mr.matthewcabral@gmail.com>2022-01-22 14:42:16 -0500
committerMatthew Cabral <mr.matthewcabral@gmail.com>2022-01-22 14:42:16 -0500
commit60097e139d6d5affdaef9ad4d77f75e1d5752ed6 (patch)
tree46c1e6a9f371f50eb301635f2e315033c048d3cc
parent3732d8bf8f191b6d6f236b000f14e8743cb1e2c6 (diff)
Updated name to IS_MOVE_<category> and updated arg type
-rw-r--r--Add-Physical-Special-Split.md32
1 files changed, 21 insertions, 11 deletions
diff --git a/Add-Physical-Special-Split.md b/Add-Physical-Special-Split.md
index af06109..c104f50 100644
--- a/Add-Physical-Special-Split.md
+++ b/Add-Physical-Special-Split.md
@@ -53,8 +53,9 @@ The game uses a function-style macro to check whether a move is physical or spec
```
The macro simply looks at the move and compares the index of its type to TYPE_MYSTERY, which is 0x9. Types are split down the middle by TYPE_MYSTERY; all physical types are before it, and all special types are after it, so a simple comparison does the job. We will change this to look at the category byte of the move instead of the move's type. For my definition, it looks like this:
```c
-#define IS_TYPE_PHYSICAL(move)(move.category == MOVE_CATEGORY_PHYSICAL)
-#define IS_TYPE_SPECIAL(move)(move.category == MOVE_CATEGORY_SPECIAL)
+#define IS_MOVE_PHYSICAL(move)(gBattleMoves[move].category == MOVE_CATEGORY_PHYSICAL)
+#define IS_MOVE_SPECIAL(move)(gBattleMoves[move].category == MOVE_CATEGORY_SPECIAL)
+#define IS_MOVE_STATUS(move)(gBattleMoves[move].category == MOVE_CATEGORY_STATUS)
```
## 3. Modifying the damage calculation logic
@@ -136,7 +137,7 @@ if (defender->ability == ABILITY_THICK_FAT && (type == TYPE_FIRE || type == TYPE
gBattleMovePower /= 2;
```
-The next thing we need to do is change the arguments passed to IS_TYPE_PHYSICAL and IS_TYPE_SPECIAL. Originally, they were passed a type argument, but now we want to pass a move argument. There are two instances of these functions in **src/pokemon.c**, three more in **src/battle_script_commands.c**, and two more in **src/battle_tv.c**.
+The next thing we need to do is change the arguments passed to IS_MOVE_PHYSICAL and IS_MOVE_SPECIAL. Originally, they were passed a type argument, but now we want to pass a move argument. There are two instances of these functions in **src/pokemon.c**, three more in **src/battle_script_commands.c**, and two more in **src/battle_tv.c**.
In **pokemon.c**, the first one originally reads like this:
```c
@@ -144,7 +145,7 @@ IS_TYPE_PHYSICAL(type)
```
We will change this to:
```c
-IS_TYPE_PHYSICAL(gBattleMoves[gCurrentMove])
+IS_MOVE_PHYSICAL(gCurrentMove)
```
And the second one we will need to change from:
```c
@@ -152,16 +153,25 @@ IS_TYPE_SPECIAL(type)
```
to
```c
-IS_TYPE_SPECIAL(gBattleMoves[gCurrentMove])
+IS_MOVE_SPECIAL(gCurrentMove)
```
-The first one in **battle_script_commands.c** can also be changed like this, but the argument names are different for the second and third one. The second one looks like this originally:
+The ones in **battle_script_commands.c** can also be changed like this, but the argument names are different. The first one (related to the Hustle ability) looks like this:
```c
IS_TYPE_PHYSICAL(moveType)
```
We will change this to:
```c
-IS_TYPE_PHYSICAL(gBattleMoves[gCurrentMove])
+IS_MOVE_PHYSICAL(move)
+```
+**NOTE:** For this change only I used `move` rather than `gCurrentMove` to match other uses of `move` in that function, but either should work.
+The second instance we need to change looks like this originally:
+```c
+IS_TYPE_PHYSICAL(moveType)
+```
+We will change this to:
+```c
+IS_MOVE_PHYSICAL(gCurrentMove)
```
The third one also needs to be changed; originally it reads:
```c
@@ -169,17 +179,17 @@ The third one also needs to be changed; originally it reads:
```
We will change this to:
```c
-IS_TYPE_SPECIAL(gBattleMoves[gCurrentMove])
+IS_MOVE_SPECIAL(gCurrentMove)
```
**Note:** We have changed `!IS_TYPE_PHYSICAL` to `IS_TYPE_SPECIAL` because "not physical" no longer automatically means "special" due to the introduction of the "status" option.
-And lastly, the two in **battle_tv.c** can be changed to:
+And lastly, in **battle_tv.c** the two `IS_TYPE_PHYSICAL` and `IS_TYPE_SPECIAL` can be respectfully changed to:
```c
-IS_TYPE_PHYSICAL(gBattleMoves[gCurrentMove])
+IS_MOVE_PHYSICAL(gCurrentMove)
```
and
```c
-IS_TYPE_SPECIAL(gBattleMoves[gCurrentMove])
+IS_MOVE_SPECIAL(gCurrentMove)
```
## 4. Adding the category byte to moves