Topsy Turvy and Ion Deluge.

This commit is contained in:
DizzyEggg 2018-08-04 23:34:29 +02:00
parent 222ea7269d
commit 2218949d7c
9 changed files with 69 additions and 5 deletions

View File

@ -1440,6 +1440,10 @@
.4byte \ptr
.endm
.macro invertstatstages battler
various \battler, VARIOUS_INVERT_STAT_STAGES
.endm
@ helpful macros
.macro setstatchanger stat, stages, down
setbyte sSTATCHANGER \stat | \stages << 4 | \down << 7

View File

@ -279,6 +279,41 @@ gBattleScriptsForMoveEffects:: @ 82D86A8
.4byte BattleScript_EffectEntrainment
.4byte BattleScript_EffectHealPulse
.4byte BattleScript_EffectQuash
.4byte BattleScript_EffectIonDeluge
.4byte BattleScript_EffectFreezeDry
.4byte BattleScript_EffectTopsyTurvy
BattleScript_EffectTopsyTurvy:
attackcanceler
attackstring
ppreduce
accuracycheck BattleScript_ButItFailed, NO_ACC_CALC_CHECK_LOCK_ON
jumpifstat BS_TARGET, CMP_NOT_EQUAL, STAT_ATK, 6, BattleScript_EffectTopsyTurvyWorks
jumpifstat BS_TARGET, CMP_NOT_EQUAL, STAT_DEF, 6, BattleScript_EffectTopsyTurvyWorks
jumpifstat BS_TARGET, CMP_NOT_EQUAL, STAT_SPATK, 6, BattleScript_EffectTopsyTurvyWorks
jumpifstat BS_TARGET, CMP_NOT_EQUAL, STAT_SPDEF, 6, BattleScript_EffectTopsyTurvyWorks
jumpifstat BS_TARGET, CMP_NOT_EQUAL, STAT_SPEED, 6, BattleScript_EffectTopsyTurvyWorks
jumpifstat BS_TARGET, CMP_NOT_EQUAL, STAT_ACC, 6, BattleScript_EffectTopsyTurvyWorks
jumpifstat BS_TARGET, CMP_EQUAL, STAT_EVASION, 6, BattleScript_ButItFailed
BattleScript_EffectTopsyTurvyWorks:
attackanimation
waitanimation
invertstatstages BS_TARGET
printstring STRINGID_TOPSYTURVYSWITCHEDSTATS
waitmessage 0x40
goto BattleScript_MoveEnd
BattleScript_EffectIonDeluge:
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
orword gFieldStatuses, STATUS_FIELD_ION_DELUGE
attackanimation
waitanimation
printstring STRINGID_IONDELUGEON
waitmessage 0x40
goto BattleScript_MoveEnd
BattleScript_EffectQuash:
attackcanceler
@ -740,6 +775,7 @@ BattleScript_EffectFoulPlay:
BattleScript_EffectPsyshock:
BattleScript_EffectWeatherBall:
BattleScript_EffectHiddenPower:
BattleScript_EffectFreezeDry:
jumpifnotmove MOVE_SURF, BattleScript_HitFromAtkCanceler
jumpifnostatus3 BS_TARGET, STATUS3_UNDERWATER, BattleScript_HitFromAtkCanceler
orword gHitMarker, HITMARKER_IGNORE_UNDERWATER

View File

@ -268,5 +268,8 @@
#define EFFECT_ENTRAINMENT 262
#define EFFECT_HEAL_PULSE 263
#define EFFECT_QUASH 264
#define EFFECT_ION_DELUGE 265
#define EFFECT_FREEZE_DRY 266
#define EFFECT_TOPSY_TURVY 267
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H

View File

@ -90,6 +90,7 @@
#define VARIOUS_SET_LAST_USED_ABILITY 41
#define VARIOUS_TRY_HEAL_PULSE 42
#define VARIOUS_TRY_QUASH 43
#define VARIOUS_INVERT_STAT_STAGES 44
// atk80, dmg manipulation
#define ATK80_DMG_CHANGE_SIGN 0

View File

