2 Add Choice Specs Scarf hold item effects
Scyrous edited this page 2024-07-04 21:53:53 +02:00

Credits: Scyrous

By default, Pokémon Emerald only includes the Choice Band, which boosts physical type-based moves, while restricting the holder to using only the first move selected in battle. The Choice Specs and Choice Scarf items (which boost special type-based moves and speed, respectively) were not added until generation IV. Let's add their effects to Pokémon Emerald.

Please note that this tutorial will only add the hold effects, not the actual items. Additionally, this tutorial does not take into account any physical/special split alterations you may have made.

Contents

  1. Update hold effects header
  2. Give special attack boost to Choice Specs
  3. Give speed boost to Choice Scarf
  4. Update Choice Specs and Choice Scarf move
  5. Lock Choice Specs and Choice Scarf move
  6. Update Battle AI

1. Update hold effects header

Edit include/constants/hold_effects.h:

 #define HOLD_EFFECT_METAL_POWDER   64
 #define HOLD_EFFECT_THICK_CLUB     65
 #define HOLD_EFFECT_STICK          66
+#define HOLD_EFFECT_CHOICE_SPECS   67
+#define HOLD_EFFECT_CHOICE_SCARF   68

 #endif // GUARD_HOLD_EFFECTS_H

2. Give special attack boost to Choice Specs

Edit src\pokemon.c:

     // Apply boosts from hold items
     if (attackerHoldEffect == HOLD_EFFECT_CHOICE_BAND)
         attack = (150 * attack) / 100;
+    if (attackerHoldEffect == HOLD_EFFECT_CHOICE_SPECS)
+        spAttack = (150 * spAttack) / 100;
     if (attackerHoldEffect == HOLD_EFFECT_SOUL_DEW && !(gBattleTypeFlags & (BATTLE_TYPE_FRONTIER)) && (attacker->species == SPECIES_LATIAS || attacker->species == SPECIES_LATIOS))
         spAttack = (150 * spAttack) / 100;

3. Give speed boost to Choice Scarf

Edit src\battle_main.c:

     if (holdEffect == HOLD_EFFECT_MACHO_BRACE)
         speedBattler1 /= 2;

+    if (holdEffect == HOLD_EFFECT_CHOICE_SCARF)
+        speedBattler1 *= 1.5;
+
     if (gBattleMons[battler1].status1 & STATUS1_PARALYSIS)
         speedBattler1 /= 4;

And also:

     if (holdEffect == HOLD_EFFECT_MACHO_BRACE)
         speedBattler2 /= 2;

+    if (holdEffect == HOLD_EFFECT_CHOICE_SCARF)
+        speedBattler2 *= 1.5;
+
     if (gBattleMons[battler2].status1 & STATUS1_PARALYSIS)
         speedBattler2 /= 4;

As you can see, we added the effect twice in the same function. This is because both speedBattler1 and speedBattler2 need to be taken into account when determining which Pokémon acts first.


4. Update Choice Specs and Choice Scarf move

Edit src\battle_script_commands.c:

         case MOVEEND_CHOICE_MOVE: // update choice band move
             if (gHitMarker & HITMARKER_OBEYS
-             && holdEffectAtk == HOLD_EFFECT_CHOICE_BAND
+             && (holdEffectAtk == HOLD_EFFECT_CHOICE_BAND || holdEffectAtk == HOLD_EFFECT_CHOICE_SPECS || holdEffectAtk == HOLD_EFFECT_CHOICE_SCARF)
              && gChosenMove != MOVE_STRUGGLE
              && (*choicedMoveAtk == MOVE_NONE || *choicedMoveAtk == MOVE_UNAVAILABLE))

5. Lock Choice Specs and Choice Scarf move

Edit src\battle_util.c:

     gPotentialItemEffectBattler = gActiveBattler;

-    if (holdEffect == HOLD_EFFECT_CHOICE_BAND && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != move)
+    if ((holdEffect == HOLD_EFFECT_CHOICE_BAND || holdEffect == HOLD_EFFECT_CHOICE_SPECS || holdEffect == HOLD_EFFECT_CHOICE_SCARF) && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != move)
     {
         gCurrentMove = *choicedMove;
         gLastUsedItem = gBattleMons[gActiveBattler].item;

And also:

         // Choice Band
-        if (holdEffect == HOLD_EFFECT_CHOICE_BAND && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != gBattleMons[battlerId].moves[i])
+        if ((holdEffect == HOLD_EFFECT_CHOICE_BAND || holdEffect == HOLD_EFFECT_CHOICE_SPECS || holdEffect == HOLD_EFFECT_CHOICE_SCARF) && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != gBattleMons[battlerId].moves[i])
             unusableMoves |= gBitTable[i];
     }
     return unusableMoves;

6. Update Battle AI

Edit data\battle_ai_scripts.s:

AI_CV_Trick_EffectsToEncourage:
	.byte HOLD_EFFECT_CONFUSE_SPICY
	.byte HOLD_EFFECT_CONFUSE_DRY
	.byte HOLD_EFFECT_CONFUSE_SWEET
	.byte HOLD_EFFECT_CONFUSE_BITTER
	.byte HOLD_EFFECT_CONFUSE_SOUR
	.byte HOLD_EFFECT_MACHO_BRACE
	.byte HOLD_EFFECT_CHOICE_BAND
+	.byte HOLD_EFFECT_CHOICE_SPECS
+	.byte HOLD_EFFECT_CHOICE_SCARF
	.byte -1

AI_CV_Trick_EffectsToEncourage2:
	.byte HOLD_EFFECT_CHOICE_BAND
+	.byte HOLD_EFFECT_CHOICE_SPECS
+	.byte HOLD_EFFECT_CHOICE_SCARF
	.byte -1

The AI seems to check for HOLD_EFFECT_CHOICE_BAND in some capacity, so we'll add the Specs and Scarf here as well.


Now that the effects ares finalized, they can be applied to any items of your choice (no pun intended) in src\data\items.h.

And that's it! Happy battling.