Merge branch 'BattleEngine' into PR-LGPE_IOA_Moves

# Conflicts:
#	src/data/text/move_descriptions.h
This commit is contained in:
Eduardo Quezada 2020-10-24 00:36:29 -03:00
commit b5834b617d
17 changed files with 2294 additions and 1345 deletions

View File

@ -8605,23 +8605,23 @@ Move_ELECTRIFY::
playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_TARGET
launchtemplate gElectrifyYellowRingTemplate 0x3 0x6 0x0 0x0 0x1 0x0 0x1f 0x8
launchtask AnimTask_ShakeMon 0x5 0x5 ANIM_TARGET 0x4 0x0 0x6 0x1
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x5 0x0 0x5 0x0, ANIM_TARGET
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x5 0x0 0x5 0x0
delay 0x1
launchtemplate gElectrifyYellowRingTemplate 0x3 0x6 0x0 0x0 0x1 0x0 0x1f 0x8
delay 0x1
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfffb 0xa 0x5 0x1, ANIM_TARGET
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfffb 0xa 0x5 0x1
launchtemplate gElectrifyYellowRingTemplate 0x3 0x6 0x0 0x0 0x1 0x0 0x1f 0x8
delay 0x1
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xf 0x14 0x5 0x2, ANIM_TARGET
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff1 0xfff6 0x5 0x0, ANIM_TARGET
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xf 0x14 0x5 0x2
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff1 0xfff6 0x5 0x0
delay 0x2
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x19 0x0 0x5 0x1, ANIM_TARGET
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x19 0x0 0x5 0x1
delay 0x2
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff8 0x8 0x5 0x2, ANIM_TARGET
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff8 0x8 0x5 0x2
delay 0x2
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x2 0xfff8 0x5 0x0, ANIM_TARGET
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x2 0xfff8 0x5 0x0
delay 0x2
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xffec 0xf 0x5 0x1, ANIM_TARGET
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xffec 0xf 0x5 0x1
waitforvisualfinish
launchtask AnimTask_BlendBattleAnimPal 0xA 0x5 ANIM_PAL_DEF 0x2 0xB 0x0 0x039B
launchtask AnimTask_BlendBattleAnimPal 0xa 0x5 ANIM_PAL_BG 0x1 0x3 0x0 0x039B
@ -9139,20 +9139,20 @@ Move_EERIE_IMPULSE::
waitforvisualfinish
playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER
launchtemplate gEerieImpulseImpactTemplate 0x2 0x6 0x0 0xfffb 0x1 0x0 0x20 0x10
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x5 0x0 0x5 0x0, ANIM_TARGET
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfffb 0xa 0x5 0x1, ANIM_TARGET
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x5 0x0 0x5 0x0
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfffb 0xa 0x5 0x1
delay 0x7
launchtemplate gEerieImpulseImpactTemplate 0x2 0x6 0xfff1 0xa 0x1 0x0 0x20 0x10
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xf 0x14 0x5 0x2, ANIM_TARGET
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff1 0xfff6 0x5 0x0, ANIM_TARGET
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xf 0x14 0x5 0x2
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff1 0xfff6 0x5 0x0
delay 0x7
launchtemplate gEerieImpulseImpactTemplate 0x2 0x6 0xfff1 0xfff1 0x1 0x0 0x20 0x10
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x19 0x0 0x5 0x1, ANIM_TARGET
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff8 0x8 0x5 0x2, ANIM_TARGET
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x19 0x0 0x5 0x1
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xfff8 0x8 0x5 0x2
delay 0x7
launchtemplate gEerieImpulseImpactTemplate 0x2 0x6 0xa 0xfffb 0x1 0x0 0x20 0x10
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x2 0xfff8 0x5 0x0, ANIM_TARGET
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xffec 0xf 0x5 0x1, ANIM_TARGET
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0x2 0xfff8 0x5 0x0
launchtemplate gElectricitySpriteTemplate 0x82, 0x4, 0xffec 0xf 0x5 0x1
waitforvisualfinish
clearmonbg ANIM_DEF_PARTNER
end

View File

@ -8,6 +8,7 @@
#include "constants/moves.h"
#include "constants/songs.h"
#include "constants/game_stat.h"
#include "constants/battle_config.h"
.include "asm/macros.inc"
.include "asm/macros/battle_script.inc"
.include "constants/constants.inc"
@ -3823,7 +3824,41 @@ BattleScript_EffectBatonPass::
goto BattleScript_MoveEnd
BattleScript_EffectRapidSpin::
.if B_SPEED_BUFFING_RAPID_SPIN == GEN_8
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
critcalc
damagecalc
adjustdamage
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage 0x40
resultmessage
waitmessage 0x40
setmoveeffect MOVE_EFFECT_RAPIDSPIN | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
seteffectwithchance
setstatchanger STAT_SPEED, 1, FALSE
statbuffchange MOVE_EFFECT_AFFECTS_USER | STAT_BUFF_ALLOW_PTR, BattleScript_EffectRapidSpinEnd
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x2, BattleScript_EffectRapidSpinEnd
setgraphicalstatchangevalues
playanimation BS_ATTACKER, B_ANIM_STATS_CHANGE, sB_ANIM_ARG1
printfromtable gStatUpStringIds
waitmessage 0x40
BattleScript_EffectRapidSpinEnd::
tryfaintmon BS_TARGET, FALSE, NULL
moveendall
end
.else
setmoveeffect MOVE_EFFECT_RAPIDSPIN | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
.endif
goto BattleScript_EffectHit
BattleScript_EffectSonicboom::

View File

@ -127,5 +127,6 @@ bool32 CanBattlerGetOrLoseItem(u8 battlerId, u16 itemId);
struct Pokemon *GetIllusionMonPtr(u32 battlerId);
void ClearIllusionMon(u32 battlerId);
bool32 SetIllusionMon(struct Pokemon *mon, u32 battlerId);
bool8 ShouldGetStatBadgeBoost(u16 flagId, u8 battlerId);
#endif // GUARD_BATTLE_UTIL_H

View File

