Basic damage calc is ready.
This commit is contained in:
parent
c00fa14b66
commit
5a38bb61db
17 changed files with 1251 additions and 293 deletions
|
@ -29,11 +29,11 @@
|
|||
.byte 0x6
|
||||
.endm
|
||||
|
||||
.macro adjustnormaldamage
|
||||
.macro adjustdamage
|
||||
.byte 0x7
|
||||
.endm
|
||||
|
||||
.macro adjustnormaldamage2
|
||||
.macro nop_08
|
||||
.byte 0x8
|
||||
.endm
|
||||
|
||||
|
@ -558,7 +558,7 @@
|
|||
.byte 0x68
|
||||
.endm
|
||||
|
||||
.macro adjustsetdamage
|
||||
.macro nop_69
|
||||
.byte 0x69
|
||||
.endm
|
||||
|
||||
|
|
|
@ -271,8 +271,7 @@ BattleScript_HitFromAtkString::
|
|||
BattleScript_HitFromCritCalc::
|
||||
critcalc
|
||||
damagecalc
|
||||
typecalc
|
||||
adjustnormaldamage
|
||||
adjustdamage
|
||||
BattleScript_HitFromAtkAnimation::
|
||||
attackanimation
|
||||
waitanimation
|
||||
|
@ -351,8 +350,7 @@ BattleScript_EffectAbsorb::
|
|||
ppreduce
|
||||
critcalc
|
||||
damagecalc
|
||||
typecalc
|
||||
adjustnormaldamage
|
||||
adjustdamage
|
||||
attackanimation
|
||||
waitanimation
|
||||
effectivenesssound
|
||||
|
@ -413,8 +411,7 @@ BattleScript_82D8B96::
|
|||
movevaluescleanup
|
||||
critcalc
|
||||
damagecalc
|
||||
typecalc
|
||||
adjustnormaldamage
|
||||
adjustdamage
|
||||
accuracycheck BattleScript_82D8BCF, ACC_CURR_MOVE
|
||||
effectivenesssound
|
||||
hitanimation BS_TARGET
|
||||
|
@ -463,8 +460,7 @@ BattleScript_82D8C18::
|
|||
ppreduce
|
||||
critcalc
|
||||
damagecalc
|
||||
typecalc
|
||||
adjustnormaldamage
|
||||
adjustdamage
|
||||
attackanimation
|
||||
waitanimation
|
||||
effectivenesssound
|
||||
|
@ -645,9 +641,8 @@ BattleScript_DoMultiHit::
|
|||
copybyte cEFFECT_CHOOSER, sMULTIHIT_EFFECT
|
||||
critcalc
|
||||
damagecalc
|
||||
typecalc
|
||||
jumpifmovehadnoeffect BattleScript_MultiHitNoMoreHits
|
||||
adjustnormaldamage
|
||||
adjustdamage
|
||||
attackanimation
|
||||
waitanimation
|
||||
effectivenesssound
|
||||
|
@ -853,7 +848,7 @@ BattleScript_EffectDragonRage::
|
|||
typecalc
|
||||
bicbyte gMoveResultFlags, MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE
|
||||
setword gBattleMoveDamage, 40
|
||||
adjustsetdamage
|
||||
adjustdamage
|
||||
goto BattleScript_HitFromAtkAnimation
|
||||
|
||||
BattleScript_EffectTrap::
|
||||
|
@ -889,7 +884,7 @@ BattleScript_MoveMissedDoDamage::
|
|||
waitmessage 0x40
|
||||
damagecalc
|
||||
typecalc
|
||||
adjustnormaldamage
|
||||
adjustdamage
|
||||
manipulatedamage ATK80_DMG_HALF_BY_TWO_NOT_MORE_THAN_HALF_MAX_HP
|
||||
bicbyte gMoveResultFlags, MOVE_RESULT_MISSED
|
||||
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE
|
||||
|
@ -910,7 +905,7 @@ BattleScript_EffectMist::
|
|||
waitmessage 0x40
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectFocusEnergy::
|
||||
BattleScript_EffectFocusEnergy:
|
||||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
|
@ -922,13 +917,13 @@ BattleScript_EffectFocusEnergy::
|
|||
waitmessage 0x40
|
||||
goto BattleScript_MoveEnd
|
||||
|
||||
BattleScript_EffectRecoil::
|
||||
BattleScript_EffectRecoil:
|
||||
setmoveeffect MOVE_EFFECT_RECOIL_25 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
|
||||
jumpifnotmove MOVE_STRUGGLE, BattleScript_EffectHit
|
||||
incrementgamestat 0x1B
|
||||
goto BattleScript_EffectHit
|
||||
|
||||
BattleScript_EffectConfuse::
|
||||
BattleScript_EffectConfuse:
|
||||
attackcanceler
|
||||
attackstring
|
||||
ppreduce
|
||||
|
@ -1228,7 +1223,7 @@ BattleScript_EffectLevelDamage::
|
|||
typecalc
|
||||
bicbyte gMoveResultFlags, MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE
|
||||
dmgtolevel
|
||||
adjustsetdamage
|
||||
adjustdamage
|
||||
goto BattleScript_HitFromAtkAnimation
|
||||
|
||||
BattleScript_EffectPsywave::
|
||||
|
@ -1239,7 +1234,7 @@ BattleScript_EffectPsywave::
|
|||
typecalc
|
||||
bicbyte gMoveResultFlags, MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE
|
||||
psywavedamageeffect
|
||||
adjustsetdamage
|
||||
adjustdamage
|
||||
goto BattleScript_HitFromAtkAnimation
|
||||
|
||||
BattleScript_EffectCounter::
|
||||
|
@ -1249,7 +1244,7 @@ BattleScript_EffectCounter::
|
|||
attackstring
|
||||
ppreduce
|
||||
typecalc2
|
||||
adjustsetdamage
|
||||
adjustdamage
|
||||
goto BattleScript_HitFromAtkAnimation
|
||||
|
||||
BattleScript_EffectEncore::
|
||||
|
@ -1425,8 +1420,7 @@ BattleScript_DoTripleKickAttack::
|
|||
copyhword gDynamicBasePower, sTRIPLE_KICK_POWER
|
||||
critcalc
|
||||
damagecalc
|
||||
typecalc
|
||||
adjustnormaldamage
|
||||
adjustdamage
|
||||
jumpifmovehadnoeffect BattleScript_TripleKickNoMoreHits
|
||||
attackanimation
|
||||
waitanimation
|
||||
|
@ -1663,9 +1657,8 @@ BattleScript_FuryCutterHit::
|
|||
furycuttercalc
|
||||
critcalc
|
||||
damagecalc
|
||||
typecalc
|
||||
jumpifmovehadnoeffect BattleScript_FuryCutterHit
|
||||
adjustnormaldamage
|
||||
adjustdamage
|
||||
goto BattleScript_HitFromAtkAnimation
|
||||
|
||||
BattleScript_EffectAttract::
|
||||
|
@ -1751,7 +1744,7 @@ BattleScript_EffectSonicboom::
|
|||
typecalc
|
||||
bicbyte gMoveResultFlags, MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE
|
||||
setword gBattleMoveDamage, 20
|
||||
adjustsetdamage
|
||||
adjustdamage
|
||||
goto BattleScript_HitFromAtkAnimation
|
||||
|
||||
BattleScript_EffectMorningSun::
|
||||
|
@ -1831,7 +1824,7 @@ BattleScript_EffectMirrorCoat::
|
|||
attackstring
|
||||
ppreduce
|
||||
typecalc2
|
||||
adjustsetdamage
|
||||
adjustdamage
|
||||
goto BattleScript_HitFromAtkAnimation
|
||||
|
||||
BattleScript_EffectSkullBash::
|
||||
|
@ -1873,8 +1866,7 @@ BattleScript_DoHitAllWithUndergroundBonus::
|
|||
accuracycheck BattleScript_HitAllWithUndergroundBonusMissed, ACC_CURR_MOVE
|
||||
critcalc
|
||||
damagecalc
|
||||
typecalc
|
||||
adjustnormaldamage
|
||||
adjustdamage
|
||||
attackanimation
|
||||
waitanimation
|
||||
effectivenesssound
|
||||
|
@ -1969,10 +1961,10 @@ BattleScript_BeatUpLoop::
|
|||
trydobeatup BattleScript_BeatUpEnd, BattleScript_ButItFailed
|
||||
printstring STRINGID_PKMNATTACK
|
||||
critcalc
|
||||
jumpifbyte CMP_NOT_EQUAL, gCritMultiplier, 0x2, BattleScript_BeatUpAttack
|
||||
jumpifbyte CMP_NOT_EQUAL, gIsCriticalHit, TRUE, BattleScript_BeatUpAttack
|
||||
manipulatedamage ATK80_DMG_DOUBLED
|
||||
BattleScript_BeatUpAttack::
|
||||
adjustnormaldamage
|
||||
adjustdamage
|
||||
attackanimation
|
||||
waitanimation
|
||||
effectivenesssound
|
||||
|
@ -2120,7 +2112,7 @@ BattleScript_EffectSpitUp::
|
|||
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
|
||||
stockpiletobasedamage BattleScript_SpitUpFail
|
||||
typecalc
|
||||
adjustsetdamage
|
||||
adjustdamage
|
||||
goto BattleScript_HitFromAtkAnimation
|
||||
BattleScript_SpitUpFail::
|
||||
pause 0x20
|
||||
|
@ -2425,8 +2417,7 @@ BattleScript_EffectBrickBreak::
|
|||
removelightscreenreflect
|
||||
critcalc
|
||||
damagecalc
|
||||
typecalc
|
||||
adjustnormaldamage
|
||||
adjustdamage
|
||||
jumpifbyte CMP_EQUAL, sB_ANIM_TURN, 0x0, BattleScript_BrickBreakAnim
|
||||
bicbyte gMoveResultFlags, MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE
|
||||
BattleScript_BrickBreakAnim::
|
||||
|
@ -2489,7 +2480,7 @@ BattleScript_EffectEndeavor::
|
|||
jumpifmovehadnoeffect BattleScript_HitFromAtkAnimation
|
||||
bicbyte gMoveResultFlags, MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE
|
||||
copyword gBattleMoveDamage, gHpDealt
|
||||
adjustsetdamage
|
||||
adjustdamage
|
||||
goto BattleScript_HitFromAtkAnimation
|
||||
|
||||
BattleScript_EffectEruption::
|
||||
|
@ -3117,8 +3108,7 @@ BattleScript_PursuitDmgOnSwitchOut::
|
|||
ppreduce
|
||||
critcalc
|
||||
damagecalc
|
||||
typecalc
|
||||
adjustnormaldamage
|
||||
adjustdamage
|
||||
attackanimation
|
||||
waitanimation
|
||||
effectivenesssound
|
||||
|
@ -3291,7 +3281,7 @@ BattleScript_BideAttack::
|
|||
typecalc
|
||||
bicbyte gMoveResultFlags, MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE
|
||||
copyword gBattleMoveDamage, sBIDE_DMG
|
||||
adjustsetdamage
|
||||
adjustdamage
|
||||
setbyte sB_ANIM_TURN, 0x1
|
||||
attackanimation
|
||||
waitanimation
|
||||
|
@ -3510,7 +3500,7 @@ BattleScript_MonTookFutureAttack::
|
|||
BattleScript_CheckDoomDesireMiss::
|
||||
accuracycheck BattleScript_FutureAttackMiss, MOVE_DOOM_DESIRE
|
||||
BattleScript_FutureAttackAnimate::
|
||||
adjustnormaldamage2
|
||||
adjustdamage
|
||||
jumpifbyte CMP_NOT_EQUAL, cMULTISTRING_CHOOSER, 0x0, BattleScript_FutureHitAnimDoomDesire
|
||||
playanimation BS_ATTACKER, B_ANIM_FUTURE_SIGHT_HIT, NULL
|
||||
goto BattleScript_DoFutureAttackHit
|
||||
|
@ -3798,7 +3788,7 @@ BattleScript_MoveUsedIsConfused::
|
|||
jumpifbyte CMP_EQUAL, cMULTISTRING_CHOOSER, 0x0, BattleScript_MoveUsedIsConfusedRet
|
||||
BattleScript_DoSelfConfusionDmg::
|
||||
cancelmultiturnmoves BS_ATTACKER
|
||||
adjustnormaldamage2
|
||||
adjustdamage
|
||||
printstring STRINGID_ITHURTCONFUSION
|
||||
waitmessage 0x40
|
||||
effectivenesssound
|
||||
|
|
|
@ -215,15 +215,15 @@ struct ProtectStruct
|
|||
|
||||
struct SpecialStatus
|
||||
{
|
||||
u8 statLowered:1; // 0x1
|
||||
u8 lightningRodRedirected:1; // 0x2
|
||||
u8 restoredBankSprite: 1; // 0x4
|
||||
u8 intimidatedPoke:1; // 0x8
|
||||
u8 traced:1; // 0x10
|
||||
u8 statLowered:1;
|
||||
u8 lightningRodRedirected:1;
|
||||
u8 restoredBankSprite: 1;
|
||||
u8 intimidatedPoke:1;
|
||||
u8 traced:1;
|
||||
u8 flag20:1;
|
||||
u8 flag40:1;
|
||||
u8 focusBanded:1;
|
||||
u8 field1[3];
|
||||
u8 focusSashed:1;
|
||||
s32 dmg;
|
||||
s32 physicalDmg;
|
||||
s32 specialDmg;
|
||||
|
@ -563,6 +563,8 @@ struct BattleStruct
|
|||
u8 field_2A1;
|
||||
u8 field_2A2;
|
||||
u8 debugBattler;
|
||||
u8 magnitudeBasePower;
|
||||
u8 presentBasePower;
|
||||
};
|
||||
|
||||
#define GET_MOVE_TYPE(move, typeArg) \
|
||||
|
@ -576,6 +578,7 @@ struct BattleStruct
|
|||
#define IS_MOVE_PHYSICAL(moveType)(moveType < TYPE_MYSTERY)
|
||||
#define IS_MOVE_SPECIAL(moveType)(moveType > TYPE_MYSTERY)
|
||||
|
||||
#define BATTLER_MAX_HP(battlerId)(gBattleMons[battlerId].hp == gBattleMons[battlerId].maxHP)
|
||||
#define TARGET_TURN_DAMAGED ((gSpecialStatuses[gBattlerTarget].physicalDmg != 0 || gSpecialStatuses[gBattlerTarget].specialDmg != 0))
|
||||
|
||||
#define IS_BATTLER_OF_TYPE(battlerId, type)((gBattleMons[battlerId].type1 == type || gBattleMons[battlerId].type2 == type))
|
||||
|
@ -759,7 +762,7 @@ extern u8 gBattlerFainted;
|
|||
extern u8 gEffectBattler;
|
||||
extern u8 gPotentialItemEffectBattler;
|
||||
extern u8 gAbsentBattlerFlags;
|
||||
extern u8 gCritMultiplier;
|
||||
extern u8 gIsCriticalHit;
|
||||
extern u8 gMultiHitCounter;
|
||||
extern const u8 *gBattlescriptCurrInstr;
|
||||
extern u32 gUnusedBattleMainVar;
|
||||
|
|
|
@ -65,6 +65,7 @@ void BattleTurnPassed(void);
|
|||
u8 IsRunningFromBattleImpossible(void);
|
||||
void sub_803BDA0(u8 battlerId);
|
||||
void SwapTurnOrder(u8 id1, u8 id2);
|
||||
u32 GetBattlerTotalSpeedStat(u8 battlerId);
|
||||
u8 GetWhoStrikesFirst(u8 battlerId1, u8 battlerId2, bool8 ignoreChosenMoves);
|
||||
void RunBattleScriptCommands_PopCallbacksStack(void);
|
||||
void RunBattleScriptCommands(void);
|
||||
|
|
|
@ -79,6 +79,7 @@ bool32 IsMoveMakingContact(u16 move, u8 battlerAtk);
|
|||
bool32 IsBattlerGrounded(u8 battlerId);
|
||||
u8 GetBattleMonMoveSlot(struct BattlePokemon *battleMon, u16 move);
|
||||
u32 GetBattlerWeight(u8 battlerId);
|
||||
s32 CalculateMoveDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, s32 fixedBasePower, bool32 isCrit);
|
||||
s32 CalculateMoveDamage(u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, s32 fixedBasePower, bool32 isCrit, bool32 randomFactor);
|
||||
u16 CalcTypeEffectivenessMultiplier(u16 move, u8 moveType, u8 battlerAtk, u8 battlerDef, bool32 recordAbilities);
|
||||
|
||||
#endif // GUARD_BATTLE_UTIL_H
|
||||
|
|
|
@ -151,6 +151,8 @@
|
|||
#define STATUS3_SMACKED_DOWN 0x200000
|
||||
#define STATUS3_ME_FIRST 0x400000
|
||||
#define STATUS3_TELEKINESIS 0x800000
|
||||
#define STATUS3_UNBURDEN 0x1000000
|
||||
#define STATUS3_MIRACLE_EYED 0x2000000
|
||||
#define STATUS3_SEMI_INVULNERABLE (STATUS3_UNDERGROUND | STATUS3_ON_AIR | STATUS3_UNDERWATER)
|
||||
|
||||
// Not really sure what a "hitmarker" is.
|
||||
|
@ -190,6 +192,8 @@
|
|||
#define SIDE_STATUS_FUTUREATTACK (1 << 6)
|
||||
#define SIDE_STATUS_MIST (1 << 8)
|
||||
#define SIDE_STATUS_SPIKES_DAMAGED (1 << 9)
|
||||
#define SIDE_STATUS_TAILWIND (1 << 10)
|
||||
#define SIDE_STATUS_AURORA_VEIL (1 << 11)
|
||||
|
||||
// Field affecting statuses.
|
||||
#define STATUS_FIELD_MAGIC_ROOM 0x1
|
||||
|
|
|
@ -96,9 +96,16 @@
|
|||
#define HOLD_EFFECT_BLACK_SLUDGE 90
|
||||
#define HOLD_EFFECT_DESTINY_KNOT 91
|
||||
#define HOLD_EFFECT_SHED_SHELL 92
|
||||
#define HOLD_EFFECT_QUICK_POWDER 93
|
||||
#define HOLD_EFFECT_ADAMANT_ORB 94
|
||||
#define HOLD_EFFECT_LUSTROUS_ORB 95
|
||||
#define HOLD_EFFECT_GRISEOUS_ORB 96
|
||||
|
||||
// Gen5 hold effects
|
||||
#define HOLD_EFFECT_FLOAT_STONE 115
|
||||
#define HOLD_EFFECT_WISE_GLASSES 116
|
||||
#define HOLD_EFFECT_EVIOLITE 117
|
||||
#define HOLD_EFFECT_ASSAULT_VEST 118
|
||||
|
||||
// Gen6 hold effects
|
||||
#define HOLD_EFFECT_FAIRY_POWER 130
|
||||
|
|
|
@ -86,6 +86,15 @@
|
|||
#define FLAG_MIRROR_MOVE_AFFECTED 0x10
|
||||
#define FLAG_KINGSROCK_AFFECTED 0x20
|
||||
#define FLAG_HIGH_CRIT 0x40
|
||||
#define FLAG_RECKLESS_BOOST 0x80
|
||||
#define FLAG_IRON_FIST_BOOST 0x100
|
||||
#define FLAG_SHEER_FORCE_BOOST 0x200
|
||||
#define FLAG_STRONG_JAW_BOOST 0x400
|
||||
#define FLAG_MEGA_LAUNCHER_BOOST 0x800
|
||||
#define FLAG_STAT_STAGES_IGNORED 0x1000
|
||||
#define FLAG_DMG_MINIMIZE 0x2000
|
||||
#define FLAG_DMG_UNDERGROUND 0x4000
|
||||
#define FLAG_DMG_UNDERWATER 0x8000
|
||||
|
||||
// Split defines.
|
||||
#define SPLIT_PHYSICAL 0x0
|
||||
|
|
|
@ -447,4 +447,10 @@
|
|||
|
||||
#define NUM_SPECIES SPECIES_EGG
|
||||
|
||||
// Todo
|
||||
#define SPECIES_DIALGA 0
|
||||
#define SPECIES_PALKIA 0
|
||||
#define SPECIES_GIRATINA 0
|
||||
#define SPECIES_CHERRIM 0
|
||||
|
||||
#endif // GUARD_CONSTANTS_SPECIES_H
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
// Converts a number to Q4.12 fixed-point format
|
||||
#define Q_4_12(n) ((s16)((n) * 4096))
|
||||
#define UQ_4_12(n) ((u16)((n) * 4096))
|
||||
|
||||
// Converts a number to Q24.8 fixed-point format
|
||||
#define Q_24_8(n) ((s32)((n) * 256))
|
||||
|
@ -43,10 +44,15 @@
|
|||
|
||||
// Converts a Q4.12 fixed-point format number to a regular integer
|
||||
#define Q_4_12_TO_INT(n) ((int)((n) / 4096))
|
||||
#define UQ_4_12_TO_INT(n) ((int)((n) / 4096))
|
||||
|
||||
// Converts a Q24.8 fixed-point format number to a regular integer
|
||||
#define Q_24_8_TO_INT(n) ((int)((n) >> 8))
|
||||
|
||||
// Rounding value for Q4.12 fixed-point format
|
||||
#define Q_4_12_ROUND ((1) << (12 - 1))
|
||||
#define UQ_4_12_ROUND ((1) << (12 - 1))
|
||||
|
||||
#define PARTY_SIZE 6
|
||||
|
||||
#define POKEMON_SLOTS_NUMBER 412
|
||||
|
|
|
@ -363,7 +363,7 @@ struct BattleMove
|
|||
u8 secondaryEffectChance;
|
||||
u8 target;
|
||||
s8 priority;
|
||||
u8 flags;
|
||||
u32 flags;
|
||||
u8 split;
|
||||
};
|
||||
|
||||
|
|
|
@ -1180,7 +1180,6 @@ static void BattleAICmd_get_how_powerful_move_is(void)
|
|||
gDynamicBasePower = 0;
|
||||
*(&gBattleStruct->dynamicMoveType) = 0;
|
||||
gMoveResultFlags = 0;
|
||||
gCritMultiplier = 1;
|
||||
|
||||
for (checkedMove = 0; checkedMove < 4; checkedMove++)
|
||||
{
|
||||
|
@ -1460,7 +1459,7 @@ static void BattleAICmd_get_highest_type_effectiveness(void)
|
|||
dynamicMoveType = &gBattleStruct->dynamicMoveType;
|
||||
*dynamicMoveType = 0;
|
||||
gMoveResultFlags = 0;
|
||||
gCritMultiplier = 1;
|
||||
gIsCriticalHit = 1;
|
||||
AI_THINKING_STRUCT->funcResult = 0;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
|
@ -1499,7 +1498,7 @@ static void BattleAICmd_if_type_effectiveness(void)
|
|||
gDynamicBasePower = 0;
|
||||
gBattleStruct->dynamicMoveType = 0;
|
||||
gMoveResultFlags = 0;
|
||||
gCritMultiplier = 1;
|
||||
gIsCriticalHit = 1;
|
||||
|
||||
gBattleMoveDamage = AI_EFFECTIVENESS_x1;
|
||||
gCurrentMove = AI_THINKING_STRUCT->moveConsidered;
|
||||
|
@ -1710,7 +1709,7 @@ static void BattleAICmd_if_can_faint(void)
|
|||
gDynamicBasePower = 0;
|
||||
gBattleStruct->dynamicMoveType = 0;
|
||||
gMoveResultFlags = 0;
|
||||
gCritMultiplier = 1;
|
||||
gIsCriticalHit = 1;
|
||||
gCurrentMove = AI_THINKING_STRUCT->moveConsidered;
|
||||
AI_CalcDmg(sBattler_AI, gBattlerTarget);
|
||||
TypeCalc(gCurrentMove, sBattler_AI, gBattlerTarget);
|
||||
|
@ -1738,7 +1737,7 @@ static void BattleAICmd_if_cant_faint(void)
|
|||
gDynamicBasePower = 0;
|
||||
gBattleStruct->dynamicMoveType = 0;
|
||||
gMoveResultFlags = 0;
|
||||
gCritMultiplier = 1;
|
||||
gIsCriticalHit = 1;
|
||||
gCurrentMove = AI_THINKING_STRUCT->moveConsidered;
|
||||
AI_CalcDmg(sBattler_AI, gBattlerTarget);
|
||||
TypeCalc(gCurrentMove, sBattler_AI, gBattlerTarget);
|
||||
|
|
|
@ -736,7 +736,6 @@ u8 GetMostSuitableMonToSwitchInto(void)
|
|||
gDynamicBasePower = 0;
|
||||
gBattleStruct->dynamicMoveType = 0;
|
||||
gMoveResultFlags = 0;
|
||||
gCritMultiplier = 1;
|
||||
bestDmg = 0;
|
||||
bestMonId = 6;
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ EWRAM_DATA u8 gBattlerFainted = 0;
|
|||
EWRAM_DATA u8 gEffectBattler = 0;
|
||||
EWRAM_DATA u8 gPotentialItemEffectBattler = 0;
|
||||
EWRAM_DATA u8 gAbsentBattlerFlags = 0;
|
||||
EWRAM_DATA u8 gCritMultiplier = 0;
|
||||
EWRAM_DATA u8 gIsCriticalHit = FALSE;
|
||||
EWRAM_DATA u8 gMultiHitCounter = 0;
|
||||
EWRAM_DATA const u8 *gBattlescriptCurrInstr = NULL;
|
||||
EWRAM_DATA u32 gUnusedBattleMainVar = 0;
|
||||
|
@ -4615,99 +4615,80 @@ void SwapTurnOrder(u8 id1, u8 id2)
|
|||
gBattlerByTurnOrder[id2] = temp;
|
||||
}
|
||||
|
||||
u32 GetBattlerTotalSpeedStat(u8 battlerId)
|
||||
{
|
||||
u32 speed = gBattleMons[battlerId].speed;
|
||||
u32 ability = GetBattlerAbility(battlerId);
|
||||
u32 holdEffect = GetBattlerHoldEffect(battlerId, TRUE);
|
||||
|
||||
// weather abilities
|
||||
if (WEATHER_HAS_EFFECT)
|
||||
{
|
||||
if (ability == ABILITY_SWIFT_SWIM && gBattleWeather & WEATHER_RAIN_ANY)
|
||||
speed *= 2;
|
||||
else if (ability == ABILITY_CHLOROPHYLL && gBattleWeather & WEATHER_SUN_ANY)
|
||||
speed *= 2;
|
||||
else if (ability == ABILITY_SAND_RUSH && gBattleWeather & WEATHER_SANDSTORM_ANY)
|
||||
speed *= 2;
|
||||
else if (ability == ABILITY_SLUSH_RUSH && gBattleWeather & WEATHER_HAIL_ANY)
|
||||
speed *= 2;
|
||||
}
|
||||
|
||||
// other abilities
|
||||
if (ability == ABILITY_QUICK_FEET && gBattleMons[battlerId].status1 & STATUS1_ANY)
|
||||
speed = (speed * 150) / 100;
|
||||
else if (ability == ABILITY_SURGE_SURFER && gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN)
|
||||
speed *= 2;
|
||||
|
||||
// stat stages
|
||||
speed *= gStatStageRatios[gBattleMons[battlerId].statStages[STAT_SPEED]][0];
|
||||
speed /= gStatStageRatios[gBattleMons[battlerId].statStages[STAT_SPEED]][1];
|
||||
|
||||
// player's badge boost
|
||||
if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000 | BATTLE_TYPE_FRONTIER))
|
||||
&& FlagGet(FLAG_BADGE03_GET)
|
||||
&& GetBattlerSide(battlerId) == B_SIDE_PLAYER)
|
||||
{
|
||||
speed = (speed * 110) / 100;
|
||||
}
|
||||
|
||||
// item effects
|
||||
if (holdEffect == HOLD_EFFECT_MACHO_BRACE)
|
||||
speed /= 2;
|
||||
else if (holdEffect == HOLD_EFFECT_IRON_BALL)
|
||||
speed /= 2;
|
||||
else if (holdEffect == HOLD_EFFECT_CHOICE_SCARF)
|
||||
speed = (speed * 150) / 100;
|
||||
else if (holdEffect == HOLD_EFFECT_QUICK_POWDER && gBattleMons[battlerId].species == SPECIES_DITTO && !(gBattleMons[battlerId].status2 & STATUS2_TRANSFORMED))
|
||||
speed *= 2;
|
||||
|
||||
// various effects
|
||||
if (gSideStatuses[GET_BATTLER_SIDE(battlerId)] & SIDE_STATUS_TAILWIND)
|
||||
speed *= 2;
|
||||
if (gStatuses3[battlerId] & STATUS3_UNBURDEN)
|
||||
speed *= 2;
|
||||
|
||||
// paralysis drop
|
||||
if (gBattleMons[battlerId].status1 & STATUS1_PARALYSIS && ability != ABILITY_QUICK_FEET)
|
||||
speed /= 4;
|
||||
|
||||
return speed;
|
||||
}
|
||||
|
||||
u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves)
|
||||
{
|
||||
u8 strikesFirst = 0;
|
||||
u8 speedMultiplierBattler1 = 0, speedMultiplierBattler2 = 0;
|
||||
u32 speedBattler1 = 0, speedBattler2 = 0;
|
||||
u8 holdEffect = 0;
|
||||
u8 holdEffectParam = 0;
|
||||
u16 moveBattler1 = 0, moveBattler2 = 0;
|
||||
|
||||
if (WEATHER_HAS_EFFECT)
|
||||
{
|
||||
if ((gBattleMons[battler1].ability == ABILITY_SWIFT_SWIM && gBattleWeather & WEATHER_RAIN_ANY)
|
||||
|| (gBattleMons[battler1].ability == ABILITY_CHLOROPHYLL && gBattleWeather & WEATHER_SUN_ANY))
|
||||
speedMultiplierBattler1 = 2;
|
||||
else
|
||||
speedMultiplierBattler1 = 1;
|
||||
|
||||
if ((gBattleMons[battler2].ability == ABILITY_SWIFT_SWIM && gBattleWeather & WEATHER_RAIN_ANY)
|
||||
|| (gBattleMons[battler2].ability == ABILITY_CHLOROPHYLL && gBattleWeather & WEATHER_SUN_ANY))
|
||||
speedMultiplierBattler2 = 2;
|
||||
else
|
||||
speedMultiplierBattler2 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
speedMultiplierBattler1 = 1;
|
||||
speedMultiplierBattler2 = 1;
|
||||
}
|
||||
|
||||
speedBattler1 = (gBattleMons[battler1].speed * speedMultiplierBattler1)
|
||||
* (gStatStageRatios[gBattleMons[battler1].statStages[STAT_SPEED]][0])
|
||||
/ (gStatStageRatios[gBattleMons[battler1].statStages[STAT_SPEED]][1]);
|
||||
|
||||
if (gBattleMons[battler1].item == ITEM_ENIGMA_BERRY)
|
||||
{
|
||||
holdEffect = gEnigmaBerries[battler1].holdEffect;
|
||||
holdEffectParam = gEnigmaBerries[battler1].holdEffectParam;
|
||||
}
|
||||
else
|
||||
{
|
||||
holdEffect = ItemId_GetHoldEffect(gBattleMons[battler1].item);
|
||||
holdEffectParam = ItemId_GetHoldEffectParam(gBattleMons[battler1].item);
|
||||
}
|
||||
|
||||
// badge boost
|
||||
if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000 | BATTLE_TYPE_FRONTIER))
|
||||
&& FlagGet(FLAG_BADGE03_GET)
|
||||
&& GetBattlerSide(battler1) == B_SIDE_PLAYER)
|
||||
{
|
||||
speedBattler1 = (speedBattler1 * 110) / 100;
|
||||
}
|
||||
|
||||
if (holdEffect == HOLD_EFFECT_MACHO_BRACE)
|
||||
speedBattler1 /= 2;
|
||||
|
||||
if (gBattleMons[battler1].status1 & STATUS1_PARALYSIS)
|
||||
speedBattler1 /= 4;
|
||||
|
||||
if (holdEffect == HOLD_EFFECT_QUICK_CLAW && gRandomTurnNumber < (0xFFFF * holdEffectParam) / 100)
|
||||
speedBattler1 = GetBattlerTotalSpeedStat(battler1);
|
||||
if (GetBattlerHoldEffect(battler1, TRUE) == HOLD_EFFECT_QUICK_CLAW
|
||||
&& gRandomTurnNumber < (0xFFFF * GetBattlerHoldEffectParam(battler1)) / 100)
|
||||
speedBattler1 = UINT_MAX;
|
||||
|
||||
// check second battlerId's speed
|
||||
|
||||
speedBattler2 = (gBattleMons[battler2].speed * speedMultiplierBattler2)
|
||||
* (gStatStageRatios[gBattleMons[battler2].statStages[STAT_SPEED]][0])
|
||||
/ (gStatStageRatios[gBattleMons[battler2].statStages[STAT_SPEED]][1]);
|
||||
|
||||
if (gBattleMons[battler2].item == ITEM_ENIGMA_BERRY)
|
||||
{
|
||||
holdEffect = gEnigmaBerries[battler2].holdEffect;
|
||||
holdEffectParam = gEnigmaBerries[battler2].holdEffectParam;
|
||||
}
|
||||
else
|
||||
{
|
||||
holdEffect = ItemId_GetHoldEffect(gBattleMons[battler2].item);
|
||||
holdEffectParam = ItemId_GetHoldEffectParam(gBattleMons[battler2].item);
|
||||
}
|
||||
|
||||
// badge boost
|
||||
if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_x2000000 | BATTLE_TYPE_FRONTIER))
|
||||
&& FlagGet(FLAG_BADGE03_GET)
|
||||
&& GetBattlerSide(battler2) == B_SIDE_PLAYER)
|
||||
{
|
||||
speedBattler2 = (speedBattler2 * 110) / 100;
|
||||
}
|
||||
|
||||
if (holdEffect == HOLD_EFFECT_MACHO_BRACE)
|
||||
speedBattler2 /= 2;
|
||||
|
||||
if (gBattleMons[battler2].status1 & STATUS1_PARALYSIS)
|
||||
speedBattler2 /= 4;
|
||||
|
||||
if (holdEffect == HOLD_EFFECT_QUICK_CLAW && gRandomTurnNumber < (0xFFFF * holdEffectParam) / 100)
|
||||
speedBattler2 = GetBattlerTotalSpeedStat(battler2);
|
||||
if (GetBattlerHoldEffect(battler2, TRUE) == HOLD_EFFECT_QUICK_CLAW
|
||||
&& gRandomTurnNumber < (0xFFFF * GetBattlerHoldEffectParam(battler2)) / 100)
|
||||
speedBattler2 = UINT_MAX;
|
||||
|
||||
if (ignoreChosenMoves)
|
||||
|
@ -5295,7 +5276,7 @@ static void HandleAction_UseMove(void)
|
|||
return;
|
||||
}
|
||||
|
||||
gCritMultiplier = 1;
|
||||
gIsCriticalHit = FALSE;
|
||||
gBattleStruct->atkCancellerTracker = 0;
|
||||
gMoveResultFlags = 0;
|
||||
gMultiHitCounter = 0;
|
||||
|
|
|
@ -97,8 +97,8 @@ static void atk03_ppreduce(void);
|
|||
static void atk04_critcalc(void);
|
||||
static void atk05_damagecalc(void);
|
||||
static void atk06_typecalc(void);
|
||||
static void atk07_adjustnormaldamage(void);
|
||||
static void atk08_adjustnormaldamage2(void);
|
||||
static void atk07_adjustdamage(void);
|
||||
static void atk08_nop(void);
|
||||
static void atk09_attackanimation(void);
|
||||
static void atk0A_waitanimation(void);
|
||||
static void atk0B_healthbarupdate(void);
|
||||
|
@ -195,7 +195,7 @@ static void atk65_status2animation(void);
|
|||
static void atk66_chosenstatusanimation(void);
|
||||
static void atk67_yesnobox(void);
|
||||
static void atk68_cancelallactions(void);
|
||||
static void atk69_adjustsetdamage(void);
|
||||
static void atk69_nop(void);
|
||||
static void atk6A_removeitem(void);
|
||||
static void atk6B_atknameinbuff1(void);
|
||||
static void atk6C_drawlvlupbox(void);
|
||||
|
@ -349,8 +349,8 @@ void (* const gBattleScriptingCommandsTable[])(void) =
|
|||
atk04_critcalc,
|
||||
atk05_damagecalc,
|
||||
atk06_typecalc,
|
||||
atk07_adjustnormaldamage,
|
||||
atk08_adjustnormaldamage2,
|
||||
atk07_adjustdamage,
|
||||
atk08_nop,
|
||||
atk09_attackanimation,
|
||||
atk0A_waitanimation,
|
||||
atk0B_healthbarupdate,
|
||||
|
@ -447,7 +447,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
|
|||
atk66_chosenstatusanimation,
|
||||
atk67_yesnobox,
|
||||
atk68_cancelallactions,
|
||||
atk69_adjustsetdamage,
|
||||
atk69_nop,
|
||||
atk6A_removeitem,
|
||||
atk6B_atknameinbuff1,
|
||||
atk6C_drawlvlupbox,
|
||||
|
@ -1273,9 +1273,9 @@ static void atk04_critcalc(void)
|
|||
&& !(gStatuses3[gBattlerAttacker] & STATUS3_CANT_SCORE_A_CRIT)
|
||||
&& !(gBattleTypeFlags & (BATTLE_TYPE_WALLY_TUTORIAL | BATTLE_TYPE_FIRST_BATTLE))
|
||||
&& !(Random() % sCriticalHitChance[critChance]))
|
||||
gCritMultiplier = 2;
|
||||
gIsCriticalHit = TRUE;
|
||||
else
|
||||
gCritMultiplier = 1;
|
||||
gIsCriticalHit = FALSE;
|
||||
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
|
@ -1285,7 +1285,7 @@ static void atk05_damagecalc(void)
|
|||
u8 moveType;
|
||||
|
||||
GET_MOVE_TYPE(gCurrentMove, moveType);
|
||||
gBattleMoveDamage = CalculateMoveDamage(gCurrentMove, gBattlerAttacker, gBattlerTarget, moveType, 0, gCritMultiplier);
|
||||
gBattleMoveDamage = CalculateMoveDamage(gCurrentMove, gBattlerAttacker, gBattlerTarget, moveType, 0, gIsCriticalHit, TRUE);
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
|
||||
|
@ -1610,120 +1610,60 @@ u8 AI_TypeCalc(u16 move, u16 targetSpecies, u8 targetAbility)
|
|||
return flags;
|
||||
}
|
||||
|
||||
// Multiplies the damage by a random factor between 85% to 100% inclusive
|
||||
static inline void ApplyRandomDmgMultiplier(void)
|
||||
{
|
||||
u16 rand = Random();
|
||||
u16 randPercent = 100 - (rand % 16);
|
||||
|
||||
if (gBattleMoveDamage != 0)
|
||||
{
|
||||
gBattleMoveDamage *= randPercent;
|
||||
gBattleMoveDamage /= 100;
|
||||
if (gBattleMoveDamage == 0)
|
||||
gBattleMoveDamage = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void Unused_ApplyRandomDmgMultiplier(void)
|
||||
{
|
||||
ApplyRandomDmgMultiplier();
|
||||
}
|
||||
|
||||
static void atk07_adjustnormaldamage(void)
|
||||
static void atk07_adjustdamage(void)
|
||||
{
|
||||
u8 holdEffect, param;
|
||||
|
||||
ApplyRandomDmgMultiplier();
|
||||
|
||||
holdEffect = GetBattlerHoldEffect(gBattlerTarget, TRUE);
|
||||
if (gBattleMons[gBattlerTarget].item == ITEM_ENIGMA_BERRY)
|
||||
{
|
||||
holdEffect = gEnigmaBerries[gBattlerTarget].holdEffect;
|
||||
param = gEnigmaBerries[gBattlerTarget].holdEffectParam;
|
||||
}
|
||||
else
|
||||
{
|
||||
holdEffect = ItemId_GetHoldEffect(gBattleMons[gBattlerTarget].item);
|
||||
param = ItemId_GetHoldEffectParam(gBattleMons[gBattlerTarget].item);
|
||||
}
|
||||
|
||||
gPotentialItemEffectBattler = gBattlerTarget;
|
||||
|
||||
if (gBattleMons[gBattlerTarget].status2 & STATUS2_SUBSTITUTE)
|
||||
goto END;
|
||||
if (gBattleMons[gBattlerTarget].hp > gBattleMoveDamage)
|
||||
goto END;
|
||||
|
||||
if (holdEffect == HOLD_EFFECT_FOCUS_BAND && (Random() % 100) < param)
|
||||
{
|
||||
RecordItemEffectBattle(gBattlerTarget, holdEffect);
|
||||
gSpecialStatuses[gBattlerTarget].focusBanded = 1;
|
||||
}
|
||||
if (gBattleMons[gBattlerTarget].status2 & STATUS2_SUBSTITUTE)
|
||||
goto END;
|
||||
if (gBattleMoves[gCurrentMove].effect != EFFECT_FALSE_SWIPE && !gProtectStructs[gBattlerTarget].endured
|
||||
&& !gSpecialStatuses[gBattlerTarget].focusBanded)
|
||||
goto END;
|
||||
|
||||
if (gBattleMons[gBattlerTarget].hp > gBattleMoveDamage)
|
||||
goto END;
|
||||
|
||||
gBattleMoveDamage = gBattleMons[gBattlerTarget].hp - 1;
|
||||
|
||||
if (gProtectStructs[gBattlerTarget].endured)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_FOE_ENDURED;
|
||||
}
|
||||
else if (gSpecialStatuses[gBattlerTarget].focusBanded)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_FOE_HUNG_ON;
|
||||
gLastUsedItem = gBattleMons[gBattlerTarget].item;
|
||||
}
|
||||
|
||||
END:
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
|
||||
static void atk08_adjustnormaldamage2(void) // The same as 0x7 except it doesn't check for false swipe move effect.
|
||||
{
|
||||
u8 holdEffect, param;
|
||||
|
||||
ApplyRandomDmgMultiplier();
|
||||
|
||||
if (gBattleMons[gBattlerTarget].item == ITEM_ENIGMA_BERRY)
|
||||
{
|
||||
holdEffect = gEnigmaBerries[gBattlerTarget].holdEffect;
|
||||
param = gEnigmaBerries[gBattlerTarget].holdEffectParam;
|
||||
}
|
||||
else
|
||||
{
|
||||
holdEffect = ItemId_GetHoldEffect(gBattleMons[gBattlerTarget].item);
|
||||
param = ItemId_GetHoldEffectParam(gBattleMons[gBattlerTarget].item);
|
||||
}
|
||||
|
||||
gPotentialItemEffectBattler = gBattlerTarget;
|
||||
|
||||
if (holdEffect == HOLD_EFFECT_FOCUS_BAND && (Random() % 100) < param)
|
||||
else if (holdEffect == HOLD_EFFECT_FOCUS_SASH && BATTLER_MAX_HP(gBattlerTarget))
|
||||
{
|
||||
RecordItemEffectBattle(gBattlerTarget, holdEffect);
|
||||
gSpecialStatuses[gBattlerTarget].focusBanded = 1;
|
||||
gSpecialStatuses[gBattlerTarget].focusSashed = 1;
|
||||
}
|
||||
if (gBattleMons[gBattlerTarget].status2 & STATUS2_SUBSTITUTE)
|
||||
goto END;
|
||||
if (!gProtectStructs[gBattlerTarget].endured && !gSpecialStatuses[gBattlerTarget].focusBanded)
|
||||
goto END;
|
||||
if (gBattleMons[gBattlerTarget].hp > gBattleMoveDamage)
|
||||
|
||||
if (gBattleMoves[gCurrentMove].effect != EFFECT_FALSE_SWIPE
|
||||
&& !gProtectStructs[gBattlerTarget].endured
|
||||
&& !gSpecialStatuses[gBattlerTarget].focusBanded
|
||||
&& !gSpecialStatuses[gBattlerTarget].focusSashed)
|
||||
goto END;
|
||||
|
||||
// Handle reducing the dmg to 1 hp
|
||||
gBattleMoveDamage = gBattleMons[gBattlerTarget].hp - 1;
|
||||
|
||||
if (gProtectStructs[gBattlerTarget].endured)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_FOE_ENDURED;
|
||||
}
|
||||
else if (gSpecialStatuses[gBattlerTarget].focusBanded)
|
||||
else if (gSpecialStatuses[gBattlerTarget].focusBanded || gSpecialStatuses[gBattlerTarget].focusSashed)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_FOE_HUNG_ON;
|
||||
gLastUsedItem = gBattleMons[gBattlerTarget].item;
|
||||
}
|
||||
|
||||
END:
|
||||
gBattlescriptCurrInstr++;
|
||||
END:
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
|
||||
static void atk08_nop(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void atk09_attackanimation(void)
|
||||
|
@ -1952,7 +1892,7 @@ static void atk0D_critmessage(void)
|
|||
{
|
||||
if (gBattleControllerExecFlags == 0)
|
||||
{
|
||||
if (gCritMultiplier == 2 && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT))
|
||||
if (gIsCriticalHit == TRUE && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT))
|
||||
{
|
||||
PrepareStringBattle(STRINGID_CRITICALHIT, gBattlerAttacker);
|
||||
gBattleCommunication[MSG_DISPLAY] = 1;
|
||||
|
@ -3865,7 +3805,7 @@ static void atk24(void)
|
|||
static void MoveValuesCleanUp(void)
|
||||
{
|
||||
gMoveResultFlags = 0;
|
||||
gCritMultiplier = 1;
|
||||
gIsCriticalHit = FALSE;
|
||||
gBattleCommunication[MOVE_EFFECT_BYTE] = 0;
|
||||
gBattleCommunication[6] = 0;
|
||||
gHitMarker &= ~(HITMARKER_DESTINYBOND);
|
||||
|
@ -6100,56 +6040,14 @@ static void atk68_cancelallactions(void)
|
|||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
|
||||
static void atk69_adjustsetdamage(void) // The same as 0x7, except there's no random damage multiplier.
|
||||
static void atk69_nop(void)
|
||||
{
|
||||
u8 holdEffect, param;
|
||||
|
||||
if (gBattleMons[gBattlerTarget].item == ITEM_ENIGMA_BERRY)
|
||||
{
|
||||
holdEffect = gEnigmaBerries[gBattlerTarget].holdEffect;
|
||||
param = gEnigmaBerries[gBattlerTarget].holdEffectParam;
|
||||
}
|
||||
else
|
||||
{
|
||||
holdEffect = ItemId_GetHoldEffect(gBattleMons[gBattlerTarget].item);
|
||||
param = ItemId_GetHoldEffectParam(gBattleMons[gBattlerTarget].item);
|
||||
}
|
||||
|
||||
gPotentialItemEffectBattler = gBattlerTarget;
|
||||
|
||||
if (holdEffect == HOLD_EFFECT_FOCUS_BAND && (Random() % 100) < param)
|
||||
{
|
||||
RecordItemEffectBattle(gBattlerTarget, holdEffect);
|
||||
gSpecialStatuses[gBattlerTarget].focusBanded = 1;
|
||||
}
|
||||
if (gBattleMons[gBattlerTarget].status2 & STATUS2_SUBSTITUTE)
|
||||
goto END;
|
||||
if (gBattleMoves[gCurrentMove].effect != EFFECT_FALSE_SWIPE && !gProtectStructs[gBattlerTarget].endured
|
||||
&& !gSpecialStatuses[gBattlerTarget].focusBanded)
|
||||
goto END;
|
||||
|
||||
if (gBattleMons[gBattlerTarget].hp > gBattleMoveDamage)
|
||||
goto END;
|
||||
|
||||
gBattleMoveDamage = gBattleMons[gBattlerTarget].hp - 1;
|
||||
|
||||
if (gProtectStructs[gBattlerTarget].endured)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_FOE_ENDURED;
|
||||
}
|
||||
else if (gSpecialStatuses[gBattlerTarget].focusBanded)
|
||||
{
|
||||
gMoveResultFlags |= MOVE_RESULT_FOE_HUNG_ON;
|
||||
gLastUsedItem = gBattleMons[gBattlerTarget].item;
|
||||
}
|
||||
|
||||
END:
|
||||
gBattlescriptCurrInstr++;
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
|
||||
static void atk6A_removeitem(void)
|
||||
{
|
||||
u16* usedHeldItem;
|
||||
u16 *usedHeldItem;
|
||||
|
||||
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1]);
|
||||
|
||||
|
|
|
@ -1430,14 +1430,7 @@ static void TrySetBattleSeminarShow(void)
|
|||
{
|
||||
u8 moveResultFlags;
|
||||
u16 sideStatus = gSideStatuses[GET_BATTLER_SIDE(gBattlerTarget)];
|
||||
gBattleMoveDamage = CalculateMoveDamage(gCurrentMove, gBattlerAttacker, gBattlerTarget, gBattleMoves[gCurrentMove].type, powerOverride, FALSE);
|
||||
|
||||
if (gStatuses3[gBattlerAttacker] & STATUS3_CHARGED_UP && gBattleMoves[gCurrentMove].type == TYPE_ELECTRIC)
|
||||
gBattleMoveDamage *= 2;
|
||||
if (gProtectStructs[gBattlerAttacker].helpingHand)
|
||||
gBattleMoveDamage = gBattleMoveDamage * 15 / 10;
|
||||
|
||||
moveResultFlags = TypeCalc(gCurrentMove, gBattlerAttacker, gBattlerTarget);
|
||||
gBattleMoveDamage = CalculateMoveDamage(gCurrentMove, gBattlerAttacker, gBattlerTarget, gBattleMoves[gCurrentMove].type, powerOverride, FALSE, FALSE);
|
||||
dmgByMove[i] = gBattleMoveDamage;
|
||||
if (dmgByMove[i] == 0 && !(moveResultFlags & MOVE_RESULT_NO_EFFECT))
|
||||
dmgByMove[i] = 1;
|
||||
|
|
1069
src/battle_util.c
1069
src/battle_util.c
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue