mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Merge pull request #1956 from SonikkuA-DatH/SonikkuA-DatH-Teatime2
Implementing Teatime effect
This commit is contained in:
commit
4dc72dcfc1
@ -1941,6 +1941,31 @@
|
||||
.macro shellsidearmcheck
|
||||
various BS_ATTACKER, VARIOUS_SHELL_SIDE_ARM_CHECK
|
||||
.endm
|
||||
|
||||
.macro jumpifrodaffected battler:req, ptr:req
|
||||
various \battler, VARIOUS_JUMP_IF_ROD
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro jumpifabsorbaffected battler:req, ptr:req
|
||||
various \battler, VARIOUS_JUMP_IF_ABSORB
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro jumpifmotoraffected battler:req, ptr:req
|
||||
various \battler, VARIOUS_JUMP_IF_MOTOR
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro jumpifteanoberry ptr:req
|
||||
various BS_ATTACKER, VARIOUS_TEATIME_TARGETS
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro jumpifteainvulnerable battler:req, ptr:req
|
||||
various \battler, VARIOUS_TEATIME_INVUL
|
||||
.4byte \ptr
|
||||
.endm
|
||||
|
||||
.macro jumpifcantfling battler:req, ptr:req
|
||||
various \battler, VARIOUS_JUMP_IF_CANT_FLING
|
||||
|
@ -13478,7 +13478,18 @@ Move_DRAGON_DARTS::
|
||||
end
|
||||
|
||||
Move_TEATIME::
|
||||
goto Move_MILK_DRINK
|
||||
loadspritegfx ANIM_TAG_TEAPOT
|
||||
loadspritegfx ANIM_TAG_THOUGHT_BUBBLE
|
||||
createsprite gThoughtBubbleSpriteTemplate, ANIM_ATTACKER, 11, 0, 100
|
||||
playsewithpan SE_M_ICY_WIND, SOUND_PAN_ATTACKER
|
||||
delay 6
|
||||
createsprite gTeapotSpriteTemplate, ANIM_ATTACKER, 12, 0
|
||||
createvisualtask AnimTask_RockMonBackAndForth, 5, ANIM_ATTACKER, 2, 0
|
||||
createvisualtask AnimTask_RockMonBackAndForth, 5, ANIM_ATK_PARTNER, 2, 0
|
||||
delay 24
|
||||
loopsewithpan SE_M_HEAL_BELL, SOUND_PAN_ATTACKER, 22, 3
|
||||
waitforvisualfinish
|
||||
end
|
||||
|
||||
Move_OCTOLOCK::
|
||||
loadspritegfx ANIM_TAG_TENDRILS
|
||||
|
@ -416,6 +416,74 @@ gBattleScriptsForMoveEffects::
|
||||
.4byte BattleScript_EffectDoubleShock @ EFFECT_DOUBLE_SHOCK
|
||||
.4byte BattleScript_EffectSpecialAttackUpHit @ EFFECT_SPECIAL_ATTACK_UP_HIT
|
||||
.4byte BattleScript_EffectVictoryDance @ EFFECT_VICTORY_DANCE
|
||||
.4byte BattleScript_EffectTeatime @ EFFECT_TEATIME
|
||||
|
||||
BattleScript_EffectTeatime::
|
||||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
jumpifteanoberry BattleScript_ButItFailed
|
||||
@ at least one battler is affected
|
||||
attackanimation
|
||||
waitanimation
|
||||
BattleScript_TeatimeLoop:
|
||||
jumpifteainvulnerable BS_TARGET, BattleScript_Teatimevul
|
||||
jumpifrodaffected BS_TARGET, BattleScript_Teatimerod
|
||||
jumpifabsorbaffected BS_TARGET, BattleScript_Teatimesorb
|
||||
jumpifmotoraffected BS_TARGET, BattleScript_Teatimemotor
|
||||
orword gHitMarker, HITMARKER_NO_ANIMATIONS | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_IGNORE_DISGUISE
|
||||
setbyte sBERRY_OVERRIDE, TRUE @ override the requirements for eating berries
|
||||
consumeberry BS_TARGET, TRUE @ consume the berry, then restore the item from changedItems
|
||||
bicword gHitMarker, HITMARKER_NO_ANIMATIONS | HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_IGNORE_DISGUISE
|
||||
setbyte sBERRY_OVERRIDE, FALSE
|
||||
removeitem BS_TARGET
|
||||
moveendto MOVEEND_NEXT_TARGET
|
||||
jumpifnexttargetvalid BattleScript_TeatimeLoop
|
||||
moveendcase MOVEEND_CLEAR_BITS
|
||||
goto BattleScript_MoveEnd
|
||||
BattleScript_Teatimevul:
|
||||
moveendto MOVEEND_NEXT_TARGET
|
||||
jumpifnexttargetvalid BattleScript_TeatimeLoop
|
||||
moveendcase MOVEEND_CLEAR_BITS
|
||||
goto BattleScript_MoveEnd
|
||||
BattleScript_Teatimesorb:
|
||||
copybyte gBattlerAbility, gBattlerTarget
|
||||
call BattleScript_AbilityPopUp
|
||||
moveendto MOVEEND_NEXT_TARGET
|
||||
jumpifnexttargetvalid BattleScript_TeatimeLoop
|
||||
moveendcase MOVEEND_CLEAR_BITS
|
||||
goto BattleScript_MoveEnd
|
||||
BattleScript_Teatimerod:
|
||||
copybyte gBattlerAbility, gBattlerTarget
|
||||
call BattleScript_AbilityPopUp
|
||||
playstatchangeanimation BS_TARGET, BIT_SPATK, STAT_CHANGE_BY_TWO
|
||||
setstatchanger STAT_SPATK, 1, FALSE
|
||||
statbuffchange STAT_CHANGE_ALLOW_PTR, BattleScript_TeatimeBuffer
|
||||
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_TeatimeBuffer
|
||||
printfromtable gStatUpStringIds
|
||||
waitmessage 0x40
|
||||
moveendto MOVEEND_NEXT_TARGET
|
||||
jumpifnexttargetvalid BattleScript_TeatimeLoop
|
||||
moveendcase MOVEEND_CLEAR_BITS
|
||||
goto BattleScript_MoveEnd
|
||||
BattleScript_Teatimemotor:
|
||||
copybyte gBattlerAbility, gBattlerTarget
|
||||
call BattleScript_AbilityPopUp
|
||||
playstatchangeanimation BS_TARGET, BIT_SPEED, STAT_CHANGE_BY_TWO
|
||||
setstatchanger STAT_SPEED, 1, FALSE
|
||||
statbuffchange STAT_CHANGE_ALLOW_PTR, BattleScript_TeatimeBuffer
|
||||
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_TeatimeBuffer
|
||||
printfromtable gStatUpStringIds
|
||||
waitmessage 0x40
|
||||
moveendto MOVEEND_NEXT_TARGET
|
||||
jumpifnexttargetvalid BattleScript_TeatimeLoop
|
||||
moveendcase MOVEEND_CLEAR_BITS
|
||||
goto BattleScript_MoveEnd
|
||||
BattleScript_TeatimeBuffer:
|
||||
moveendto MOVEEND_NEXT_TARGET
|
||||
jumpifnexttargetvalid BattleScript_TeatimeLoop
|
||||
moveendcase MOVEEND_CLEAR_BITS
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_AffectionBasedEndurance::
|
||||
playanimation BS_TARGET, B_ANIM_AFFECTION_HANGED_ON
|
||||
|
19
graphics/battle_anims/sprites/new/teapot.pal
Normal file
19
graphics/battle_anims/sprites/new/teapot.pal
Normal file
@ -0,0 +1,19 @@
|
||||
JASC-PAL
|
||||
0100
|
||||
16
|
||||
10 247 12
|
||||
144 141 173
|
||||
255 255 255
|
||||
207 232 255
|
||||
106 104 120
|
||||
190 211 255
|
||||
166 169 214
|
||||
214 171 113
|
||||
162 119 89
|
||||
72 71 81
|
||||
251 255 211
|
||||
232 207 121
|
||||
255 255 153
|
||||
124 86 73
|
||||
0 0 0
|
||||
0 0 0
|
BIN
graphics/battle_anims/sprites/new/teapot.png
Normal file
BIN
graphics/battle_anims/sprites/new/teapot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 881 B |
@ -394,6 +394,8 @@
|
||||
#define ANIM_TAG_OMEGA_SYMBOL (ANIM_SPRITES_START + 382)
|
||||
#define ANIM_TAG_STEEL_BEAM (ANIM_SPRITES_START + 383)
|
||||
#define ANIM_TAG_POLTERGEIST (ANIM_SPRITES_START + 384)
|
||||
#define ANIM_TAG_TEAPOT (ANIM_SPRITES_START + 385)
|
||||
|
||||
|
||||
// battlers
|
||||
#define ANIM_ATTACKER 0
|
||||
|
@ -397,7 +397,9 @@
|
||||
#define EFFECT_DOUBLE_SHOCK 391
|
||||
#define EFFECT_SPECIAL_ATTACK_UP_HIT 392
|
||||
#define EFFECT_VICTORY_DANCE 393
|
||||
#define EFFECT_TEATIME 394
|
||||
|
||||
#define NUM_BATTLE_MOVE_EFFECTS 395
|
||||
|
||||
#define NUM_BATTLE_MOVE_EFFECTS 394
|
||||
|
||||
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H
|
||||
|
@ -247,6 +247,11 @@
|
||||
#define VARIOUS_GET_BATTLER_SIDE 156
|
||||
#define VARIOUS_CHECK_PARENTAL_BOND_COUNTER 157
|
||||
#define VARIOUS_SWAP_STATS 158
|
||||
#define VARIOUS_JUMP_IF_ROD 159
|
||||
#define VARIOUS_JUMP_IF_ABSORB 160
|
||||
#define VARIOUS_JUMP_IF_MOTOR 161
|
||||
#define VARIOUS_TEATIME_INVUL 162
|
||||
#define VARIOUS_TEATIME_TARGETS 163
|
||||
|
||||
// Cmd_manipulatedamage
|
||||
#define DMG_CHANGE_SIGN 0
|
||||
|
@ -9957,6 +9957,8 @@ extern const u32 gBattleAnimSpriteGfx_Tornado[];
|
||||
extern const u32 gBattleAnimSpritePal_Tornado[];
|
||||
extern const u32 gBattleAnimSpriteGfx_ZMoveSymbol[];
|
||||
extern const u32 gBattleAnimSpritePal_ZMoveSymbol[];
|
||||
extern const u32 gBattleAnimSpriteGfx_Teapot[];
|
||||
extern const u32 gBattleAnimSpritePal_Teapot[];
|
||||
|
||||
extern const u32 gBattleAnimBgImage_Dark[];
|
||||
extern const u32 gBattleAnimBgImage_Ghost[];
|
||||
|
@ -2447,6 +2447,39 @@ const struct SpriteTemplate gFollowMeFingerSpriteTemplate =
|
||||
.callback = AnimFollowMeFinger,
|
||||
};
|
||||
|
||||
const union AffineAnimCmd gTeaAffineAnimCmds1[] =
|
||||
{
|
||||
AFFINEANIMCMD_FRAME(0x10, 0x10, 0, 0),
|
||||
AFFINEANIMCMD_FRAME(0x1E, 0x1E, 0, 8),
|
||||
AFFINEANIMCMD_END,
|
||||
};
|
||||
|
||||
const union AffineAnimCmd gTeaAffineAnimCmds2[] =
|
||||
{
|
||||
AFFINEANIMCMD_FRAME(0x0, 0x0, -3, 11),
|
||||
AFFINEANIMCMD_FRAME(0x0, 0x0, 3, 11),
|
||||
AFFINEANIMCMD_LOOP(2),
|
||||
AFFINEANIMCMD_FRAME(0xFFE2, 0xFFE2, 0, 8),
|
||||
AFFINEANIMCMD_END,
|
||||
};
|
||||
|
||||
const union AffineAnimCmd *const gTeaAffineAnimTable[] =
|
||||
{
|
||||
gTeaAffineAnimCmds1,
|
||||
gTeaAffineAnimCmds2,
|
||||
};
|
||||
|
||||
const struct SpriteTemplate gTeapotSpriteTemplate =
|
||||
{
|
||||
.tileTag = ANIM_TAG_TEAPOT,
|
||||
.paletteTag = ANIM_TAG_TEAPOT,
|
||||
.oam = &gOamData_AffineDouble_ObjNormal_64x64,
|
||||
.anims = gDummySpriteAnimTable,
|
||||
.images = NULL,
|
||||
.affineAnims = gTeaAffineAnimTable,
|
||||
.callback = AnimMetronomeFinger,
|
||||
};
|
||||
|
||||
const union AnimCmd gTauntFingerAnimCmds1[] =
|
||||
{
|
||||
ANIMCMD_FRAME(0, 1),
|
||||
|
@ -8130,6 +8130,67 @@ static bool32 IsRototillerAffected(u32 battlerId)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static bool32 IsAbilityRodAffected(void)
|
||||
{
|
||||
u32 moveType;
|
||||
|
||||
if (gBattleStruct->dynamicMoveType == 0)
|
||||
moveType = gBattleMoves[gCurrentMove].type;
|
||||
else if (!(gBattleStruct->dynamicMoveType & 0x40))
|
||||
moveType = gBattleStruct->dynamicMoveType & 0x3F;
|
||||
else
|
||||
moveType = gBattleMoves[gCurrentMove].type;
|
||||
|
||||
if (moveType == TYPE_ELECTRIC && GetBattlerAbility(gBattlerTarget) == ABILITY_LIGHTNING_ROD)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static bool32 IsAbilityMotorAffected(void)
|
||||
{
|
||||
u32 moveType;
|
||||
|
||||
if (gBattleStruct->dynamicMoveType == 0)
|
||||
moveType = gBattleMoves[gCurrentMove].type;
|
||||
else if (!(gBattleStruct->dynamicMoveType & 0x40))
|
||||
moveType = gBattleStruct->dynamicMoveType & 0x3F;
|
||||
else
|
||||
moveType = gBattleMoves[gCurrentMove].type;
|
||||
|
||||
if (moveType == TYPE_ELECTRIC && GetBattlerAbility(gBattlerTarget) == ABILITY_MOTOR_DRIVE)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static bool32 IsAbilityAbsorbAffected(void)
|
||||
{
|
||||
u32 moveType;
|
||||
|
||||
if (gBattleStruct->dynamicMoveType == 0)
|
||||
moveType = gBattleMoves[gCurrentMove].type;
|
||||
else if (!(gBattleStruct->dynamicMoveType & 0x40))
|
||||
moveType = gBattleStruct->dynamicMoveType & 0x3F;
|
||||
else
|
||||
moveType = gBattleMoves[gCurrentMove].type;
|
||||
|
||||
if (moveType == TYPE_ELECTRIC && GetBattlerAbility(gBattlerTarget) == ABILITY_VOLT_ABSORB)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static bool32 IsTeatimeAffected(u32 battlerId)
|
||||
{
|
||||
if (ItemId_GetPocket(gBattleMons[battlerId].item) != POCKET_BERRIES)
|
||||
return FALSE; // Only berries
|
||||
if (gStatuses3[battlerId] & STATUS3_SEMI_INVULNERABLE)
|
||||
return FALSE; // Teatime doesn't affected semi-invulnerable battlers
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#define COURTCHANGE_SWAP(status, structField, temp) \
|
||||
{ \
|
||||
temp = gSideStatuses[B_SIDE_PLAYER]; \
|
||||
@ -10098,6 +10159,45 @@ static void Cmd_various(void)
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, statId);
|
||||
}
|
||||
break;
|
||||
case VARIOUS_TEATIME_TARGETS:
|
||||
{
|
||||
u32 count = 0;
|
||||
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
if (IsTeatimeAffected(i))
|
||||
count++;
|
||||
}
|
||||
if (count == 0)
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); // Teatime fails
|
||||
else
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
return;
|
||||
case VARIOUS_TEATIME_INVUL:
|
||||
if (ItemId_GetPocket(gBattleMons[gActiveBattler].item) == POCKET_BERRIES && !(gStatuses3[gBattlerTarget] & (STATUS3_SEMI_INVULNERABLE)))
|
||||
gBattlescriptCurrInstr += 7;
|
||||
else
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
return;
|
||||
case VARIOUS_JUMP_IF_ROD:
|
||||
if (IsAbilityRodAffected())
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
else
|
||||
gBattlescriptCurrInstr += 7;
|
||||
return;
|
||||
case VARIOUS_JUMP_IF_MOTOR:
|
||||
if (IsAbilityMotorAffected())
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
else
|
||||
gBattlescriptCurrInstr += 7;
|
||||
return;
|
||||
case VARIOUS_JUMP_IF_ABSORB:
|
||||
if (IsAbilityAbsorbAffected())
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
else
|
||||
gBattlescriptCurrInstr += 7;
|
||||
return;
|
||||
} // End of switch (gBattlescriptCurrInstr[2])
|
||||
|
||||
gBattlescriptCurrInstr += 3;
|
||||
|
@ -420,7 +420,7 @@ void HandleAction_UseMove(void)
|
||||
battlerAbility = GetBattlerAbility(gActiveBattler);
|
||||
|
||||
RecordAbilityBattle(gActiveBattler, gBattleMons[gActiveBattler].ability);
|
||||
if (battlerAbility == ABILITY_LIGHTNING_ROD)
|
||||
if (battlerAbility == ABILITY_LIGHTNING_ROD && gCurrentMove != MOVE_TEATIME)
|
||||
gSpecialStatuses[gActiveBattler].lightningRodRedirected = TRUE;
|
||||
else if (battlerAbility == ABILITY_STORM_DRAIN)
|
||||
gSpecialStatuses[gActiveBattler].stormDrainRedirected = TRUE;
|
||||
@ -7982,6 +7982,11 @@ bool32 IsBattlerProtected(u8 battlerId, u16 move)
|
||||
else if (gProtectStructs[battlerId].protected)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (move == MOVE_TEATIME)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Protective Pads doesn't stop Unseen Fist from bypassing Protect effects, so IsMoveMakingContact() isn't used here.
|
||||
// This means extra logic is needed to handle Shell Side Arm.
|
||||
|
@ -1450,6 +1450,7 @@ const struct CompressedSpriteSheet gBattleAnimPicTable[] =
|
||||
{gBattleAnimSpriteGfx_OmegaSymbol, 0x0200, ANIM_TAG_OMEGA_SYMBOL},
|
||||
{gBattleAnimSpriteGfx_Orbs, 0x0180, ANIM_TAG_STEEL_BEAM},
|
||||
{gBattleAnimSpriteGfx_AuraSphere, 0x200, ANIM_TAG_POLTERGEIST},
|
||||
{gBattleAnimSpriteGfx_Teapot, 0x1800, ANIM_TAG_TEAPOT},
|
||||
};
|
||||
|
||||
const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
|
||||
@ -1900,6 +1901,7 @@ const struct CompressedSpritePalette gBattleAnimPaletteTable[] =
|
||||
{gBattleAnimSpritePal_OmegaSymbol, ANIM_TAG_OMEGA_SYMBOL},
|
||||
{gBattleAnimSpritePal_SteelBeam, ANIM_TAG_STEEL_BEAM},
|
||||
{gBattleAnimSpritePal_Poltergeist, ANIM_TAG_POLTERGEIST},
|
||||
{gBattleAnimSpritePal_Teapot, ANIM_TAG_TEAPOT},
|
||||
};
|
||||
|
||||
const struct BattleAnimBackground gBattleAnimBackgroundTable[] =
|
||||
|
@ -12351,13 +12351,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
|
||||
|
||||
[MOVE_TEATIME] =
|
||||
{
|
||||
.effect = EFFECT_PLACEHOLDER, //TODO
|
||||
.effect = EFFECT_TEATIME,
|
||||
.power = 0,
|
||||
.type = TYPE_NORMAL,
|
||||
.accuracy = 0,
|
||||
.pp = 10,
|
||||
.secondaryEffectChance = 0,
|
||||
.target = MOVE_TARGET_ALL_BATTLERS,
|
||||
.target = MOVE_TARGET_USER,
|
||||
.priority = 0,
|
||||
.flags = 0,
|
||||
.split = SPLIT_STATUS,
|
||||
|
@ -286,6 +286,8 @@ const u32 gBattleAnimSpritePal_Tornado[] = INCBIN_U32("graphics/battle_anims/spr
|
||||
const u32 gBattleAnimSpriteGfx_ZMoveSymbol[] = INCBIN_U32("graphics/battle_anims/sprites/z_move_symbol.4bpp.lz");
|
||||
const u32 gBattleAnimSpritePal_ZMoveSymbol[] = INCBIN_U32("graphics/battle_anims/sprites/z_move_symbol.gbapal.lz");
|
||||
|
||||
const u32 gBattleAnimSpriteGfx_Teapot[] = INCBIN_U32("graphics/battle_anims/sprites/new/teapot.4bpp.lz");
|
||||
const u32 gBattleAnimSpritePal_Teapot[] = INCBIN_U32("graphics/battle_anims/sprites/new/teapot.gbapal.lz");
|
||||
|
||||
// Battle anims
|
||||
const u32 gBattleAnimSpriteGfx_Bubble[] = INCBIN_U32("graphics/battle_anims/sprites/bubble.4bpp.lz");
|
||||
|
Loading…
Reference in New Issue
Block a user