@ -1,61 +1,69 @@
#ifndef GUARD_CONSTANTS_BATTLE_CONFIG_H
#define GUARD_CONSTANTS_BATTLE_CONFIG_H
// Species with peculiar battle effects. Remove them if they're properly placed in constant/species.h
#define SPECIES_DIALGA 0
#define SPECIES_PALKIA 0
#define SPECIES_GIRATINA 0
#define SPECIES_CHERRIM 0
#define SPECIES_ARCEUS 0
#define SPECIES_SILVALLY 0
#define SPECIES_GENESECT 0
#define SPECIES_AEGISLASH 0
#define SPECIES_AEGISLASH_BLADE 10000
#define SPECIES_MIMIKYU 0
#define SPECIES_MIMIKYU_BUSTED 10001
#define SPECIES_DARMANITAN 0
#define SPECIES_DARMANITAN_ZEN 10002
#define SPECIES_MINIOR_CORE 0
#define SPECIES_MINIOR 10003
#define SPECIES_WISHIWASHI 0
#define SPECIES_WISHIWASHI_SCHOOL 10004
#define SPECIES_ZYGARDE 0 // 50%
#define SPECIES_ZYGARDE_10 10005 // 10 %
#define SPECIES_ZYGARDE_COMPLETE 10006 // 100 %
#define BATTLE_ENGINE
// Items with peculiar battle effects. Remove them if they're properly placed in constant/items.h
#define ITEM_GRISEOUS_ORB 0
#define ITEM_OCCA_BERRY 204
#define ITEM_PASSHO_BERRY 205
#define ITEM_WACAN_BERRY 206
#define ITEM_RINDO_BERRY 207
#define ITEM_YACHE_BERRY 208
#define ITEM_CHOPLE_BERRY 177
#define ITEM_KEBIA_BERRY 178
#define ITEM_SHUCA_BERRY 179
#define ITEM_COBA_BERRY 180
#define ITEM_PAYAPA_BERRY 181
#define ITEM_TANGA_BERRY 182
#define ITEM_CHARTI_BERRY 183
#define ITEM_KASIB_BERRY 184
#define ITEM_HABAN_BERRY 185
#define ITEM_COLBUR_BERRY 186
#define ITEM_BABIRI_BERRY 187
#define ITEM_CHILAN_BERRY 188
#define ITEM_ROSELI_BERRY 189
#define ITEM_MICLE_BERRY 197
#define ITEM_CUSTAP_BERRY 199
#define ITEM_JABOCA_BERRY 200
#define ITEM_ROWAP_BERRY 201
#define ITEM_KEE_BERRY 202
#define ITEM_MARANGA_BERRY 203
// Species with peculiar battle effects.
#ifndef POKEMON_EXPANSION
#define SPECIES_DIALGA 0
#define SPECIES_PALKIA 0
#define SPECIES_GIRATINA 0
#define SPECIES_CHERRIM 0
#define SPECIES_ARCEUS 0
#define SPECIES_SILVALLY 0
#define SPECIES_GENESECT 0
#define SPECIES_AEGISLASH 0
#define SPECIES_AEGISLASH_BLADE 10000
#define SPECIES_MIMIKYU 0
#define SPECIES_MIMIKYU_BUSTED 10001
#define SPECIES_DARMANITAN 0
#define SPECIES_DARMANITAN_ZEN 10002
#define SPECIES_MINIOR_CORE 0
#define SPECIES_MINIOR 10003
#define SPECIES_WISHIWASHI 0
#define SPECIES_WISHIWASHI_SCHOOL 10004
#define SPECIES_ZYGARDE 0 // 50%
#define SPECIES_ZYGARDE_10 10005 // 10 %
#define SPECIES_ZYGARDE_COMPLETE 10006 // 100 %
#endif
#define GEN_3 0
#define GEN_4 1
#define GEN_5 2
#define GEN_6 3
#define GEN_7 4
#define GEN_8 5
// Items with peculiar battle effects.
#ifndef ITEM_EXPANSION
#define ITEM_CHOPLE_BERRY 177
#define ITEM_KEBIA_BERRY 178
#define ITEM_SHUCA_BERRY 179
#define ITEM_COBA_BERRY 180
#define ITEM_PAYAPA_BERRY 181
#define ITEM_TANGA_BERRY 182
#define ITEM_CHARTI_BERRY 183
#define ITEM_KASIB_BERRY 184
#define ITEM_HABAN_BERRY 185
#define ITEM_COLBUR_BERRY 186
#define ITEM_BABIRI_BERRY 187
#define ITEM_CHILAN_BERRY 188
#define ITEM_ROSELI_BERRY 189
#define ITEM_MICLE_BERRY 197
#define ITEM_CUSTAP_BERRY 199
#define ITEM_JABOCA_BERRY 200
#define ITEM_ROWAP_BERRY 201
#define ITEM_KEE_BERRY 202
#define ITEM_MARANGA_BERRY 203
#define ITEM_OCCA_BERRY 204
#define ITEM_PASSHO_BERRY 205
#define ITEM_WACAN_BERRY 206
#define ITEM_RINDO_BERRY 207
#define ITEM_YACHE_BERRY 208
#define ITEM_GRISEOUS_ORB 369
#endif
#ifndef GEN_3
#define GEN_3 0
#define GEN_4 1
#define GEN_5 2
#define GEN_6 3
#define GEN_7 4
#define GEN_8 5
#endif
// Calculation settings
#define B_CRIT_CHANCE GEN_6 // Chances of a critical hit landing. See CalcCritChanceStage.
@ -70,13 +78,19 @@
#define B_MULTI_HIT_CHANCE GEN_6 // In Gen5+, multi-hit moves have different %. See Cmd_setmultihitcounter for values.
#define B_RECOIL_IF_MISS_DMG GEN_6 // In Gen5+, Jump Kick and Hi Jump Kick will always do half of the user's max HP when missing.
#define B_PSYWAVE_DMG GEN_6 // Psywave's damage formula. See Cmd_psywavedamageeffect.
#define B_BADGE_BOOST GEN_6 // In Gen4+, Gym Badges no longer boost a Pokémon's stats
// Move settings
// Move data settings
#define B_UPDATED_MOVE_DATA GEN_7 // Updates move data in gBattleMoves, including Power, Accuracy, PP, stat changes, targets, chances of secondary effects, etc.
#define B_FELL_STINGER_STAT_RAISE GEN_6 // In Gen7+, it raises Atk by 3 stages instead of 2 if it causes the target to faint.
#define B_KINGS_SHIELD_LOWER_ATK GEN_6 // In Gen7+, it lowers Atk by 1 stage instead of 2 of oponents that hit it.
#define B_SPEED_BUFFING_RAPID_SPIN GEN_8 // In Gen8, Rapid Spin raises the user's Speed by 1 stage.
#define B_WATER_SHURIKEN_SPLIT GEN_8 // In Gen7, Water Shuriken was changed from Physical to Special.
// Other move settings
#define B_SOUND_SUBSTITUTE GEN_6 // In Gen6+, sound moves bypass Substitute.
#define B_TOXIC_NEVER_MISS GEN_6 // In Gen6+, if Toxic is used by a Poison type, it will never miss.
#define B_PAYBACK_SWITCH_BOOST GEN_6 // In Gen5+, if the opponent switches out, Payback's damage will no longer be doubled.
#define B_KINGS_SHIELD_LOWER_ATK GEN_6 // In Gen7+, it lowers Atk by 1 stage instead of 2 of oponents that hit it.
#define B_BINDING_TURNS GEN_6 // In Gen5+, binding moves last for 4-5 turns instead of 2-5 turns. (With Grip Claw, 7 and 5 turns respectively.)
#define B_UPROAR_TURNS GEN_6 // In Gen5+, Uproar lasts for 3 turns instead of 2-5 turns.
#define B_DISABLE_TURNS GEN_6 // Disable's turns. See Cmd_disablelastusedattack.
@ -84,7 +98,6 @@
#define B_MINIMIZE_DMG_ACC GEN_6 // In Gen6+, moves that causes double damage to minimized Pokémon will also skip accuracy checks.
// Ability settings
#define B_ABILITY_POP_UP GEN_6 // In Gen5+, the Pokémon abilities are displayed in a pop-up, when they activate in battle.
#define B_ABILITY_WEATHER GEN_6 // In Gen5+, weather caused by abilities lasts the same amount of turns as induced from a move. Before, they lasted till the battle's end or weather change by a move.
#define B_GALE_WINGS GEN_6 // In Gen7+ requires full HP to trigger.
#define B_STANCE_CHANGE_FAIL GEN_7 // In Gen7+, Aegislash's form change does not happen, if the Pokémon cannot use a move, because of confusion, paralysis, etc. In gen6, the form change occurs despite not being able to move.
@ -97,29 +110,36 @@
#define B_HP_BERRIES GEN_6 // In Gen4+, berries which restore hp activate immediately after hp drops to half. In gen3, the effect occurs at the end of the turn.
#define B_BERRIES_INSTANT GEN_6 // In Gen4+, most berries activate on battle start/switch-in if applicable. In gen3, they only activate either at the move end or turn end.
// Other
#define B_FLAG_INVERSE_BATTLE 0 // If this flag is set, the battle's type effectiveness are inversed. For example, fire is super effective against water. 0 disables the feature.
// Flag settings. Replace the 0s with defined flags to be able to toggle the following features using those flags.
#define B_FLAG_INVERSE_BATTLE 0 // If the flag is set, the battle's type effectiveness are inversed. For example, fire is super effective against water.
#define B_FLAG_FORCE_DOUBLE_WILD 0 // If the flag is set, all land and surfing wild battles will be double battles.
// Interface settings
#define B_ABILITY_POP_UP TRUE // In Gen5+, the Pokémon abilities are displayed in a pop-up, when they activate in battle.
#define B_FAST_INTRO TRUE // If set to TRUE, battle intro texts print at the same time as animation of a Pokémon, as opposing to waiting for the animation to end.
#define B_SHOW_TARGETS TRUE // If set to TRUE, all available targets, for moves hitting 2 or 3 Pokémon, will be shown before selecting a move.
// Other
#define B_DOUBLE_WILD_CHANCE 0 // % chance of encountering two Pokémon in a Wild Encounter.
#define B_SLEEP_TURNS GEN_6 // In Gen5+, sleep lasts for 1-3 turns instead of 2-5 turns.
#define B_PARALYZE_ELECTRIC GEN_6 // In Gen6+, Electric type Pokémon can't be paralyzed.
#define B_POWDER_GRASS GEN_6 // In Gen6+, Grass type Pokémon are immune to powder and spore moves.
// Animation Settings
#define NEW_SWORD_PARTICLE TRUE // update swords dance particle
#define NEW_LEECH_SEED_PARTICLE TRUE //update leech seed's animation particle
#define NEW_HORN_ATTACK_PARTICLE TRUE //update horn attack's horn
#define NEW_LEAF_PARTICLE TRUE // update leaf particle
#define NEW_EMBER_PARTICLES TRUE //updates ember fire particle
#define NEW_MEAN_LOOK_PARTICLE TRUE //update mean look eye
#define NEW_TEETH_PARTICLE TRUE //update bite/crunch teeth particle
#define NEW_HANDS_FEET_PARTICLE TRUE //update chop/kick/punch particles
#define NEW_SPIKES_PARTICLE TRUE //update spikes particle
#define NEW_FLY_BUBBLE_PARTICLE TRUE //update fly 'bubble' particle
#define NEW_CURSE_NAIL_PARTICLE TRUE //updates curse nail
#define NEW_BATON_PASS_BALL_PARTICLE TRUE //update baton pass pokeball sprite
#define NEW_MORNING_SUN_STAR_PARTICLE TRUE //updates morning sun star particles
#define NEW_IMPACT_PALETTE TRUE //updates the basic 'hit' particle
#define NEW_SURF_PARTICLE_PALETTE TRUE //updates the surf wave palette
#define B_NEW_SWORD_PARTICLE TRUE // update swords dance particle
#define B_NEW_LEECH_SEED_PARTICLE TRUE //update leech seed's animation particle
#define B_NEW_HORN_ATTACK_PARTICLE TRUE //update horn attack's horn
#define B_NEW_LEAF_PARTICLE TRUE // update leaf particle
#define B_NEW_EMBER_PARTICLES TRUE //updates ember fire particle
#define B_NEW_MEAN_LOOK_PARTICLE TRUE //update mean look eye
#define B_NEW_TEETH_PARTICLE TRUE //update bite/crunch teeth particle
#define B_NEW_HANDS_FEET_PARTICLE TRUE //update chop/kick/punch particles
#define B_NEW_SPIKES_PARTICLE TRUE //update spikes particle
#define B_NEW_FLY_BUBBLE_PARTICLE TRUE //update fly 'bubble' particle
#define B_NEW_CURSE_NAIL_PARTICLE TRUE //updates curse nail
#define B_NEW_BATON_PASS_BALL_PARTICLE TRUE //update baton pass pokeball sprite
#define B_NEW_MORNING_SUN_STAR_PARTICLE TRUE //updates morning sun star particles
#define B_NEW_IMPACT_PALETTE TRUE //updates the basic 'hit' particle
#define B_NEW_SURF_PARTICLE_PALETTE TRUE //updates the surf wave palette
#endif // GUARD_CONSTANTS_BATTLE_CONFIG_H

View File

@ -102,7 +102,7 @@
#define HOLD_EFFECT_GRISEOUS_ORB 96
#define HOLD_EFFECT_GRACIDEA 97
#define HOLD_EFFECT_RESIST_BERRY 98
#define HOLD_EFFECT_EV_BOOST 99
#define HOLD_EFFECT_POWER_ITEM 99
#define HOLD_EFFECT_RESTORE_PCT_HP 100
// Gen5 hold effects

View File

