Corrosive Gas

This commit is contained in:
Xhyzi 2021-06-15 19:44:38 +02:00
parent e7ec4df70b
commit 7799e49e3a
12 changed files with 80 additions and 6 deletions

View File

@ -1769,6 +1769,11 @@
various \battler, VARIOUS_TRY_ACTIVATE_GRIM_NEIGH
.endm
.macro trysetcorrosivegas battler:req, ptr:req
various \battler, VARIOUS_TRY_SET_CORROSIVE_GAS
.4byte \ptr
.endm
@ helpful macros
.macro setstatchanger stat:req, stages:req, down:req
setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7

View File

@ -373,6 +373,25 @@ gBattleScriptsForMoveEffects:: @ 82D86A8
.4byte BattleScript_EffectScaleShot
.4byte BattleScript_EffectMeteorBeam
.4byte BattleScript_EffectRisingVoltage
.4byte BattleScript_EffectCorrosiveGas
BattleScript_EffectCorrosiveGas::
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, NO_ACC_CALC_CHECK_LOCK_ON
attackstring
ppreduce
jumpifstatus2 BS_TARGET, STATUS2_SUBSTITUTE, BattleScript_PrintMoveMissed
trysetcorrosivegas BS_TARGET, BattleScript_ButItFailed
attackanimation
waitanimation
printstring STRINGID_ITEMMELTED
waitmessage 0x40
goto BattleScript_MoveEnd
BattleScript_MeltedItem::
printstring STRINGID_ITEMMELTED
waitmessage 0x40
return
BattleScript_EffectMeteorBeam::
@ DecideTurn

View File

@ -229,6 +229,7 @@ struct WishFutureKnock
u8 wishMonId[MAX_BATTLERS_COUNT];
u8 weatherDuration;
u8 knockedOffMons[2]; // Each battler is represented by a bit. The array entry is dependent on the battler's side.
u8 meltedItemMons[2]; // Same as above
};
struct AI_SavedBattleMon

View File

@ -369,5 +369,6 @@ extern const u8 BattleScript_JabocaRowapBerryActivates[];
extern const u8 BattleScript_NotAffectedAbilityPopUp[];
extern const u8 BattleScript_BattlerShookOffTaunt[];
extern const u8 BattleScript_BattlerGotOverItsInfatuation[];
extern const u8 BattleScript_MeltedItem[];
#endif // GUARD_BATTLE_SCRIPTS_H

View File

@ -347,6 +347,7 @@
#define MOVE_EFFECT_INCINERATE 0x44
#define MOVE_EFFECT_BUG_BITE 0x45
#define MOVE_EFFECT_SPD_PLUS_1_DEF_MINUS_1 0x46
#define MOVE_EFFECT_MELT_ITEM 0x4A
#define NUM_MOVE_EFFECTS 0x47
#define MOVE_EFFECT_AFFECTS_USER 0x4000

View File

@ -357,7 +357,8 @@
#define EFFECT_SCALE_SHOT 351
#define EFFECT_METEOR_BEAM 352
#define EFFECT_RISING_VOLTAGE 353
#define EFFECT_CORROSIVE_GAS 354
#define NUM_BATTLE_MOVE_EFFECTS 354
#define NUM_BATTLE_MOVE_EFFECTS 355
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H

View File

@ -173,6 +173,7 @@
#define VARIOUS_DESTROY_ABILITY_POPUP 102
#define VARIOUS_TOTEM_BOOST 103
#define VARIOUS_TRY_ACTIVATE_GRIM_NEIGH 104
#define VARIOUS_TRY_SET_CORROSIVE_GAS 105
// Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0

View File

@ -572,8 +572,9 @@
#define STRINGID_PKMNGOTOVERITSINFATUATION 568
#define STRINGID_PKMNINSNAPTRAP 569
#define STRINGID_METEORBEAMCHARGING 570
#define STRINGID_ITEMMELTED 571
#define BATTLESTRINGS_COUNT 571
#define BATTLESTRINGS_COUNT 572
// The below IDs are all indexes into battle message tables,
// used to determine which of a set of messages to print.

View File

