Code Belch effect

This commit is contained in:
DizzyEggg 2019-02-01 14:17:24 +01:00
parent fab5b86d31
commit a3460c9e45
8 changed files with 50 additions and 4 deletions

View File

@ -341,6 +341,7 @@ gBattleScriptsForMoveEffects:: @ 82D86A8
.4byte BattleScript_EffectAromaticMist
.4byte BattleScript_EffectPowder
.4byte BattleScript_EffectSpAtkUpHit
.4byte BattleScript_EffectBelch
BattleScript_EffectSpAtkUpHit:
setmoveeffect MOVE_EFFECT_SP_ATK_PLUS_1 | MOVE_EFFECT_AFFECTS_USER
@ -1671,6 +1672,7 @@ BattleScript_EffectTechnoBlast:
BattleScript_EffectJudgment:
BattleScript_EffectFusionCombo:
BattleScript_EffectRevelationDance:
BattleScript_EffectBelch:
jumpifnotmove MOVE_SURF, BattleScript_HitFromAtkCanceler
jumpifnostatus3 BS_TARGET, STATUS3_UNDERWATER, BattleScript_HitFromAtkCanceler
orword gHitMarker, HITMARKER_IGNORE_UNDERWATER
@ -5222,6 +5224,14 @@ BattleScript_SelectingNotAllowedMoveTauntInPalace::
BattleScript_SelectingNotAllowedMoveGravity::
printselectionstring STRINGID_GRAVITYPREVENTSUSAGE
endselectionscript
BattleScript_SelectingNotAllowedBelch::
printselectionstring STRINGID_BELCHCANTSELECT
endselectionscript
BattleScript_SelectingNotAllowedBelchInPalace::
printstring STRINGID_PKMNCANTUSEMOVETAUNT
goto BattleScript_SelectingUnusableMoveInPalace
BattleScript_MoveUsedGravityPrevents::
printstring STRINGID_GRAVITYPREVENTSUSAGE

View File

@ -572,6 +572,7 @@ struct BattleStruct
const u8 *trainerSlideMsg;
bool8 trainerSlideLowHpMsgDone;
u8 introState;
u8 ateBerry[2]; // array id determined by side, each party pokemon as bit
};
#define GET_MOVE_TYPE(move, typeArg) \

View File

@ -287,5 +287,7 @@ extern const u8 BattleScript_ProteanActivates[];
extern const u8 BattleScript_DazzlingProtected[];
extern const u8 BattleScript_MoveUsedPsychicTerrainPrevents[];
extern const u8 BattleScript_MoveUsedPowder[];
extern const u8 BattleScript_SelectingNotAllowedBelch[];
extern const u8 BattleScript_SelectingNotAllowedBelchInPalace[];
#endif // GUARD_BATTLE_SCRIPTS_H

View File

@ -329,5 +329,6 @@
#define EFFECT_AROMATIC_MIST 323
#define EFFECT_POWDER 324
#define EFFECT_SP_ATTACK_UP_HIT 325
#define EFFECT_BELCH 326
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H

View File

@ -516,7 +516,8 @@
#define STRINGID_POKEMONCANNOTUSEMOVE 512
#define STRINGID_COVEREDINPOWDER 513
#define STRINGID_POWDEREXPLODES 514
#define STRINGID_BELCHCANTSELECT 515
#define BATTLESTRINGS_COUNT 525
#define BATTLESTRINGS_COUNT 528
#endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H

View File

@ -642,10 +642,12 @@ static const u8 sText_ThirdTypeAdded[] = _("{B_BUFF1} type was added to\n{B_DEF_
static const u8 sText_FellForFeint[] = _("{B_DEF_NAME_WITH_PREFIX} fell for\nthe feint!");
static const u8 sText_PokemonCannotUseMove[] = _("{B_ATK_NAME_WITH_PREFIX} cannot\nuse {B_CURRENT_MOVE}!");
static const u8 sText_CoveredInPowder[] = _("{B_DEF_NAME_WITH_PREFIX} is covered in powder!");
static const u8 sText_PowderExplodes[] = _("When the flame touched the powder \non the Pokémon, it exploded!");
static const u8 sText_PowderExplodes[] = _("When the flame touched the powder\non the Pokémon, it exploded!");
static const u8 sText_BelchCantUse[] = _("Belch cannot be used!\p");
const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] =
{
[STRINGID_BELCHCANTSELECT - 12] = sText_BelchCantUse,
[STRINGID_TRAINER1LOSETEXT - 12] = sText_Trainer1LoseText,
[STRINGID_PKMNGAINEDEXP - 12] = sText_PkmnGainedEXP,
[STRINGID_PKMNGREWTOLV - 12] = sText_PkmnGrewToLv,

View File

@ -579,7 +579,7 @@ static bool32 IsGravityPreventingMove(u32 move)
}
}
static bool32 IsHealBlockPreventingMove(u8 battler, u32 move)
static bool32 IsHealBlockPreventingMove(u32 battler, u32 move)
{
if (!(gStatuses3[battler] & STATUS3_HEAL_BLOCK))
return FALSE;
@ -601,6 +601,14 @@ static bool32 IsHealBlockPreventingMove(u8 battler, u32 move)
}
}
static bool32 IsBelchPreventingMove(u32 battler, u32 move)
{
if (gBattleMoves[move].effect != EFFECT_BELCH)
return FALSE;
return !(gBattleStruct->ateBerry[battler & BIT_SIDE] & gBitTable[gBattlerPartyIndexes[battler]]);
}
u8 TrySetCantSelectMoveBattleScript(void)
{
u32 limitations = 0;
@ -700,6 +708,21 @@ u8 TrySetCantSelectMoveBattleScript(void)
}
}
if (IsBelchPreventingMove(gActiveBattler, move))
{
gCurrentMove = move;
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{
gPalaceSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedBelchInPalace;
gProtectStructs[gActiveBattler].palaceAbleToUseMove = 1;
}
else
{
gSelectionBattleScripts[gActiveBattler] = BattleScript_SelectingNotAllowedBelch;
limitations++;
}
}
gPotentialItemEffectBattler = gActiveBattler;
if (HOLD_EFFECT_CHOICE(holdEffect) && *choicedMove != 0 && *choicedMove != 0xFFFF && *choicedMove != move)
{
@ -778,6 +801,8 @@ u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check)
unusableMoves |= gBitTable[i];
else if (IsHealBlockPreventingMove(battlerId, gBattleMons[battlerId].moves[i]))
unusableMoves |= gBitTable[i];
else if (IsBelchPreventingMove(battlerId, gBattleMons[battlerId].moves[i]))
unusableMoves |= gBitTable[i];
}
return unusableMoves;
}
@ -4223,6 +4248,10 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
break;
}
// Berry was successfully used on a Pokemon.
if (effect && (gLastUsedItem >= FIRST_BERRY_INDEX && gLastUsedItem <= LAST_BERRY_INDEX))
gBattleStruct->ateBerry[battlerId & BIT_SIDE] |= gBitTable[gBattlerPartyIndexes[battlerId]];
return effect;
}

View File

@ -7884,7 +7884,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] =
[MOVE_BELCH] =
{
.effect = EFFECT_PLACEHOLDER, // Needs a custom move effect
.effect = EFFECT_BELCH,
.power = 120,
.type = TYPE_POISON,
.accuracy = 90,