mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Updated Teleport
This commit is contained in:
parent
dff72b97dd
commit
f317b542e2
@ -1925,6 +1925,14 @@
|
||||
various BS_ATTACKER, VARIOUS_SHELL_SIDE_ARM_CHECK
|
||||
.endm
|
||||
|
||||
.macro canteleport battler:req
|
||||
various \battler, VARIOUS_CAN_TELEPORT
|
||||
.endm
|
||||
|
||||
.macro getbattlerside battler:req
|
||||
various \battler, VARIOUS_GET_BATTLER_SIDE
|
||||
.endm
|
||||
|
||||
@ helpful macros
|
||||
.macro setstatchanger stat:req, stages:req, down:req
|
||||
setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7
|
||||
|
@ -4822,7 +4822,14 @@ BattleScript_EffectTeleport:
|
||||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
.if B_TELEPORT_BEHAVIOR >= GEN_7
|
||||
canteleport BS_ATTACKER
|
||||
jumpifbyte CMP_EQUAL, gBattleCommunication, TRUE, BattleScript_EffectTeleportNew
|
||||
goto BattleScript_ButItFailed
|
||||
.else
|
||||
jumpifbattletype BATTLE_TYPE_TRAINER, BattleScript_ButItFailed
|
||||
.endif
|
||||
BattleScript_EffectTeleportTryToRunAway:
|
||||
getifcantrunfrombattle BS_ATTACKER
|
||||
jumpifbyte CMP_EQUAL, gBattleCommunication, 1, BattleScript_ButItFailed
|
||||
jumpifbyte CMP_EQUAL, gBattleCommunication, 2, BattleScript_PrintAbilityMadeIneffective
|
||||
@ -4833,6 +4840,29 @@ BattleScript_EffectTeleport:
|
||||
setoutcomeonteleport BS_ATTACKER
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectTeleportNew:
|
||||
getbattlerside BS_ATTACKER
|
||||
jumpifbyte CMP_EQUAL, gBattleCommunication, B_SIDE_OPPONENT, BattleScript_EffectTeleportTryToRunAway
|
||||
attackanimation
|
||||
waitanimation
|
||||
openpartyscreen BS_ATTACKER, BattleScript_EffectTeleportNewEnd
|
||||
switchoutabilities BS_ATTACKER
|
||||
waitstate
|
||||
switchhandleorder BS_ATTACKER, 2
|
||||
returntoball BS_ATTACKER
|
||||
getswitchedmondata BS_ATTACKER
|
||||
switchindataupdate BS_ATTACKER
|
||||
hpthresholds BS_ATTACKER
|
||||
trytoclearprimalweather
|
||||
printstring STRINGID_EMPTYSTRING3
|
||||
waitmessage 1
|
||||
printstring STRINGID_SWITCHINMON
|
||||
switchinanim BS_ATTACKER, TRUE
|
||||
waitstate
|
||||
switchineffects BS_ATTACKER
|
||||
BattleScript_EffectTeleportNewEnd:
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectBeatUp::
|
||||
attackcanceler
|
||||
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
|
||||
|
@ -161,6 +161,7 @@
|
||||
#define B_BRICK_BREAK GEN_7 // In Gen4+, you can destroy your own side's screens. In Gen 5+, screens are not removed if the target is immune.
|
||||
#define B_WISH_HP_SOURCE GEN_7 // In Gen5+, Wish heals half of the user's max HP instead of the target's.
|
||||
#define B_RAMPAGE_CANCELLING GEN_7 // In Gen5+, a failed Thrash, etc, will cancel except on its last turn.
|
||||
#define B_TELEPORT_BEHAVIOR GEN_7 // In LGPE+, Teleport lets the user swap out with another party member.
|
||||
|
||||
// Ability settings
|
||||
#define B_ABILITY_WEATHER GEN_7 // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move or a different weather-affecting ability.
|
||||
|
@ -208,6 +208,8 @@
|
||||
#define VARIOUS_SET_OCTOLOCK 135
|
||||
#define VARIOUS_CUT_1_3_HP_RAISE_STATS 136
|
||||
#define VARIOUS_TRY_END_NEUTRALIZING_GAS 137
|
||||
#define VARIOUS_CAN_TELEPORT 138
|
||||
#define VARIOUS_GET_BATTLER_SIDE 139
|
||||
|
||||
// Cmd_manipulatedamage
|
||||
#define DMG_CHANGE_SIGN 0
|
||||
|
@ -7505,6 +7505,37 @@ static bool32 IsRototillerAffected(u32 battlerId)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool32 CanTeleport(u8 battlerId)
|
||||
{
|
||||
struct Pokemon* party = NULL;
|
||||
u32 species, count, i;
|
||||
|
||||
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
|
||||
party = gPlayerParty;
|
||||
else
|
||||
party = gEnemyParty;
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
species = GetMonData(&party[i], MON_DATA_SPECIES2);
|
||||
if (species != SPECIES_NONE && species != SPECIES_EGG && GetMonData(&party[i], MON_DATA_HP) != 0)
|
||||
count++;
|
||||
}
|
||||
|
||||
switch (GetBattlerSide(battlerId))
|
||||
{
|
||||
case B_SIDE_OPPONENT:
|
||||
if (WILD_DOUBLE_BATTLE || gBattleTypeFlags & BATTLE_TYPE_TRAINER)
|
||||
return FALSE;
|
||||
case B_SIDE_PLAYER:
|
||||
if (((gBattleTypeFlags & BATTLE_TYPE_DOUBLE && count >= 3) || (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && count >= 2)))
|
||||
return TRUE;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void Cmd_various(void)
|
||||
{
|
||||
struct Pokemon *mon;
|
||||
@ -9281,6 +9312,15 @@ static void Cmd_various(void)
|
||||
gBattlescriptCurrInstr += 7;
|
||||
return;
|
||||
}
|
||||
case VARIOUS_CAN_TELEPORT:
|
||||
gBattleCommunication[0] = CanTeleport(gActiveBattler);
|
||||
break;
|
||||
case VARIOUS_GET_BATTLER_SIDE:
|
||||
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
|
||||
gBattleCommunication[0] = B_SIDE_PLAYER;
|
||||
else
|
||||
gBattleCommunication[0] = B_SIDE_OPPONENT;
|
||||
break;
|
||||
} // End of switch (gBattlescriptCurrInstr[2])
|
||||
|
||||
gBattlescriptCurrInstr += 3;
|
||||
|
Loading…
Reference in New Issue
Block a user