@ -204,6 +204,7 @@ struct BaseStats
u8 noFlip : 1;
};
#include "constants/battle_config.h"
struct BattleMove
{
u16 effect;

View File

@ -40,5 +40,6 @@ void FishingWildEncounter(u8 rod);
u16 GetLocalWildMon(bool8 *isWaterMon);
u16 GetLocalWaterMon(void);
bool8 UpdateRepelCounter(void);
bool8 TryDoDoubleWildBattle(void);
#endif // GUARD_WILD_ENCOUNTER_H

View File

@ -299,7 +299,7 @@ static void sub_805F560(void)
TryShinyAnimation(gActiveBattler, &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]]);
if (!(gBattleTypeFlags & BATTLE_TYPE_TWO_OPPONENTS)
&& !(gBattleTypeFlags & BATTLE_TYPE_MULTI)
&& (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) || BATTLE_TWO_VS_ONE_OPPONENT)
&& IsDoubleBattle()
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].triedShinyMonAnim
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive

View File

@ -2956,7 +2956,7 @@ void CreateAbilityPopUp(u8 battlerId, u32 ability, bool32 isDoubleBattle)
const s16 (*coords)[2];
u8 spriteId1, spriteId2, battlerPosition, taskId;
if (B_ABILITY_POP_UP < GEN_5)
if (!B_ABILITY_POP_UP)
return;
if (!gBattleStruct->activeAbilityPopUps)

View File

@ -4235,14 +4235,14 @@ u32 GetBattlerTotalSpeedStat(u8 battlerId)
// player's badge boost
if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000 | BATTLE_TYPE_FRONTIER))
&& FlagGet(FLAG_BADGE03_GET)
&& ShouldGetStatBadgeBoost(FLAG_BADGE03_GET, battlerId)
&& GetBattlerSide(battlerId) == B_SIDE_PLAYER)
{
speed = (speed * 110) / 100;
}
// item effects
if (GetBattlerHoldEffect(battlerId, FALSE) == HOLD_EFFECT_MACHO_BRACE || GetBattlerHoldEffect(battlerId, FALSE) == HOLD_EFFECT_EV_BOOST)
if (GetBattlerHoldEffect(battlerId, FALSE) == HOLD_EFFECT_MACHO_BRACE || GetBattlerHoldEffect(battlerId, FALSE) == HOLD_EFFECT_POWER_ITEM)
speed /= 2;
else if (holdEffect == HOLD_EFFECT_IRON_BALL)
speed /= 2;

View File

