So I'm trying to alter Steelworker, Dhelmise's ability that gives it STAB for Steel type moves, to also give it Steel resists and weaknesses. I know that the battle engine with RH Hideout and Dizzy's upgrades has support for the move Trick or Treat, which does something similar--however, I'm not sure how to apply the .effect = EFFECT_THIRD_TYPE
move effect to an ability. Has anyone worked with this before?
In itself, the concept is simple; what you want is to assign a 3rd type to the Pokémon with this ability, correct?
My first thought on how to handle it is to add an entry for the ability in the
case ABILITYEFFECT_ON_SWITCHIN
of
AbilityBattleEffects
and write something like:
Code:
case ABILITY_STEELWORKER
if (!gSpecialStatuses[battler].switchInAbilityDone)
{
gBattleMons[battler].type3 = TYPE_STEEL;
gSpecialStatuses[battler].switchInAbilityDone = TRUE;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_SWITCHIN_STEELWORKER
BattleScriptPushCursorAndCallback(BattleScript_SwitchInAbilityMsg);
effect++;
}
break;
You'll have to define
B_MSG_SWITCHIN_STEELWORKER
in
include/constants/battle_string_ids.h
.
Then you'll have to add it to the
gSwitchInAbilityStringIds
array.
And then you'll have to add a string normally, by defining its
STRINGID
in
include/constants/battle_string_ids.h
, then adding it to
gBattleStringsTable
and then writing the actual text string however you want above that table.
As a result, when you send in a Pokémon with Steelworker, their 3rd type would become the Steel type, and a battle script that'll show an ability pop up and print a switch-in string would be called.
Of course, you can tweak things around however you'd like.
You can avoid calling a BattleScript in
case ABILITY_STEELWORKER
and forget about defining and adding a new text string if you don't want to use neither the ability pop up nor a switch-in string, for example.