mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
Moves changing terrains
This commit is contained in:
parent
2218949d7c
commit
065032bf35
@ -1444,6 +1444,11 @@
|
||||
various \battler, VARIOUS_INVERT_STAT_STAGES
|
||||
.endm
|
||||
|
||||
.macro setterrain ptr
|
||||
various BS_ATTACKER, VARIOUS_SET_TERRAIN
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
@ helpful macros
|
||||
.macro setstatchanger stat, stages, down
|
||||
setbyte sSTATCHANGER \stat | \stages << 4 | \down << 7
|
||||
|
@ -282,6 +282,24 @@ gBattleScriptsForMoveEffects:: @ 82D86A8
|
||||
.4byte BattleScript_EffectIonDeluge
|
||||
.4byte BattleScript_EffectFreezeDry
|
||||
.4byte BattleScript_EffectTopsyTurvy
|
||||
.4byte BattleScript_EffectMistyTerrain
|
||||
.4byte BattleScript_EffectGrassyTerrain
|
||||
.4byte BattleScript_EffectElectricTerrain
|
||||
.4byte BattleScript_EffectPsychicTerrain
|
||||
|
||||
BattleScript_EffectMistyTerrain:
|
||||
BattleScript_EffectGrassyTerrain:
|
||||
BattleScript_EffectElectricTerrain:
|
||||
BattleScript_EffectPsychicTerrain:
|
||||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
setterrain BattleScript_ButItFailed
|
||||
attackanimation
|
||||
waitanimation
|
||||
printfromtable gTerrainStringIds
|
||||
waitmessage 0x40
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectTopsyTurvy:
|
||||
attackcanceler
|
||||
|
@ -246,7 +246,7 @@
|
||||
#define EFFECT_TAILWIND 240
|
||||
#define EFFECT_EMBARGO 241
|
||||
#define EFFECT_AQUA_RING 242
|
||||
#define EFFECT_TRICK_TOOM 243
|
||||
#define EFFECT_TRICK_ROOM 243
|
||||
#define EFFECT_WONDER_ROOM 244
|
||||
#define EFFECT_MAGIC_ROOM 245
|
||||
#define EFFECT_MAGNET_RISE 246
|
||||
@ -271,5 +271,9 @@
|
||||
#define EFFECT_ION_DELUGE 265
|
||||
#define EFFECT_FREEZE_DRY 266
|
||||
#define EFFECT_TOPSY_TURVY 267
|
||||
#define EFFECT_MISTY_TERRAIN 268
|
||||
#define EFFECT_GRASSY_TERRAIN 269
|
||||
#define EFFECT_ELECTRIC_TERRAIN 270
|
||||
#define EFFECT_PSYCHIC_TERRAIN 271
|
||||
|
||||
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H
|
||||
|
@ -91,6 +91,7 @@
|
||||
#define VARIOUS_TRY_HEAL_PULSE 42
|
||||
#define VARIOUS_TRY_QUASH 43
|
||||
#define VARIOUS_INVERT_STAT_STAGES 44
|
||||
#define VARIOUS_SET_TERRAIN 45
|
||||
|
||||
// atk80, dmg manipulation
|
||||
#define ATK80_DMG_CHANGE_SIGN 0
|
||||
|
@ -497,6 +497,10 @@
|
||||
#define STRINGID_PKMNBLEWAWAYSTEALTHROCK 494
|
||||
#define STRINGID_IONDELUGEON 495
|
||||
#define STRINGID_TOPSYTURVYSWITCHEDSTATS 496
|
||||
#define STRINGID_TERRAINBECOMESMISTY 497
|
||||
#define STRINGID_TERRAINBECOMESGRASSY 498
|
||||
#define STRINGID_TERRAINBECOMESELECTRIC 499
|
||||
#define STRINGID_TERRAINBECOMESPSYCHIC 500
|
||||
|
||||
#define BATTLESTRINGS_COUNT 516
|
||||
|
||||
|
@ -5200,7 +5200,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_GEN6] =
|
||||
.split = SPLIT_STATUS,
|
||||
},
|
||||
{ // MOVE_TRICK_ROOM
|
||||
.effect = EFFECT_TRICK_TOOM,
|
||||
.effect = EFFECT_TRICK_ROOM,
|
||||
.power = 0,
|
||||
.type = TYPE_PSYCHIC,
|
||||
.accuracy = 0,
|
||||
@ -6965,7 +6965,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_GEN6] =
|
||||
.split = SPLIT_STATUS,
|
||||
},
|
||||
{ // MOVE_GRASSY_TERRAIN
|
||||
.effect = EFFECT_PLACEHOLDER, // Needs a custom move effect
|
||||
.effect = EFFECT_GRASSY_TERRAIN,
|
||||
.power = 0,
|
||||
.type = TYPE_GRASS,
|
||||
.accuracy = 0,
|
||||
@ -6977,7 +6977,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_GEN6] =
|
||||
.split = SPLIT_STATUS,
|
||||
},
|
||||
{ // MOVE_MISTY_TERRAIN
|
||||
.effect = EFFECT_PLACEHOLDER, // Needs a custom move effect
|
||||
.effect = EFFECT_MISTY_TERRAIN,
|
||||
.power = 0,
|
||||
.type = TYPE_FAIRY,
|
||||
.accuracy = 0,
|
||||
@ -7253,7 +7253,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_GEN6] =
|
||||
.split = SPLIT_STATUS,
|
||||
},
|
||||
{ // MOVE_ELECTRIC_TERRAIN
|
||||
.effect = EFFECT_PLACEHOLDER, // Needs a custom move effect
|
||||
.effect = EFFECT_ELECTRIC_TERRAIN,
|
||||
.power = 0,
|
||||
.type = TYPE_ELECTRIC,
|
||||
.accuracy = 0,
|
||||
|
@ -628,13 +628,19 @@ static const u8 sText_TargetStatWontGoHigher[] = _("{B_DEF_NAME_WITH_PREFIX}’s
|
||||
static const u8 sText_PkmnMoveBouncedViaAbility[] = _("{B_ATK_NAME_WITH_PREFIX}’s {B_CURRENT_MOVE} was\nbounced back by {B_DEF_NAME_WITH_PREFIX}’s\l{B_DEF_ABILITY}!");
|
||||
static const u8 sText_ImposterTransform[] = _("{B_ATK_NAME_WITH_PREFIX} transformed into\n{B_DEF_NAME_WITH_PREFIX} using {B_LAST_ABILITY}!");
|
||||
static const u8 sText_NotDoneYet[] = _("This move effect is not done yet!\p");
|
||||
static const u8 sText_StickyWebUsed[] = _("");
|
||||
static const u8 sText_QuashSuccess[] = _("");
|
||||
static const u8 sText_PkmnBlewAwayToxicSpikes[] = _("{B_ATK_NAME_WITH_PREFIX} blew away\nTOXIC SPIKES!");
|
||||
static const u8 sText_PkmnBlewAwayStickyWeb[] = _("{B_ATK_NAME_WITH_PREFIX} blew away\nSTICKY WEB!");
|
||||
static const u8 sText_PkmnBlewAwayStealthRock[] = _("{B_ATK_NAME_WITH_PREFIX} blew away\nSTEALTH ROCK!");
|
||||
|
||||
// To do.
|
||||
static const u8 sText_StickyWebUsed[] = _("");
|
||||
static const u8 sText_QuashSuccess[] = _("");
|
||||
static const u8 sText_IonDelugeOn[] = _("");
|
||||
static const u8 sText_TopsyTurvySwitchedStats[] = _("");
|
||||
static const u8 sText_TerrainBecomesMisty[] = _("");
|
||||
static const u8 sText_TerrainBecomesGrassy[] = _("");
|
||||
static const u8 sText_TerrainBecomesElectric[] = _("");
|
||||
static const u8 sText_TerrainBecomesPsychic[] = _("");
|
||||
|
||||
// New selection strings, they must end with "\p".
|
||||
// Use {B_LAST_ITEM} and {B_CURRENT_MOVE}.
|
||||
@ -1130,6 +1136,15 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
|
||||
sText_PkmnBlewAwayStealthRock,
|
||||
sText_IonDelugeOn,
|
||||
sText_TopsyTurvySwitchedStats,
|
||||
sText_TerrainBecomesMisty,
|
||||
sText_TerrainBecomesGrassy,
|
||||
sText_TerrainBecomesElectric,
|
||||
sText_TerrainBecomesPsychic,
|
||||
};
|
||||
|
||||
const u16 gTerrainStringIds[] =
|
||||
{
|
||||
STRINGID_TERRAINBECOMESMISTY, STRINGID_TERRAINBECOMESGRASSY, STRINGID_TERRAINBECOMESELECTRIC, STRINGID_TERRAINBECOMESPSYCHIC
|
||||
};
|
||||
|
||||
const u16 gMagicCoatBounceStringIds[] =
|
||||
|
@ -6058,6 +6058,44 @@ static bool32 HasAttackerFaintedTarget(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void HandleTerrainMove(u32 moveEffect)
|
||||
{
|
||||
u32 statusFlag = 0;
|
||||
u8 *timer = NULL;
|
||||
|
||||
switch (moveEffect)
|
||||
{
|
||||
case EFFECT_MISTY_TERRAIN:
|
||||
statusFlag = STATUS_FIELD_MISTY_TERRAIN, timer = &gFieldTimers.mistyTerrainTimer;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
break;
|
||||
case EFFECT_GRASSY_TERRAIN:
|
||||
statusFlag = STATUS_FIELD_GRASSY_TERRAIN, timer = &gFieldTimers.grassyTerrainTimer;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
break;
|
||||
case EFFECT_ELECTRIC_TERRAIN:
|
||||
statusFlag = STATUS_FIELD_ELECTRIC_TERRAIN, timer = &gFieldTimers.electricTerrainTimer;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
|
||||
break;
|
||||
case EFFECT_PSYCHIC_TERRAIN:
|
||||
statusFlag = STATUS_FIELD_PSYCHIC_TERRAIN, timer = &gFieldTimers.psychicTerrainTimer;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
if (gFieldStatuses & statusFlag || statusFlag == 0)
|
||||
{
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
gFieldStatuses &= ~(STATUS_FIELD_MISTY_TERRAIN | STATUS_FIELD_GRASSY_TERRAIN | EFFECT_ELECTRIC_TERRAIN | EFFECT_PSYCHIC_TERRAIN);
|
||||
gFieldStatuses |= statusFlag;
|
||||
*timer = 5;
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
}
|
||||
|
||||
static void atk76_various(void)
|
||||
{
|
||||
u8 side;
|
||||
@ -6439,6 +6477,9 @@ static void atk76_various(void)
|
||||
gBattleMons[gActiveBattler].statStages[i] = 6 - (gBattleMons[gActiveBattler].statStages[i] - 6);
|
||||
}
|
||||
break;
|
||||
case VARIOUS_SET_TERRAIN:
|
||||
HandleTerrainMove(gBattleMoves[gCurrentMove].effect);
|
||||
return;
|
||||
}
|
||||
|
||||
gBattlescriptCurrInstr += 3;
|
||||
@ -9289,15 +9330,15 @@ static void HandleRoomMove(u32 statusFlag, u8 *timer, u8 stringId)
|
||||
|
||||
static void atkD9_setroom(void)
|
||||
{
|
||||
switch (gCurrentMove)
|
||||
switch (gBattleMoves[gCurrentMove].effect)
|
||||
{
|
||||
case MOVE_TRICK_ROOM:
|
||||
case EFFECT_TRICK_ROOM:
|
||||
HandleRoomMove(STATUS_FIELD_TRICK_ROOM, &gFieldTimers.trickRoomTimer, 0);
|
||||
break;
|
||||
case MOVE_WONDER_ROOM:
|
||||
case EFFECT_WONDER_ROOM:
|
||||
HandleRoomMove(STATUS_FIELD_WONDER_ROOM, &gFieldTimers.wonderRoomTimer, 2);
|
||||
break;
|
||||
case MOVE_MAGIC_ROOM:
|
||||
case EFFECT_MAGIC_ROOM:
|
||||
HandleRoomMove(STATUS_FIELD_MAGIC_ROOM, &gFieldTimers.magicRoomTimer, 4);
|
||||
break;
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user