@ -337,262 +337,262 @@ static void Cmd_metalburstdamagecalculator(void);
void (* const gBattleScriptingCommandsTable[])(void) =
{
Cmd_attackcanceler, // 0x0
Cmd_accuracycheck, // 0x1
Cmd_attackstring, // 0x2
Cmd_ppreduce, // 0x3
Cmd_critcalc, // 0x4
Cmd_damagecalc, // 0x5
Cmd_typecalc, // 0x6
Cmd_adjustdamage, // 0x7
Cmd_multihitresultmessage, // 0x8
Cmd_attackanimation, // 0x9
Cmd_waitanimation, // 0xA
Cmd_healthbarupdate, // 0xB
Cmd_datahpupdate, // 0xC
Cmd_critmessage, // 0xD
Cmd_effectivenesssound, // 0xE
Cmd_resultmessage, // 0xF
Cmd_printstring, // 0x10
Cmd_printselectionstring, // 0x11
Cmd_waitmessage, // 0x12
Cmd_printfromtable, // 0x13
Cmd_printselectionstringfromtable, // 0x14
Cmd_seteffectwithchance, // 0x15
Cmd_seteffectprimary, // 0x16
Cmd_seteffectsecondary, // 0x17
Cmd_clearstatusfromeffect, // 0x18
Cmd_tryfaintmon, // 0x19
Cmd_dofaintanimation, // 0x1A
Cmd_cleareffectsonfaint, // 0x1B
Cmd_jumpifstatus, // 0x1C
Cmd_jumpifstatus2, // 0x1D
Cmd_jumpifability, // 0x1E
Cmd_jumpifsideaffecting, // 0x1F
Cmd_jumpifstat, // 0x20
Cmd_jumpifstatus3condition, // 0x21
Cmd_jumpbasedontype, // 0x22
Cmd_getexp, // 0x23
atk24, // 0x24
Cmd_movevaluescleanup, // 0x25
Cmd_setmultihit, // 0x26
Cmd_decrementmultihit, // 0x27
Cmd_goto, // 0x28
Cmd_jumpifbyte, // 0x29
Cmd_jumpifhalfword, // 0x2A
Cmd_jumpifword, // 0x2B
Cmd_jumpifarrayequal, // 0x2C
Cmd_jumpifarraynotequal, // 0x2D
Cmd_setbyte, // 0x2E
Cmd_addbyte, // 0x2F
Cmd_subbyte, // 0x30
Cmd_copyarray, // 0x31
Cmd_copyarraywithindex, // 0x32
Cmd_orbyte, // 0x33
Cmd_orhalfword, // 0x34
Cmd_orword, // 0x35
Cmd_bicbyte, // 0x36
Cmd_bichalfword, // 0x37
Cmd_bicword, // 0x38
Cmd_pause, // 0x39
Cmd_waitstate, // 0x3A
Cmd_update, // 0x3B
Cmd_return, // 0x3C
Cmd_end, // 0x3D
Cmd_end2, // 0x3E
Cmd_end3, // 0x3F
Cmd_jumpifaffectedbyprotect, // 0x40
Cmd_call, // 0x41
Cmd_setroost, // 0x42
Cmd_jumpifabilitypresent, // 0x43
Cmd_endselectionscript, // 0x44
Cmd_playanimation, // 0x45
Cmd_playanimation2, // 0x46
Cmd_setgraphicalstatchangevalues, // 0x47
Cmd_playstatchangeanimation, // 0x48
Cmd_moveend, // 0x49
Cmd_sethealblock, // 0x4A
Cmd_returnatktoball, // 0x4B
Cmd_getswitchedmondata, // 0x4C
Cmd_switchindataupdate, // 0x4D
Cmd_switchinanim, // 0x4E
Cmd_jumpifcantswitch, // 0x4F
Cmd_openpartyscreen, // 0x50
Cmd_switchhandleorder, // 0x51
Cmd_switchineffects, // 0x52
Cmd_trainerslidein, // 0x53
Cmd_playse, // 0x54
Cmd_fanfare, // 0x55
Cmd_playfaintcry, // 0x56
atk57, // 0x57
Cmd_returntoball, // 0x58
Cmd_handlelearnnewmove, // 0x59
Cmd_yesnoboxlearnmove, // 0x5A
Cmd_yesnoboxstoplearningmove, // 0x5B
Cmd_hitanimation, // 0x5C
Cmd_getmoneyreward, // 0x5D
atk5E, // 0x5E
Cmd_swapattackerwithtarget, // 0x5F
Cmd_incrementgamestat, // 0x60
Cmd_drawpartystatussummary, // 0x61
Cmd_hidepartystatussummary, // 0x62
Cmd_jumptocalledmove, // 0x63
Cmd_statusanimation, // 0x64
Cmd_status2animation, // 0x65
Cmd_chosenstatusanimation, // 0x66
Cmd_yesnobox, // 0x67
Cmd_cancelallactions, // 0x68
Cmd_setgravity, // 0x69
Cmd_removeitem, // 0x6A
Cmd_atknameinbuff1, // 0x6B
Cmd_drawlvlupbox, // 0x6C
Cmd_resetsentmonsvalue, // 0x6D
Cmd_setatktoplayer0, // 0x6E
Cmd_makevisible, // 0x6F
Cmd_recordability, // 0x70
Cmd_buffermovetolearn, // 0x71
Cmd_jumpifplayerran, // 0x72
Cmd_hpthresholds, // 0x73
Cmd_hpthresholds2, // 0x74
Cmd_useitemonopponent, // 0x75
Cmd_various, // 0x76
Cmd_setprotectlike, // 0x77
Cmd_faintifabilitynotdamp, // 0x78
Cmd_setatkhptozero, // 0x79
Cmd_jumpifnexttargetvalid, // 0x7A
Cmd_tryhealhalfhealth, // 0x7B
Cmd_trymirrormove, // 0x7C
Cmd_setrain, // 0x7D
Cmd_setreflect, // 0x7E
Cmd_setseeded, // 0x7F
Cmd_manipulatedamage, // 0x80
Cmd_trysetrest, // 0x81
Cmd_jumpifnotfirstturn, // 0x82
Cmd_setmiracleeye, // 0x83
Cmd_jumpifcantmakeasleep, // 0x84
Cmd_stockpile, // 0x85
Cmd_stockpiletobasedamage, // 0x86
Cmd_stockpiletohpheal, // 0x87
Cmd_setdrainedhp, // 0x88
Cmd_statbuffchange, // 0x89
Cmd_normalisebuffs, // 0x8A
Cmd_setbide, // 0x8B
Cmd_confuseifrepeatingattackends, // 0x8C
Cmd_setmultihitcounter, // 0x8D
Cmd_initmultihitstring, // 0x8E
Cmd_forcerandomswitch, // 0x8F
Cmd_tryconversiontypechange, // 0x90
Cmd_givepaydaymoney, // 0x91
Cmd_setlightscreen, // 0x92
Cmd_tryKO, // 0x93
Cmd_damagetohalftargethp, // 0x94
Cmd_setsandstorm, // 0x95
Cmd_weatherdamage, // 0x96
Cmd_tryinfatuating, // 0x97
Cmd_updatestatusicon, // 0x98
Cmd_setmist, // 0x99
Cmd_setfocusenergy, // 0x9A
Cmd_transformdataexecution, // 0x9B
Cmd_setsubstitute, // 0x9C
Cmd_mimicattackcopy, // 0x9D
Cmd_metronome, // 0x9E
Cmd_dmgtolevel, // 0x9F
Cmd_psywavedamageeffect, // 0xA0
Cmd_counterdamagecalculator, // 0xA1
Cmd_mirrorcoatdamagecalculator, // 0xA2
Cmd_disablelastusedattack, // 0xA3
Cmd_trysetencore, // 0xA4
Cmd_painsplitdmgcalc, // 0xA5
Cmd_settypetorandomresistance, // 0xA6
Cmd_setalwayshitflag, // 0xA7
Cmd_copymovepermanently, // 0xA8
Cmd_trychoosesleeptalkmove, // 0xA9
Cmd_setdestinybond, // 0xAA
Cmd_trysetdestinybondtohappen, // 0xAB
Cmd_settailwind, // 0xAC
Cmd_tryspiteppreduce, // 0xAD
Cmd_healpartystatus, // 0xAE
Cmd_cursetarget, // 0xAF
Cmd_trysetspikes, // 0xB0
Cmd_setforesight, // 0xB1
Cmd_trysetperishsong, // 0xB2
Cmd_handlerollout, // 0xB3
Cmd_jumpifconfusedandstatmaxed, // 0xB4
Cmd_handlefurycutter, // 0xB5
Cmd_setembargo, // 0xB6
Cmd_presentdamagecalculation, // 0xB7
Cmd_setsafeguard, // 0xB8
Cmd_magnitudedamagecalculation, // 0xB9
Cmd_jumpifnopursuitswitchdmg, // 0xBA
Cmd_setsunny, // 0xBB
Cmd_maxattackhalvehp, // 0xBC
Cmd_copyfoestats, // 0xBD
Cmd_rapidspinfree, // 0xBE
Cmd_setdefensecurlbit, // 0xBF
Cmd_recoverbasedonsunlight, // 0xC0
Cmd_setstickyweb, // 0xC1
Cmd_selectfirstvalidtarget, // 0xC2
Cmd_trysetfutureattack, // 0xC3
Cmd_trydobeatup, // 0xC4
Cmd_setsemiinvulnerablebit, // 0xC5
Cmd_clearsemiinvulnerablebit, // 0xC6
Cmd_setminimize, // 0xC7
Cmd_sethail, // 0xC8
Cmd_jumpifattackandspecialattackcannotfall, // 0xC9
Cmd_setforcedtarget, // 0xCA
Cmd_setcharge, // 0xCB
Cmd_callterrainattack, // 0xCC
Cmd_cureifburnedparalysedorpoisoned, // 0xCD
Cmd_settorment, // 0xCE
Cmd_jumpifnodamage, // 0xCF
Cmd_settaunt, // 0xD0
Cmd_trysethelpinghand, // 0xD1
Cmd_tryswapitems, // 0xD2
Cmd_trycopyability, // 0xD3
Cmd_trywish, // 0xD4
Cmd_settoxicspikes, // 0xD5
Cmd_setgastroacid, // 0xD6
Cmd_setyawn, // 0xD7
Cmd_setdamagetohealthdifference, // 0xD8
Cmd_setroom, // 0xD9
Cmd_tryswapabilities, // 0xDA
Cmd_tryimprison, // 0xDB
Cmd_setstealthrock, // 0xDC
Cmd_setuserstatus3, // 0xDD
Cmd_assistattackselect, // 0xDE
Cmd_trysetmagiccoat, // 0xDF
Cmd_trysetsnatch, // 0xE0
Cmd_trygetintimidatetarget, // 0xE1
Cmd_switchoutabilities, // 0xE2
Cmd_jumpifhasnohp, // 0xE3
Cmd_getsecretpowereffect, // 0xE4
Cmd_pickup, // 0xE5
Cmd_docastformchangeanimation, // 0xE6
Cmd_trycastformdatachange, // 0xE7
Cmd_settypebasedhalvers, // 0xE8
Cmd_jumpifsubstituteblocks, // 0xE9
Cmd_tryrecycleitem, // 0xEA
Cmd_settypetoterrain, // 0xEB
Cmd_pursuitrelated, // 0xEC
Cmd_snatchsetbattlers, // 0xED
Cmd_removelightscreenreflect, // 0xEE
Cmd_handleballthrow, // 0xEF
Cmd_givecaughtmon, // 0xF0
Cmd_trysetcaughtmondexflags, // 0xF1
Cmd_displaydexinfo, // 0xF2
Cmd_trygivecaughtmonnick, // 0xF3
Cmd_subattackerhpbydmg, // 0xF4
Cmd_removeattackerstatus1, // 0xF5
Cmd_finishaction, // 0xF6
Cmd_finishturn, // 0xF7
Cmd_trainerslideout, // 0xF8
Cmd_settelekinesis, // 0xF9
Cmd_swapstatstages, // 0xFA
Cmd_averagestats, // 0xFB
Cmd_jumpifoppositegenders, // 0xFC
Cmd_trygetbaddreamstarget, // 0xFD
Cmd_tryworryseed, // 0xFE
Cmd_metalburstdamagecalculator, // 0xFF
Cmd_attackcanceler, // 0x0
Cmd_accuracycheck, // 0x1
Cmd_attackstring, // 0x2
Cmd_ppreduce, // 0x3
Cmd_critcalc, // 0x4
Cmd_damagecalc, // 0x5
Cmd_typecalc, // 0x6
Cmd_adjustdamage, // 0x7
Cmd_multihitresultmessage, // 0x8
Cmd_attackanimation, // 0x9
Cmd_waitanimation, // 0xA
Cmd_healthbarupdate, // 0xB
Cmd_datahpupdate, // 0xC
Cmd_critmessage, // 0xD
Cmd_effectivenesssound, // 0xE
Cmd_resultmessage, // 0xF
Cmd_printstring, // 0x10
Cmd_printselectionstring, // 0x11
Cmd_waitmessage, // 0x12
Cmd_printfromtable, // 0x13
Cmd_printselectionstringfromtable, // 0x14
Cmd_seteffectwithchance, // 0x15
Cmd_seteffectprimary, // 0x16
Cmd_seteffectsecondary, // 0x17
Cmd_clearstatusfromeffect, // 0x18
Cmd_tryfaintmon, // 0x19
Cmd_dofaintanimation, // 0x1A
Cmd_cleareffectsonfaint, // 0x1B
Cmd_jumpifstatus, // 0x1C
Cmd_jumpifstatus2, // 0x1D
Cmd_jumpifability, // 0x1E
Cmd_jumpifsideaffecting, // 0x1F
Cmd_jumpifstat, // 0x20
Cmd_jumpifstatus3condition, // 0x21
Cmd_jumpbasedontype, // 0x22
Cmd_getexp, // 0x23
atk24, // 0x24
Cmd_movevaluescleanup, // 0x25
Cmd_setmultihit, // 0x26
Cmd_decrementmultihit, // 0x27
Cmd_goto, // 0x28
Cmd_jumpifbyte, // 0x29
Cmd_jumpifhalfword, // 0x2A
Cmd_jumpifword, // 0x2B
Cmd_jumpifarrayequal, // 0x2C
Cmd_jumpifarraynotequal, // 0x2D
Cmd_setbyte, // 0x2E
Cmd_addbyte, // 0x2F
Cmd_subbyte, // 0x30
Cmd_copyarray, // 0x31
Cmd_copyarraywithindex, // 0x32
Cmd_orbyte, // 0x33
Cmd_orhalfword, // 0x34
Cmd_orword, // 0x35
Cmd_bicbyte, // 0x36
Cmd_bichalfword, // 0x37
Cmd_bicword, // 0x38
Cmd_pause, // 0x39
Cmd_waitstate, // 0x3A
Cmd_update, // 0x3B
Cmd_return, // 0x3C
Cmd_end, // 0x3D
Cmd_end2, // 0x3E
Cmd_end3, // 0x3F
Cmd_jumpifaffectedbyprotect, // 0x40
Cmd_call, // 0x41
Cmd_setroost, // 0x42
Cmd_jumpifabilitypresent, // 0x43
Cmd_endselectionscript, // 0x44
Cmd_playanimation, // 0x45
Cmd_playanimation2, // 0x46
Cmd_setgraphicalstatchangevalues, // 0x47
Cmd_playstatchangeanimation, // 0x48
Cmd_moveend, // 0x49
Cmd_sethealblock, // 0x4A
Cmd_returnatktoball, // 0x4B
Cmd_getswitchedmondata, // 0x4C
Cmd_switchindataupdate, // 0x4D
Cmd_switchinanim, // 0x4E
Cmd_jumpifcantswitch, // 0x4F
Cmd_openpartyscreen, // 0x50
Cmd_switchhandleorder, // 0x51
Cmd_switchineffects, // 0x52
Cmd_trainerslidein, // 0x53
Cmd_playse, // 0x54
Cmd_fanfare, // 0x55
Cmd_playfaintcry, // 0x56
atk57, // 0x57
Cmd_returntoball, // 0x58
Cmd_handlelearnnewmove, // 0x59
Cmd_yesnoboxlearnmove, // 0x5A
Cmd_yesnoboxstoplearningmove, // 0x5B
Cmd_hitanimation, // 0x5C
Cmd_getmoneyreward, // 0x5D
atk5E, // 0x5E
Cmd_swapattackerwithtarget, // 0x5F
Cmd_incrementgamestat, // 0x60
Cmd_drawpartystatussummary, // 0x61
Cmd_hidepartystatussummary, // 0x62
Cmd_jumptocalledmove, // 0x63
Cmd_statusanimation, // 0x64
Cmd_status2animation, // 0x65
Cmd_chosenstatusanimation, // 0x66
Cmd_yesnobox, // 0x67
Cmd_cancelallactions, // 0x68
Cmd_setgravity, // 0x69
Cmd_removeitem, // 0x6A
Cmd_atknameinbuff1, // 0x6B
Cmd_drawlvlupbox, // 0x6C
Cmd_resetsentmonsvalue, // 0x6D
Cmd_setatktoplayer0, // 0x6E
Cmd_makevisible, // 0x6F
Cmd_recordability, // 0x70
Cmd_buffermovetolearn, // 0x71
Cmd_jumpifplayerran, // 0x72
Cmd_hpthresholds, // 0x73
Cmd_hpthresholds2, // 0x74
Cmd_useitemonopponent, // 0x75
Cmd_various, // 0x76
Cmd_setprotectlike, // 0x77
Cmd_faintifabilitynotdamp, // 0x78
Cmd_setatkhptozero, // 0x79
Cmd_jumpifnexttargetvalid, // 0x7A
Cmd_tryhealhalfhealth, // 0x7B
Cmd_trymirrormove, // 0x7C
Cmd_setrain, // 0x7D
Cmd_setreflect, // 0x7E
Cmd_setseeded, // 0x7F
Cmd_manipulatedamage, // 0x80
Cmd_trysetrest, // 0x81
Cmd_jumpifnotfirstturn, // 0x82
Cmd_setmiracleeye, // 0x83
Cmd_jumpifcantmakeasleep, // 0x84
Cmd_stockpile, // 0x85
Cmd_stockpiletobasedamage, // 0x86
Cmd_stockpiletohpheal, // 0x87
Cmd_setdrainedhp, // 0x88
Cmd_statbuffchange, // 0x89
Cmd_normalisebuffs, // 0x8A
Cmd_setbide, // 0x8B
Cmd_confuseifrepeatingattackends, // 0x8C
Cmd_setmultihitcounter, // 0x8D
Cmd_initmultihitstring, // 0x8E
Cmd_forcerandomswitch, // 0x8F
Cmd_tryconversiontypechange, // 0x90
Cmd_givepaydaymoney, // 0x91
Cmd_setlightscreen, // 0x92
Cmd_tryKO, // 0x93
Cmd_damagetohalftargethp, // 0x94
Cmd_setsandstorm, // 0x95
Cmd_weatherdamage, // 0x96
Cmd_tryinfatuating, // 0x97
Cmd_updatestatusicon, // 0x98
Cmd_setmist, // 0x99
Cmd_setfocusenergy, // 0x9A
Cmd_transformdataexecution, // 0x9B
Cmd_setsubstitute, // 0x9C
Cmd_mimicattackcopy, // 0x9D
Cmd_metronome, // 0x9E
Cmd_dmgtolevel, // 0x9F
Cmd_psywavedamageeffect, // 0xA0
Cmd_counterdamagecalculator, // 0xA1
Cmd_mirrorcoatdamagecalculator, // 0xA2
Cmd_disablelastusedattack, // 0xA3
Cmd_trysetencore, // 0xA4
Cmd_painsplitdmgcalc, // 0xA5
Cmd_settypetorandomresistance, // 0xA6
Cmd_setalwayshitflag, // 0xA7
Cmd_copymovepermanently, // 0xA8
Cmd_trychoosesleeptalkmove, // 0xA9
Cmd_setdestinybond, // 0xAA
Cmd_trysetdestinybondtohappen, // 0xAB
Cmd_settailwind, // 0xAC
Cmd_tryspiteppreduce, // 0xAD
Cmd_healpartystatus, // 0xAE
Cmd_cursetarget, // 0xAF
Cmd_trysetspikes, // 0xB0
Cmd_setforesight, // 0xB1
Cmd_trysetperishsong, // 0xB2
Cmd_handlerollout, // 0xB3
Cmd_jumpifconfusedandstatmaxed, // 0xB4
Cmd_handlefurycutter, // 0xB5
Cmd_setembargo, // 0xB6
Cmd_presentdamagecalculation, // 0xB7
Cmd_setsafeguard, // 0xB8
Cmd_magnitudedamagecalculation, // 0xB9
Cmd_jumpifnopursuitswitchdmg, // 0xBA
Cmd_setsunny, // 0xBB
Cmd_maxattackhalvehp, // 0xBC
Cmd_copyfoestats, // 0xBD
Cmd_rapidspinfree, // 0xBE
Cmd_setdefensecurlbit, // 0xBF
Cmd_recoverbasedonsunlight, // 0xC0
Cmd_setstickyweb, // 0xC1
Cmd_selectfirstvalidtarget, // 0xC2
Cmd_trysetfutureattack, // 0xC3
Cmd_trydobeatup, // 0xC4
Cmd_setsemiinvulnerablebit, // 0xC5
Cmd_clearsemiinvulnerablebit, // 0xC6
Cmd_setminimize, // 0xC7
Cmd_sethail, // 0xC8
Cmd_jumpifattackandspecialattackcannotfall, // 0xC9
Cmd_setforcedtarget, // 0xCA
Cmd_setcharge, // 0xCB
Cmd_callterrainattack, // 0xCC
Cmd_cureifburnedparalysedorpoisoned, // 0xCD
Cmd_settorment, // 0xCE
Cmd_jumpifnodamage, // 0xCF
Cmd_settaunt, // 0xD0
Cmd_trysethelpinghand, // 0xD1
Cmd_tryswapitems, // 0xD2
Cmd_trycopyability, // 0xD3
Cmd_trywish, // 0xD4
Cmd_settoxicspikes, // 0xD5
Cmd_setgastroacid, // 0xD6
Cmd_setyawn, // 0xD7
Cmd_setdamagetohealthdifference, // 0xD8
Cmd_setroom, // 0xD9
Cmd_tryswapabilities, // 0xDA
Cmd_tryimprison, // 0xDB
Cmd_setstealthrock, // 0xDC
Cmd_setuserstatus3, // 0xDD
Cmd_assistattackselect, // 0xDE
Cmd_trysetmagiccoat, // 0xDF
Cmd_trysetsnatch, // 0xE0
Cmd_trygetintimidatetarget, // 0xE1
Cmd_switchoutabilities, // 0xE2
Cmd_jumpifhasnohp, // 0xE3
Cmd_getsecretpowereffect, // 0xE4
Cmd_pickup, // 0xE5
Cmd_docastformchangeanimation, // 0xE6
Cmd_trycastformdatachange, // 0xE7
Cmd_settypebasedhalvers, // 0xE8
Cmd_jumpifsubstituteblocks, // 0xE9
Cmd_tryrecycleitem, // 0xEA
Cmd_settypetoterrain, // 0xEB
Cmd_pursuitrelated, // 0xEC
Cmd_snatchsetbattlers, // 0xED
Cmd_removelightscreenreflect, // 0xEE
Cmd_handleballthrow, // 0xEF
Cmd_givecaughtmon, // 0xF0
Cmd_trysetcaughtmondexflags, // 0xF1
Cmd_displaydexinfo, // 0xF2
Cmd_trygivecaughtmonnick, // 0xF3
Cmd_subattackerhpbydmg, // 0xF4
Cmd_removeattackerstatus1, // 0xF5
Cmd_finishaction, // 0xF6
Cmd_finishturn, // 0xF7
Cmd_trainerslideout, // 0xF8
Cmd_settelekinesis, // 0xF9
Cmd_swapstatstages, // 0xFA
Cmd_averagestats, // 0xFB
Cmd_jumpifoppositegenders, // 0xFC
Cmd_trygetbaddreamstarget, // 0xFD
Cmd_tryworryseed, // 0xFE
Cmd_metalburstdamagecalculator, // 0xFF
};
struct StatFractions
@ -4828,14 +4828,14 @@ static void Cmd_moveend(void)
BattleScriptPushCursor();
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER || GetBattlerSide(i) == B_SIDE_PLAYER)
{
if (B_ABILITY_POP_UP >= GEN_6)
if (B_ABILITY_POP_UP)
gBattlescriptCurrInstr = BattleScript_EmergencyExit;
else
gBattlescriptCurrInstr = BattleScript_EmergencyExitNoPopUp;
}
else
{
if (B_ABILITY_POP_UP >= GEN_6)
if (B_ABILITY_POP_UP)
gBattlescriptCurrInstr = BattleScript_EmergencyExitWild;
else
gBattlescriptCurrInstr = BattleScript_EmergencyExitWildNoPopUp;

View File

@ -19,7 +19,6 @@
#include "berry.h"
#include "pokedex.h"
#include "mail.h"
#include "constants/battle_config.h"
#include "field_weather.h"
#include "constants/abilities.h"
#include "constants/battle_anim.h"
@ -41,6 +40,7 @@
#include "trig.h"
#include "window.h"
#include "constants/songs.h"
#include "constants/trainers.h"
extern const u8 *const gBattleScriptsForMoveEffects[];
extern const u8 *const gBattlescriptsForBallThrow[];
@ -909,25 +909,25 @@ static const u16 sPercentToModifier[] =
static const u16 sTypeEffectivenessTable[NUMBER_OF_MON_TYPES][NUMBER_OF_MON_TYPES] =
{
// normal fight flying poison ground rock bug ghost steel mystery fire water grass electric psychic ice dragon dark fairy
{X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(0.5), X(1.0), X(0.0), X(0.5), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0)}, // normal
{X(2.0), X(1.0), X(0.5), X(0.5), X(1.0), X(2.0), X(0.5), X(0.0), X(2.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(0.5), X(2.0), X(1.0), X(2.0), X(0.5)}, // fight
{X(1.0), X(2.0), X(1.0), X(1.0), X(1.0), X(0.5), X(2.0), X(1.0), X(0.5), X(1.0), X(1.0), X(1.0), X(2.0), X(0.5), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0)}, // flying
{X(1.0), X(1.0), X(1.0), X(0.5), X(0.5), X(0.5), X(1.0), X(0.5), X(0.0), X(1.0), X(1.0), X(1.0), X(2.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(2.0)}, // poison
{X(1.0), X(1.0), X(0.0), X(2.0), X(1.0), X(2.0), X(0.5), X(1.0), X(2.0), X(1.0), X(2.0), X(1.0), X(0.5), X(2.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0)}, // ground
{X(1.0), X(0.5), X(2.0), X(1.0), X(0.5), X(1.0), X(2.0), X(1.0), X(0.5), X(1.0), X(2.0), X(1.0), X(1.0), X(1.0), X(1.0), X(2.0), X(1.0), X(1.0), X(1.0)}, // rock
{X(1.0), X(0.5), X(0.5), X(0.5), X(1.0), X(1.0), X(1.0), X(0.5), X(0.5), X(1.0), X(0.5), X(1.0), X(2.0), X(1.0), X(2.0), X(1.0), X(1.0), X(2.0), X(0.5)}, // bug
{X(0.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(2.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(2.0), X(1.0), X(1.0), X(0.5), X(1.0)}, // ghost
{X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(2.0), X(1.0), X(1.0), X(0.5), X(1.0), X(0.5), X(0.5), X(1.0), X(0.5), X(1.0), X(2.0), X(1.0), X(1.0), X(2.0)}, // steel
{X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0)}, // mystery
{X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(0.5), X(2.0), X(1.0), X(2.0), X(1.0), X(0.5), X(0.5), X(2.0), X(1.0), X(1.0), X(2.0), X(0.5), X(1.0), X(1.0)}, // fire
{X(1.0), X(1.0), X(1.0), X(1.0), X(2.0), X(2.0), X(1.0), X(1.0), X(1.0), X(1.0), X(2.0), X(0.5), X(0.5), X(1.0), X(1.0), X(1.0), X(0.5), X(1.0), X(1.0)}, // water
{X(1.0), X(1.0), X(0.5), X(0.5), X(2.0), X(2.0), X(0.5), X(1.0), X(0.5), X(1.0), X(0.5), X(2.0), X(0.5), X(1.0), X(1.0), X(1.0), X(0.5), X(1.0), X(1.0)}, // grass
{X(1.0), X(1.0), X(2.0), X(1.0), X(0.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(2.0), X(0.5), X(0.5), X(1.0), X(1.0), X(0.5), X(1.0), X(1.0)}, // electric
{X(1.0), X(2.0), X(1.0), X(2.0), X(1.0), X(1.0), X(1.0), X(1.0), X(0.5), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(0.5), X(1.0), X(1.0), X(0.0), X(1.0)}, // psychic
{X(1.0), X(1.0), X(2.0), X(1.0), X(2.0), X(1.0), X(1.0), X(1.0), X(0.5), X(1.0), X(0.5), X(0.5), X(2.0), X(1.0), X(1.0), X(0.5), X(2.0), X(1.0), X(1.0)}, // ice
{X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(0.5), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(2.0), X(1.0), X(0.0)}, // dragon
{X(1.0), X(0.5), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(2.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(2.0), X(1.0), X(1.0), X(0.5), X(0.5)}, // dark
{X(1.0), X(2.0), X(1.0), X(0.5), X(1.0), X(1.0), X(1.0), X(1.0), X(0.5), X(1.0), X(0.5), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(2.0), X(2.0), X(1.0)}, // fairy
{X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(0.5), X(1.0), X(0.0), X(0.5), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0)}, // normal
{X(2.0), X(1.0), X(0.5), X(0.5), X(1.0), X(2.0), X(0.5), X(0.0), X(2.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(0.5), X(2.0), X(1.0), X(2.0), X(0.5)}, // fight
{X(1.0), X(2.0), X(1.0), X(1.0), X(1.0), X(0.5), X(2.0), X(1.0), X(0.5), X(1.0), X(1.0), X(1.0), X(2.0), X(0.5), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0)}, // flying
{X(1.0), X(1.0), X(1.0), X(0.5), X(0.5), X(0.5), X(1.0), X(0.5), X(0.0), X(1.0), X(1.0), X(1.0), X(2.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(2.0)}, // poison
{X(1.0), X(1.0), X(0.0), X(2.0), X(1.0), X(2.0), X(0.5), X(1.0), X(2.0), X(1.0), X(2.0), X(1.0), X(0.5), X(2.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0)}, // ground
{X(1.0), X(0.5), X(2.0), X(1.0), X(0.5), X(1.0), X(2.0), X(1.0), X(0.5), X(1.0), X(2.0), X(1.0), X(1.0), X(1.0), X(1.0), X(2.0), X(1.0), X(1.0), X(1.0)}, // rock
{X(1.0), X(0.5), X(0.5), X(0.5), X(1.0), X(1.0), X(1.0), X(0.5), X(0.5), X(1.0), X(0.5), X(1.0), X(2.0), X(1.0), X(2.0), X(1.0), X(1.0), X(2.0), X(0.5)}, // bug
{X(0.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(2.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(2.0), X(1.0), X(1.0), X(0.5), X(1.0)}, // ghost
{X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(2.0), X(1.0), X(1.0), X(0.5), X(1.0), X(0.5), X(0.5), X(1.0), X(0.5), X(1.0), X(2.0), X(1.0), X(1.0), X(2.0)}, // steel
{X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0)}, // mystery
{X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(0.5), X(2.0), X(1.0), X(2.0), X(1.0), X(0.5), X(0.5), X(2.0), X(1.0), X(1.0), X(2.0), X(0.5), X(1.0), X(1.0)}, // fire
{X(1.0), X(1.0), X(1.0), X(1.0), X(2.0), X(2.0), X(1.0), X(1.0), X(1.0), X(1.0), X(2.0), X(0.5), X(0.5), X(1.0), X(1.0), X(1.0), X(0.5), X(1.0), X(1.0)}, // water
{X(1.0), X(1.0), X(0.5), X(0.5), X(2.0), X(2.0), X(0.5), X(1.0), X(0.5), X(1.0), X(0.5), X(2.0), X(0.5), X(1.0), X(1.0), X(1.0), X(0.5), X(1.0), X(1.0)}, // grass
{X(1.0), X(1.0), X(2.0), X(1.0), X(0.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(2.0), X(0.5), X(0.5), X(1.0), X(1.0), X(0.5), X(1.0), X(1.0)}, // electric
{X(1.0), X(2.0), X(1.0), X(2.0), X(1.0), X(1.0), X(1.0), X(1.0), X(0.5), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(0.5), X(1.0), X(1.0), X(0.0), X(1.0)}, // psychic
{X(1.0), X(1.0), X(2.0), X(1.0), X(2.0), X(1.0), X(1.0), X(1.0), X(0.5), X(1.0), X(0.5), X(0.5), X(2.0), X(1.0), X(1.0), X(0.5), X(2.0), X(1.0), X(1.0)}, // ice
{X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(0.5), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(2.0), X(1.0), X(0.0)}, // dragon
{X(1.0), X(0.5), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(2.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(2.0), X(1.0), X(1.0), X(0.5), X(0.5)}, // dark
{X(1.0), X(2.0), X(1.0), X(0.5), X(1.0), X(1.0), X(1.0), X(1.0), X(0.5), X(1.0), X(0.5), X(1.0), X(1.0), X(1.0), X(1.0), X(1.0), X(2.0), X(2.0), X(1.0)}, // fairy
};
static const u16 sInverseTypeEffectivenessTable[NUMBER_OF_MON_TYPES][NUMBER_OF_MON_TYPES] =
@ -1331,7 +1331,7 @@ static bool32 IsBelchPreventingMove(u32 battler, u32 move)
u8 TrySetCantSelectMoveBattleScript(void)
{
u32 limitations = 0;
u8 moveId = gBattleResources->bufferB[gActiveBattler][2] & ~(RET_MEGA_EVOLUTION);
u8 moveId = gBattleResources->bufferB[gActiveBattler][2] & ~(RET_MEGA_EVOLUTION);
u32 move = gBattleMons[gActiveBattler].moves[moveId];
u32 holdEffect = GetBattlerHoldEffect(gActiveBattler, TRUE);
u16 *choicedMove = &gBattleStruct->choicedMove[gActiveBattler];
@ -1587,32 +1587,32 @@ u8 GetImprisonedMovesCount(u8 battlerId, u16 move)
enum
{
ENDTURN_ORDER,
ENDTURN_REFLECT,
ENDTURN_LIGHT_SCREEN,
ENDTURN_AURORA_VEIL,
ENDTURN_MIST,
ENDTURN_LUCKY_CHANT,
ENDTURN_SAFEGUARD,
ENDTURN_TAILWIND,
ENDTURN_WISH,
ENDTURN_RAIN,
ENDTURN_SANDSTORM,
ENDTURN_SUN,
ENDTURN_HAIL,
ENDTURN_GRAVITY,
ENDTURN_WATER_SPORT,
ENDTURN_MUD_SPORT,
ENDTURN_TRICK_ROOM,
ENDTURN_WONDER_ROOM,
ENDTURN_MAGIC_ROOM,
ENDTURN_ELECTRIC_TERRAIN,
ENDTURN_MISTY_TERRAIN,
ENDTURN_GRASSY_TERRAIN,
ENDTURN_PSYCHIC_TERRAIN,
ENDTURN_ION_DELUGE,
ENDTURN_FAIRY_LOCK,
ENDTURN_FIELD_COUNT,
ENDTURN_ORDER,
ENDTURN_REFLECT,
ENDTURN_LIGHT_SCREEN,
ENDTURN_AURORA_VEIL,
ENDTURN_MIST,
ENDTURN_LUCKY_CHANT,
ENDTURN_SAFEGUARD,
ENDTURN_TAILWIND,
ENDTURN_WISH,
ENDTURN_RAIN,
ENDTURN_SANDSTORM,
ENDTURN_SUN,
ENDTURN_HAIL,
ENDTURN_GRAVITY,
ENDTURN_WATER_SPORT,
ENDTURN_MUD_SPORT,
ENDTURN_TRICK_ROOM,
ENDTURN_WONDER_ROOM,
ENDTURN_MAGIC_ROOM,
ENDTURN_ELECTRIC_TERRAIN,
ENDTURN_MISTY_TERRAIN,
ENDTURN_GRASSY_TERRAIN,
ENDTURN_PSYCHIC_TERRAIN,
ENDTURN_ION_DELUGE,
ENDTURN_FAIRY_LOCK,
ENDTURN_FIELD_COUNT,
};
u8 DoFieldEndTurnEffects(void)
@ -2049,36 +2049,36 @@ enum
ENDTURN_INGRAIN,
ENDTURN_AQUA_RING,
ENDTURN_ABILITIES,
ENDTURN_ITEMS1,
ENDTURN_LEECH_SEED,
ENDTURN_POISON,
ENDTURN_BAD_POISON,
ENDTURN_BURN,
ENDTURN_NIGHTMARES,
ENDTURN_CURSE,
ENDTURN_WRAP,
ENDTURN_UPROAR,
ENDTURN_THRASH,
ENDTURN_FLINCH,
ENDTURN_DISABLE,
ENDTURN_ENCORE,
ENDTURN_MAGNET_RISE,
ENDTURN_TELEKINESIS,
ENDTURN_HEALBLOCK,
ENDTURN_EMBARGO,
ENDTURN_LOCK_ON,
ENDTURN_CHARGE,
ENDTURN_LASER_FOCUS,
ENDTURN_TAUNT,
ENDTURN_YAWN,
ENDTURN_ITEMS2,
ENDTURN_ORBS,
ENDTURN_ROOST,
ENDTURN_ELECTRIFY,
ENDTURN_POWDER,
ENDTURN_THROAT_CHOP,
ENDTURN_SLOW_START,
ENDTURN_BATTLER_COUNT
ENDTURN_ITEMS1,
ENDTURN_LEECH_SEED,
ENDTURN_POISON,
ENDTURN_BAD_POISON,
ENDTURN_BURN,
ENDTURN_NIGHTMARES,
ENDTURN_CURSE,
ENDTURN_WRAP,
ENDTURN_UPROAR,
ENDTURN_THRASH,
ENDTURN_FLINCH,
ENDTURN_DISABLE,
ENDTURN_ENCORE,
ENDTURN_MAGNET_RISE,
ENDTURN_TELEKINESIS,
ENDTURN_HEALBLOCK,
ENDTURN_EMBARGO,
ENDTURN_LOCK_ON,
ENDTURN_CHARGE,
ENDTURN_LASER_FOCUS,
ENDTURN_TAUNT,
ENDTURN_YAWN,
ENDTURN_ITEMS2,
ENDTURN_ORBS,
ENDTURN_ROOST,
ENDTURN_ELECTRIFY,
ENDTURN_POWDER,
ENDTURN_THROAT_CHOP,
ENDTURN_SLOW_START,
ENDTURN_BATTLER_COUNT
};
// Ingrain, Leech Seed, Strength Sap and Aqua Ring
@ -4547,7 +4547,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
// Set bit and save Dancer mon's original target
gSpecialStatuses[battler].dancerUsedMove = 1;
gSpecialStatuses[battler].dancerOriginalTarget = *(gBattleStruct->moveTarget + battler) | 0x4;
gBattleStruct->atkCancellerTracker = 0;
gBattleStruct->atkCancellerTracker = 0;
gBattlerAttacker = gBattlerAbility = battler;
gCalledMove = gCurrentMove;
@ -4798,8 +4798,8 @@ u32 GetBattlerAbility(u8 battlerId)
&& gActionsByTurnOrder[gBattlerByTurnOrder[gBattlerAttacker]] == B_ACTION_USE_MOVE
&& gCurrentTurnActionNumber < gBattlersCount)
return ABILITY_NONE;
else
return gBattleMons[battlerId].ability;
else
return gBattleMons[battlerId].ability;
}
u32 IsAbilityOnSide(u32 battlerId, u32 ability)
@ -6097,8 +6097,8 @@ bool32 IsMoveMakingContact(u16 move, u8 battlerAtk)
return FALSE;
else if (GetBattlerHoldEffect(battlerAtk, TRUE) == HOLD_EFFECT_PROTECTIVE_PADS)
return FALSE;
else
return TRUE;
else
return TRUE;
}
bool32 IsBattlerGrounded(u8 battlerId)
@ -6124,7 +6124,7 @@ bool32 IsBattlerGrounded(u8 battlerId)
return FALSE;
else
return TRUE;
return TRUE;
}
bool32 IsBattlerAlive(u8 battlerId)
@ -6135,8 +6135,8 @@ bool32 IsBattlerAlive(u8 battlerId)
return FALSE;
else if (gAbsentBattlerFlags & gBitTable[battlerId])
return FALSE;
else
return TRUE;
else
return TRUE;
}
u8 GetBattleMonMoveSlot(struct BattlePokemon *battleMon, u16 move)
@ -6937,6 +6937,13 @@ static u32 CalcAttackStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, b
break;
}
// The offensive stats of a Player's Pokémon are boosted by x1.1 (+10%) if they have the 1st badge and 7th badges.
// Having the 1st badge boosts physical attack while having the 7th badge boosts special attack.
if (ShouldGetStatBadgeBoost(FLAG_BADGE01_GET, battlerAtk) && IS_MOVE_PHYSICAL(move))
MulModifier(&modifier, UQ_4_12(1.1));
if (ShouldGetStatBadgeBoost(FLAG_BADGE07_GET, battlerAtk) && IS_MOVE_SPECIAL(move))
MulModifier(&modifier, UQ_4_12(1.1));
return ApplyModifier(modifier, atkStat);
}
@ -7069,6 +7076,13 @@ static u32 CalcDefenseStat(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType,
if (IS_BATTLER_OF_TYPE(battlerDef, TYPE_ROCK) && WEATHER_HAS_EFFECT && gBattleWeather & WEATHER_SANDSTORM_ANY && !usesDefStat)
MulModifier(&modifier, UQ_4_12(1.5));
// The defensive stats of a Player's Pokémon are boosted by x1.1 (+10%) if they have the 5th badge and 7th badges.
// Having the 5th badge boosts physical defense while having the 7th badge boosts special defense.
if (ShouldGetStatBadgeBoost(FLAG_BADGE05_GET, battlerDef) && IS_MOVE_PHYSICAL(move))
MulModifier(&modifier, UQ_4_12(1.1));
if (ShouldGetStatBadgeBoost(FLAG_BADGE07_GET, battlerDef) && IS_MOVE_SPECIAL(move))
MulModifier(&modifier, UQ_4_12(1.1));
return ApplyModifier(modifier, defStat);
}
@ -7665,3 +7679,19 @@ bool32 SetIllusionMon(struct Pokemon *mon, u32 battlerId)
return FALSE;
}
bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId)
{
if (B_BADGE_BOOST != GEN_3)
return FALSE;
else if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_x2000000 | BATTLE_TYPE_FRONTIER))
return FALSE;
else if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
return FALSE;
else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gTrainerBattleOpponent_A == TRAINER_SECRET_BASE)
return FALSE;
else if (FlagGet(badgeFlag))
return TRUE;
else
return FALSE;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@ const u8 gMoveNames[MOVES_COUNT][MOVE_NAME_LENGTH + 1] =
[MOVE_ICE_PUNCH] = _("Ice Punch"),
[MOVE_THUNDER_PUNCH] = _("ThunderPunch"),
[MOVE_SCRATCH] = _("Scratch"),
[MOVE_VICE_GRIP] = _("Vice Grip"),
[MOVE_VICE_GRIP] = _("Vise Grip"),
[MOVE_GUILLOTINE] = _("Guillotine"),
[MOVE_RAZOR_WIND] = _("Razor Wind"),
[MOVE_SWORDS_DANCE] = _("Swords Dance"),
@ -28,7 +28,7 @@ const u8 gMoveNames[MOVES_COUNT][MOVE_NAME_LENGTH + 1] =
[MOVE_MEGA_KICK] = _("Mega Kick"),
[MOVE_JUMP_KICK] = _("Jump Kick"),
[MOVE_ROLLING_KICK] = _("Rolling Kick"),
[MOVE_SAND_ATTACK] = _("Sand-Attack"),
[MOVE_SAND_ATTACK] = _("Sand Attack"),
[MOVE_HEADBUTT] = _("Headbutt"),
[MOVE_HORN_ATTACK] = _("Horn Attack"),
[MOVE_FURY_ATTACK] = _("Fury Attack"),
@ -108,7 +108,7 @@ const u8 gMoveNames[MOVES_COUNT][MOVE_NAME_LENGTH + 1] =
[MOVE_RECOVER] = _("Recover"),
[MOVE_HARDEN] = _("Harden"),
[MOVE_MINIMIZE] = _("Minimize"),
[MOVE_SMOKESCREEN] = _("SmokeScreen"),
[MOVE_SMOKESCREEN] = _("Smokescreen"),
[MOVE_CONFUSE_RAY] = _("Confuse Ray"),
[MOVE_WITHDRAW] = _("Withdraw"),
[MOVE_DEFENSE_CURL] = _("Defense Curl"),
@ -120,7 +120,7 @@ const u8 gMoveNames[MOVES_COUNT][MOVE_NAME_LENGTH + 1] =
[MOVE_BIDE] = _("Bide"),
[MOVE_METRONOME] = _("Metronome"),
[MOVE_MIRROR_MOVE] = _("Mirror Move"),
[MOVE_SELF_DESTRUCT] = _("Selfdestruct"),
[MOVE_SELF_DESTRUCT] = _("SelfDestruct"),
[MOVE_EGG_BOMB] = _("Egg Bomb"),
[MOVE_LICK] = _("Lick"),
[MOVE_SMOG] = _("Smog"),
@ -135,7 +135,7 @@ const u8 gMoveNames[MOVES_COUNT][MOVE_NAME_LENGTH + 1] =
[MOVE_CONSTRICT] = _("Constrict"),
[MOVE_AMNESIA] = _("Amnesia"),
[MOVE_KINESIS] = _("Kinesis"),
[MOVE_SOFT_BOILED] = _("Softboiled"),
[MOVE_SOFT_BOILED] = _("Soft-Boiled"),
[MOVE_HI_JUMP_KICK] = _("Hi Jump Kick"),
[MOVE_GLARE] = _("Glare"),
[MOVE_DREAM_EATER] = _("Dream Eater"),
@ -358,7 +358,7 @@ const u8 gMoveNames[MOVES_COUNT][MOVE_NAME_LENGTH + 1] =
[MOVE_ROOST] = _("Roost"),
[MOVE_GRAVITY] = _("Gravity"),
[MOVE_MIRACLE_EYE] = _("Miracle Eye"),
[MOVE_WAKE_UP_SLAP] = _("Wake Up Slap"),
[MOVE_WAKE_UP_SLAP] = _("Wake-Up Slap"),
[MOVE_HAMMER_ARM] = _("Hammer Arm"),
[MOVE_GYRO_BALL] = _("Gyro Ball"),
[MOVE_HEALING_WISH] = _("Healing Wish"),
@ -369,7 +369,7 @@ const u8 gMoveNames[MOVES_COUNT][MOVE_NAME_LENGTH + 1] =
[MOVE_TAILWIND] = _("Tailwind"),
[MOVE_ACUPRESSURE] = _("Acupressure"),
[MOVE_METAL_BURST] = _("Metal Burst"),
[MOVE_U_TURN] = _("U-Turn"),
[MOVE_U_TURN] = _("U-turn"),
[MOVE_CLOSE_COMBAT] = _("Close Combat"),
[MOVE_PAYBACK] = _("Payback"),
[MOVE_ASSURANCE] = _("Assurance"),
@ -404,7 +404,7 @@ const u8 gMoveNames[MOVES_COUNT][MOVE_NAME_LENGTH + 1] =
[MOVE_AQUA_TAIL] = _("Aqua Tail"),
[MOVE_SEED_BOMB] = _("Seed Bomb"),
[MOVE_AIR_SLASH] = _("Air Slash"),
[MOVE_X_SCISSOR] = _("X Scissor"),
[MOVE_X_SCISSOR] = _("X-Scissor"),
[MOVE_BUG_BUZZ] = _("Bug Buzz"),
[MOVE_DRAGON_PULSE] = _("Dragon Pulse"),
[MOVE_DRAGON_RUSH] = _("Dragon Rush"),
@ -459,7 +459,7 @@ const u8 gMoveNames[MOVES_COUNT][MOVE_NAME_LENGTH + 1] =
[MOVE_HEAL_ORDER] = _("Heal Order"),
[MOVE_HEAD_SMASH] = _("Head Smash"),
[MOVE_DOUBLE_HIT] = _("Double Hit"),
[MOVE_ROAR_OF_TIME] = _("Roar Of Time"),
[MOVE_ROAR_OF_TIME] = _("Roar of Time"),
[MOVE_SPACIAL_REND] = _("Spacial Rend"),
[MOVE_LUNAR_DANCE] = _("Lunar Dance"),
[MOVE_CRUSH_GRIP] = _("Crush Grip"),
@ -576,7 +576,7 @@ const u8 gMoveNames[MOVES_COUNT][MOVE_NAME_LENGTH + 1] =
[MOVE_FREEZE_DRY] = _("Freeze-Dry"),
[MOVE_DISARMING_VOICE] = _("Disarming Vo"),
[MOVE_PARTING_SHOT] = _("Parting Shot"),
[MOVE_TOPSY_TURVY] = _("Topsy Turvy"),
[MOVE_TOPSY_TURVY] = _("Topsy-Turvy"),
[MOVE_DRAINING_KISS] = _("DrainingKiss"),
[MOVE_CRAFTY_SHIELD] = _("CraftyShield"),
[MOVE_FLOWER_SHIELD] = _("FlowerShield"),

