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,7 +1,10 @@
#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 BATTLE_ENGINE
// Species with peculiar battle effects.
#ifndef POKEMON_EXPANSION
#define SPECIES_DIALGA 0
#define SPECIES_PALKIA 0
#define SPECIES_GIRATINA 0
@ -22,14 +25,10 @@
#define SPECIES_ZYGARDE 0 // 50%
#define SPECIES_ZYGARDE_10 10005 // 10 %
#define SPECIES_ZYGARDE_COMPLETE 10006 // 100 %
#endif
// 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
// Items with peculiar battle effects.
#ifndef ITEM_EXPANSION
#define ITEM_CHOPLE_BERRY 177
#define ITEM_KEBIA_BERRY 178
#define ITEM_SHUCA_BERRY 179
@ -49,13 +48,22 @@
#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

@ -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[];
@ -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

View File

@ -2618,7 +2618,7 @@ static const u8 sPLASMA_FISTSDescription[] = _(
"Normal moves become Electric.");
static const u8 sPHOTON_GEYSERDescription[] = _(
"The user's highest offensive\n"
"User's highest attack stat\n"
"determines its category.");
static const u8 sZIPPY_ZAPDescription[] = _(

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,38 +5583,43 @@ void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies)
switch (i)
{
case STAT_HP:
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:
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:
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:
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:
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:
if (holdEffect == HOLD_EFFECT_POWER_ITEM && stat == STAT_SPDEF)
evIncrease = (gBaseStats[defeatedSpecies].evYield_SpDefense + bonus) * multiplier;
else
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;
else
holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
}
else
{
holdEffect = ItemId_GetHoldEffect(heldItem);
}
if (holdEffect == HOLD_EFFECT_MACHO_BRACE)
evIncrease *= 2;

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);
@ -651,8 +651,18 @@ bool8 StandardWildEncounter(u16 currMetaTileBehavior, u16 previousMetaTileBehavi
else // try a regular surfing encounter
{
if (TryGenerateWildMon(gWildMonHeaders[headerId].waterMonsInfo, WILD_AREA_WATER, WILD_CHECK_REPEL | WILD_CHECK_KEEN_EYE) == TRUE)
{
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;
}