Bug bite/Fling enigma berry interaction & tests (#3311)

This commit is contained in:
DizzyEggg 2023-09-14 19:13:11 +02:00 committed by GitHub
parent f3217c18dc
commit 4fb0b55664
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 10 deletions

View File

@ -6557,19 +6557,18 @@ static u8 TrySetMicleBerry(u32 battler, u32 itemId, bool32 end2)
static u8 TrySetEnigmaBerry(u32 battler)
{
if (IsBattlerAlive(battler)
&& TARGET_TURN_DAMAGED
&& !DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove)
&& ((TARGET_TURN_DAMAGED && gMoveResultFlags & MOVE_RESULT_SUPER_EFFECTIVE) || gBattleScripting.overrideBerryRequirements)
&& !(gBattleScripting.overrideBerryRequirements && gBattleMons[battler].hp == gBattleMons[battler].maxHP)
#if B_HEAL_BLOCKING >= GEN_5
&& !(gStatuses3[battler] & STATUS3_HEAL_BLOCK)
&& !(gStatuses3[battler] & STATUS3_HEAL_BLOCK))
#endif
&& gMoveResultFlags & MOVE_RESULT_SUPER_EFFECTIVE)
{
gBattleScripting.battler = battler;
gBattleMoveDamage = (gBattleMons[battler].maxHP * 25 / 100) * -1;
if (GetBattlerAbility(battler) == ABILITY_RIPEN)
gBattleMoveDamage *= 2;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_ItemHealHP_RemoveItemRet;
return ITEM_HP_CHANGE;

View File

@ -10,13 +10,13 @@ ASSUMPTIONS
// Pretty much copy/paste of the Berry Fling Test.
SINGLE_BATTLE_TEST("Bug Bite eats the target's berry and immediately gains its effect")
{
u16 item;
u32 status1 = STATUS1_NONE, effect, statId;
u16 item = ITEM_NONE;
u32 status1 = STATUS1_NONE, effect = HOLD_EFFECT_NONE, statId = 0;
PARAMETRIZE { item = ITEM_NONE; }
PARAMETRIZE { item = ITEM_ORAN_BERRY; effect = HOLD_EFFECT_RESTORE_HP; }
PARAMETRIZE { item = ITEM_SITRUS_BERRY; effect = HOLD_EFFECT_RESTORE_HP; }
// PARAMETRIZE { item = ITEM_ENIGMA_BERRY; effect = HOLD_EFFECT_RESTORE_HP; } To do once Enigma Berry's effect is done
PARAMETRIZE { item = ITEM_ENIGMA_BERRY; effect = HOLD_EFFECT_ENIGMA_BERRY; }
PARAMETRIZE { item = ITEM_LEPPA_BERRY; effect = HOLD_EFFECT_RESTORE_PP; }
PARAMETRIZE { item = ITEM_CHESTO_BERRY; effect = HOLD_EFFECT_CURE_SLP; status1 = STATUS1_SLEEP; }
PARAMETRIZE { item = ITEM_CHERI_BERRY; effect = HOLD_EFFECT_CURE_PAR; status1 = STATUS1_PARALYSIS; }
@ -50,13 +50,13 @@ SINGLE_BATTLE_TEST("Bug Bite eats the target's berry and immediately gains its e
MESSAGE("Wobbuffet used Bug Bite!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_BUG_BITE, player);
HP_BAR(opponent);
if (effect == HOLD_EFFECT_RESTORE_HP) {
if (effect == HOLD_EFFECT_RESTORE_HP || effect == HOLD_EFFECT_ENIGMA_BERRY) {
if (item == ITEM_ORAN_BERRY) {
MESSAGE("Wobbuffet's Oran Berry restored health!");
} else if (item == ITEM_SITRUS_BERRY) {
MESSAGE("Wobbuffet's Sitrus Berry restored health!");
} else {
// MESSAGE("Wobbuffet's Enigma Berry restored health!");
MESSAGE("Wobbuffet's Enigma Berry restored health!");
}
HP_BAR(player);
}

View File

@ -255,6 +255,7 @@ SINGLE_BATTLE_TEST("Fling - thrown berry's effect activates for the target even
PARAMETRIZE { item = ITEM_ORAN_BERRY; effect = HOLD_EFFECT_RESTORE_HP; }
PARAMETRIZE { item = ITEM_SITRUS_BERRY; effect = HOLD_EFFECT_RESTORE_HP; }
PARAMETRIZE { item = ITEM_ENIGMA_BERRY; effect = HOLD_EFFECT_ENIGMA_BERRY; }
PARAMETRIZE { item = ITEM_LEPPA_BERRY; effect = HOLD_EFFECT_RESTORE_PP; }
PARAMETRIZE { item = ITEM_CHESTO_BERRY; effect = HOLD_EFFECT_CURE_SLP; status1 = STATUS1_SLEEP; }
PARAMETRIZE { item = ITEM_CHERI_BERRY; effect = HOLD_EFFECT_CURE_PAR; status1 = STATUS1_PARALYSIS; }
@ -262,6 +263,7 @@ SINGLE_BATTLE_TEST("Fling - thrown berry's effect activates for the target even
PARAMETRIZE { item = ITEM_PECHA_BERRY; effect = HOLD_EFFECT_CURE_PSN; status1 = STATUS1_TOXIC_POISON; }
PARAMETRIZE { item = ITEM_RAWST_BERRY; effect = HOLD_EFFECT_CURE_BRN; status1 = STATUS1_BURN; }
PARAMETRIZE { item = ITEM_ASPEAR_BERRY; effect = HOLD_EFFECT_CURE_FRZ; status1 = STATUS1_FREEZE; }
PARAMETRIZE { item = ITEM_ASPEAR_BERRY; effect = HOLD_EFFECT_CURE_FRZ; status1 = STATUS1_FROSTBITE; }
PARAMETRIZE { item = ITEM_APICOT_BERRY; effect = HOLD_EFFECT_SP_DEFENSE_UP; statId = STAT_SPDEF; }
PARAMETRIZE { item = ITEM_MARANGA_BERRY; effect = HOLD_EFFECT_MARANGA_BERRY; statId = STAT_SPDEF; }
PARAMETRIZE { item = ITEM_GANLON_BERRY; effect = HOLD_EFFECT_DEFENSE_UP; statId = STAT_DEF; }
@ -282,8 +284,10 @@ SINGLE_BATTLE_TEST("Fling - thrown berry's effect activates for the target even
if (effect == HOLD_EFFECT_RESTORE_HP) {
if (item == ITEM_ORAN_BERRY) {
MESSAGE("Foe Wobbuffet's Oran Berry restored health!");
} else {
} else if (item == ITEM_SITRUS_BERRY) {
MESSAGE("Foe Wobbuffet's Sitrus Berry restored health!");
} else {
MESSAGE("Wobbuffet's Enigma Berry restored health!");
}
HP_BAR(opponent);
}
@ -297,6 +301,8 @@ SINGLE_BATTLE_TEST("Fling - thrown berry's effect activates for the target even
MESSAGE("Foe Wobbuffet's Chesto Berry woke it from its sleep!");
} else if (status1 == STATUS1_FREEZE) {
MESSAGE("Foe Wobbuffet's Aspear Berry defrosted it!");
} else if (status1 == STATUS1_FROSTBITE) {
MESSAGE("Foe Wobbuffet's Aspear Berry healed its frostbite!");
} else if (status1 == STATUS1_PARALYSIS) {
MESSAGE("Foe Wobbuffet's Cheri Berry cured paralysis!");
} else if (status1 == STATUS1_TOXIC_POISON || status1 == STATUS1_POISON) {