View File

@ -58,7 +58,6 @@ static union PokemonSubstruct *GetSubstruct(struct BoxPokemon *boxMon, u32 perso
static void EncryptBoxMon(struct BoxPokemon *boxMon);
static void DecryptBoxMon(struct BoxPokemon *boxMon);
static void sub_806E6CC(u8 taskId);
static bool8 ShouldGetStatBadgeBoost(u16 flagId, u8 battlerId);
static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move);
static bool8 ShouldSkipFriendshipChange(void);
@ -3076,20 +3075,6 @@ u8 CountAliveMonsInBattle(u8 caseId)
return retVal;
}
static bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId)
{
if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_x2000000 | BATTLE_TYPE_FRONTIER))
return FALSE;
else if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
return FALSE;
else if (gBattleTypeFlags & BATTLE_TYPE_TRAINER && gTrainerBattleOpponent_A == TRAINER_SECRET_BASE)
return FALSE;
else if (FlagGet(badgeFlag))
return TRUE;
else
return FALSE;
}
u8 GetDefaultMoveTarget(u8 battlerId)
{
u8 opposing = BATTLE_OPPOSITE(GetBattlerPosition(battlerId) & BIT_SIDE);
@ -5560,6 +5545,24 @@ void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies)
u16 heldItem;
u8 holdEffect;
int i, multiplier;
u8 stat;
u8 bonus;
heldItem = GetMonData(mon, MON_DATA_HELD_ITEM, 0);
if (heldItem == ITEM_ENIGMA_BERRY)
{
if (gMain.inBattle)
holdEffect = gEnigmaBerries[0].holdEffect;
else
holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
}
else
{
holdEffect = ItemId_GetHoldEffect(heldItem);
}
stat = ItemId_GetSecondaryId(heldItem);
bonus = ItemId_GetHoldEffectParam(heldItem);
for (i = 0; i < NUM_STATS; i++)
{
@ -5580,36 +5583,41 @@ void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies)
switch (i)
{
case STAT_HP:
evIncrease = gBaseStats[defeatedSpecies].evYield_HP * multiplier;
if (holdEffect == HOLD_EFFECT_POWER_ITEM && stat == STAT_HP)
evIncrease = (gBaseStats[defeatedSpecies].evYield_HP + bonus) * multiplier;
else
evIncrease = gBaseStats[defeatedSpecies].evYield_HP * multiplier;
break;
case STAT_ATK:
evIncrease = gBaseStats[defeatedSpecies].evYield_Attack * multiplier;
if (holdEffect == HOLD_EFFECT_POWER_ITEM && stat == STAT_ATK)
evIncrease = (gBaseStats[defeatedSpecies].evYield_Attack + bonus) * multiplier;
else
evIncrease = gBaseStats[defeatedSpecies].evYield_Attack * multiplier;
break;
case STAT_DEF:
evIncrease = gBaseStats[defeatedSpecies].evYield_Defense * multiplier;
if (holdEffect == HOLD_EFFECT_POWER_ITEM && stat == STAT_DEF)
evIncrease = (gBaseStats[defeatedSpecies].evYield_Defense + bonus) * multiplier;
else
evIncrease = gBaseStats[defeatedSpecies].evYield_Defense * multiplier;
break;
case STAT_SPEED:
evIncrease = gBaseStats[defeatedSpecies].evYield_Speed * multiplier;
if (holdEffect == HOLD_EFFECT_POWER_ITEM && stat == STAT_SPEED)
evIncrease = (gBaseStats[defeatedSpecies].evYield_Speed + bonus) * multiplier;
else
evIncrease = gBaseStats[defeatedSpecies].evYield_Speed * multiplier;
break;
case STAT_SPATK:
evIncrease = gBaseStats[defeatedSpecies].evYield_SpAttack * multiplier;
if (holdEffect == HOLD_EFFECT_POWER_ITEM && stat == STAT_SPATK)
evIncrease = (gBaseStats[defeatedSpecies].evYield_SpAttack + bonus) * multiplier;
else
evIncrease = gBaseStats[defeatedSpecies].evYield_SpAttack * multiplier;
break;
case STAT_SPDEF:
evIncrease = gBaseStats[defeatedSpecies].evYield_SpDefense * multiplier;
break;
}
heldItem = GetMonData(mon, MON_DATA_HELD_ITEM, 0);
if (heldItem == ITEM_ENIGMA_BERRY)
{
if (gMain.inBattle)
holdEffect = gEnigmaBerries[0].holdEffect;
if (holdEffect == HOLD_EFFECT_POWER_ITEM && stat == STAT_SPDEF)
evIncrease = (gBaseStats[defeatedSpecies].evYield_SpDefense + bonus) * multiplier;
else
holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
}
else
{
holdEffect = ItemId_GetHoldEffect(heldItem);
evIncrease = gBaseStats[defeatedSpecies].evYield_SpDefense * multiplier;
break;
}
if (holdEffect == HOLD_EFFECT_MACHO_BRACE)