@ -495,7 +495,9 @@
#define STRINGID_PKMNBLEWAWAYTOXICSPIKES 492
#define STRINGID_PKMNBLEWAWAYSTICKYWEB 493
#define STRINGID_PKMNBLEWAWAYSTEALTHROCK 494
#define STRINGID_IONDELUGEON 495
#define STRINGID_TOPSYTURVYSWITCHEDSTATS 496
#define BATTLESTRINGS_COUNT 506
#define BATTLESTRINGS_COUNT 516
#endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H

View File

@ -6832,7 +6832,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_GEN6] =
.split = SPLIT_STATUS,
},
{ // MOVE_ION_DELUGE
.effect = EFFECT_PLACEHOLDER, // Needs a custom move effect
.effect = EFFECT_ION_DELUGE,
.power = 0,
.type = TYPE_ELECTRIC,
.accuracy = 0,
@ -6880,7 +6880,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_GEN6] =
.split = SPLIT_PHYSICAL,
},
{ // MOVE_FREEZE_DRY
.effect = EFFECT_PLACEHOLDER, // Needs a custom move effect
.effect = EFFECT_FREEZE_DRY,
.power = 70,
.type = TYPE_ICE,
.accuracy = 100,
@ -6916,7 +6916,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_GEN6] =
.split = SPLIT_STATUS,
},
{ // MOVE_TOPSY_TURVY
.effect = EFFECT_PLACEHOLDER, // Needs a custom move effect
.effect = EFFECT_TOPSY_TURVY,
.power = 0,
.type = TYPE_DARK,
.accuracy = 0,

View File

@ -633,6 +633,8 @@ 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!");
static const u8 sText_IonDelugeOn[] = _("");
static const u8 sText_TopsyTurvySwitchedStats[] = _("");
// New selection strings, they must end with "\p".
// Use {B_LAST_ITEM} and {B_CURRENT_MOVE}.
@ -1126,6 +1128,8 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
sText_PkmnBlewAwayToxicSpikes,
sText_PkmnBlewAwayStickyWeb,
sText_PkmnBlewAwayStealthRock,
sText_IonDelugeOn,
sText_TopsyTurvySwitchedStats,
};
const u16 gMagicCoatBounceStringIds[] =

View File

@ -6430,6 +6430,15 @@ static void atk76_various(void)
gBattlescriptCurrInstr += 7;
}
return;
case VARIOUS_INVERT_STAT_STAGES:
for (i = 0; i < BATTLE_STATS_NO; i++)
{
if (gBattleMons[gActiveBattler].statStages[i] < 6) // Negative becomes positive.
gBattleMons[gActiveBattler].statStages[i] = 6 + (6 - gBattleMons[gActiveBattler].statStages[i]);
else if (gBattleMons[gActiveBattler].statStages[i] > 6) // Positive becomes negative.
gBattleMons[gActiveBattler].statStages[i] = 6 - (gBattleMons[gActiveBattler].statStages[i] - 6);
}
break;
}
gBattlescriptCurrInstr += 3;

View File

@ -848,6 +848,7 @@ enum
ENDTURN_MISTY_TERRAIN,
ENDTURN_GRASSY_TERRAIN,
ENDTURN_PSYCHIC_TERRAIN,
ENDTURN_ION_DELUGE,
ENDTURN_FIELD_COUNT,
};
@ -1257,6 +1258,10 @@ u8 DoFieldEndTurnEffects(void)
}
gBattleStruct->turnCountersTracker++;
break;
case ENDTURN_ION_DELUGE:
gFieldStatuses &= ~(STATUS_FIELD_ION_DELUGE);
gBattleStruct->turnCountersTracker++;
break;
case ENDTURN_FIELD_COUNT:
effect++;
break;
@ -5410,7 +5415,7 @@ static inline void MulByTypeEffectiveness(u16 *modifier, u16 move, u8 moveType,
mod = UQ_4_12(1.0);
if (moveType == TYPE_PSYCHIC && defType == TYPE_DARK && gStatuses3[battlerDef] & STATUS3_MIRACLE_EYED)
mod = UQ_4_12(1.0);
if (move == MOVE_FREEZE_DRY && defType == TYPE_WATER)
if (gBattleMoves[move].effect == EFFECT_FREEZE_DRY && defType == TYPE_WATER)
mod = UQ_4_12(2.0);
if (moveType == TYPE_GROUND && defType == TYPE_FLYING && IsBattlerGrounded(battlerDef))
mod = UQ_4_12(1.0);