@ -698,9 +698,11 @@ static const u8 sText_MicleBerryActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX}
static const u8 sText_PkmnShookOffTheTaunt[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} shook off\nthe taunt!");
static const u8 sText_PkmnGotOverItsInfatuation[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} got over\nits infatuation!");
static const u8 sText_MeteorBeamCharging[] = _("{B_ATK_NAME_WITH_PREFIX} is overflowing\nwith space energy!");
static const u8 sText_PkmnItemMelted[] = _("{B_ATK_NAME_WITH_PREFIX} corroded\n{B_DEF_NAME_WITH_PREFIX}'s {B_LAST_ITEM}!");
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
{
[STRINGID_ITEMMELTED - 12] = sText_PkmnItemMelted,
[STRINGID_METEORBEAMCHARGING - 12] = sText_MeteorBeamCharging,
[STRINGID_PKMNINSNAPTRAP - 12] = sText_PkmnInSnapTrap,
[STRINGID_PKMNGOTOVERITSINFATUATION - 12] = sText_PkmnGotOverItsInfatuation,

View File

@ -3021,7 +3021,8 @@ void SetMoveEffect(bool32 primary, u32 certain)
| BATTLE_TYPE_LINK
| BATTLE_TYPE_RECORDED_LINK
| BATTLE_TYPE_SECRET_BASE))
&& (gWishFutureKnock.knockedOffMons[side] & gBitTable[gBattlerPartyIndexes[gBattlerAttacker]]))
&& (gWishFutureKnock.knockedOffMons[side] & gBitTable[gBattlerPartyIndexes[gBattlerAttacker]]
|| gWishFutureKnock.meltedItemMons[side] & gBitTable[gBattlerPartyIndexes[gBattlerAttacker]]))
{
gBattlescriptCurrInstr++;
}
@ -5267,6 +5268,11 @@ static void Cmd_switchindataupdate(void)
{
gBattleMons[gActiveBattler].item = 0;
}
// check melted items
if (gWishFutureKnock.meltedItemMons[i] & gBitTable[gBattlerPartyIndexes[gActiveBattler]])
{
gBattleMons[gActiveBattler].item = 0;
}
if (gBattleMoves[gCurrentMove].effect == EFFECT_BATON_PASS)
{
@ -8422,6 +8428,35 @@ static void Cmd_various(void)
gBattlescriptCurrInstr += 7; // exit if loop failed (failsafe)
}
return;
case VARIOUS_TRY_SET_CORROSIVE_GAS:
if (gBattleMons[gActiveBattler].item != 0
&& CanBattlerGetOrLoseItem(gActiveBattler, gBattleMons[gActiveBattler].item)
&& !NoAliveMonsForEitherParty())
{
if (GetBattlerAbility(gActiveBattler) == ABILITY_STICKY_HOLD && IsBattlerAlive(gActiveBattler))
{
gBattlerAbility = gActiveBattler;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_StickyHoldActivates;
}
else
{ //Item is melted normally
u32 side = GetBattlerSide(gActiveBattler);
gLastUsedItem = gBattleMons[gActiveBattler].item;
gBattleMons[gActiveBattler].item = 0;
gBattleStruct->choicedMove[gActiveBattler] = 0;
gWishFutureKnock.meltedItemMons[side] |= gBitTable[gBattlerPartyIndexes[gActiveBattler]];
CheckSetUnburden(gActiveBattler);
gBattlescriptCurrInstr += 7;
}
}
else
{
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
}
return;
}
gBattlescriptCurrInstr += 3;
@ -11206,14 +11241,16 @@ static void Cmd_tryswapitems(void) // trick
u8 sideAttacker = GetBattlerSide(gBattlerAttacker);
u8 sideTarget = GetBattlerSide(gBattlerTarget);
// you can't swap items if they were knocked off in regular battles
// you can't swap items if they were knocked off or melted in regular battles
if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK
| BATTLE_TYPE_EREADER_TRAINER
| BATTLE_TYPE_FRONTIER
| BATTLE_TYPE_SECRET_BASE
| BATTLE_TYPE_RECORDED_LINK))
&& (gWishFutureKnock.knockedOffMons[sideAttacker] & gBitTable[gBattlerPartyIndexes[gBattlerAttacker]]
|| gWishFutureKnock.knockedOffMons[sideTarget] & gBitTable[gBattlerPartyIndexes[gBattlerTarget]]))
|| gWishFutureKnock.knockedOffMons[sideTarget] & gBitTable[gBattlerPartyIndexes[gBattlerTarget]]
|| gWishFutureKnock.meltedItemMons[sideTarget] & gBitTable[gBattlerPartyIndexes[gBattlerAttacker]]
|| gWishFutureKnock.meltedItemMons[sideTarget] & gBitTable[gBattlerPartyIndexes[gBattlerTarget]]))
{
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
}

View File

@ -7215,8 +7215,13 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
basePower = 120;
break;
case EFFECT_RISING_VOLTAGE:
#ifdef ITEM_EXPANSION //Air Baloon exception with item expansion branch
if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN && !IS_BATTLER_OF_TYPE(battlerDef, TYPE_FLYING)
&& gBattleMons[battlerDef].item != ITEM_AIR_BALLOON && gBattleMons[battlerDef].ability != ABILITY_LEVITATE)
#else
if (gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN && !IS_BATTLER_OF_TYPE(battlerDef, TYPE_FLYING)
&& gBattleMons[battlerDef].ability != ABILITY_LEVITATE)
#endif
basePower *= 2;
break;
}

View File

@ -11402,7 +11402,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_CORROSIVE_GAS] =
{
.effect = EFFECT_PLACEHOLDER, //TODO
.effect = EFFECT_CORROSIVE_GAS,
.power = 0,
.type = TYPE_POISON,
.accuracy = 100,