View File

@ -610,7 +610,7 @@ bool8 StandardWildEncounter(u16 currMetaTileBehavior, u16 previousMetaTileBehavi
// try a regular wild land encounter
if (TryGenerateWildMon(gWildMonHeaders[headerId].landMonsInfo, WILD_AREA_LAND, WILD_CHECK_REPEL | WILD_CHECK_KEEN_EYE) == TRUE)
{
if (USE_BATTLE_DEBUG && !GetSafariZoneFlag() && GetMonsStateToDoubles() == PLAYER_HAS_TWO_USABLE_MONS)
if (TryDoDoubleWildBattle())
{
struct Pokemon mon1 = gEnemyParty[0];
TryGenerateWildMon(gWildMonHeaders[headerId].landMonsInfo, WILD_AREA_LAND, WILD_CHECK_KEEN_EYE);
@ -652,7 +652,17 @@ bool8 StandardWildEncounter(u16 currMetaTileBehavior, u16 previousMetaTileBehavi
{
if (TryGenerateWildMon(gWildMonHeaders[headerId].waterMonsInfo, WILD_AREA_WATER, WILD_CHECK_REPEL | WILD_CHECK_KEEN_EYE) == TRUE)
{
BattleSetup_StartWildBattle();
if (TryDoDoubleWildBattle())
{
struct Pokemon mon1 = gEnemyParty[0];
TryGenerateWildMon(gWildMonHeaders[headerId].waterMonsInfo, WILD_AREA_WATER, WILD_CHECK_KEEN_EYE);
gEnemyParty[1] = mon1;
BattleSetup_StartDoubleWildBattle();
}
else
{
BattleSetup_StartWildBattle();
}
return TRUE;
}
@ -957,3 +967,16 @@ static void ApplyCleanseTagEncounterRateMod(u32 *encRate)
if (GetMonData(&gPlayerParty[0], MON_DATA_HELD_ITEM) == ITEM_CLEANSE_TAG)
*encRate = *encRate * 2 / 3;
}
bool8 TryDoDoubleWildBattle(void)
{
if (GetSafariZoneFlag() || GetMonsStateToDoubles() != PLAYER_HAS_TWO_USABLE_MONS)
return FALSE;
else if (B_FLAG_FORCE_DOUBLE_WILD != 0 && FlagGet(B_FLAG_FORCE_DOUBLE_WILD))
return TRUE;
#if B_DOUBLE_WILD_CHANCE != 0
else if ((Random() % 100) + 1 < B_DOUBLE_WILD_CHANCE)
return TRUE;
#endif
return FALSE;
}