Merge branch 'RHH/upcoming' into RHH/pr/feature/reworkScald

# Conflicts:
#	include/constants/battle_config.h
#	include/constants/battle_move_effects.h
This commit is contained in:
Eduardo Quezada 2022-11-04 12:19:40 -03:00
commit 44bf4a15e3
80 changed files with 4991 additions and 2905 deletions

View File

@ -1988,6 +1988,12 @@
various \battler, VARIOUS_GET_BATTLER_SIDE
.endm
.macro checkparentalbondcounter counter:req, ptr:req
various BS_ATTACKER, VARIOUS_CHECK_PARENTAL_BOND_COUNTER
.byte \counter
.4byte \ptr
.endm
@ helpful macros
.macro setstatchanger stat:req, stages:req, down:req
setbyte sSTATCHANGER, \stat | \stages << 3 | \down << 7

View File

@ -2989,7 +2989,10 @@ Move_MUD_BOMB:
Move_PSYCHO_CUT:
loadspritegfx ANIM_TAG_SPIRAL
loadspritegfx ANIM_TAG_PSYCHO_CUT
loadspritegfx ANIM_TAG_CROSS_IMPACT
monbg ANIM_ATK_PARTNER
createvisualtask AnimTask_BlendParticle, 5, ANIM_TAG_CROSS_IMPACT, 0, 9, 9, RGB_PURPLE
createvisualtask AnimTask_SwayMon, 5, 0, 6, 2048, 2, ANIM_ATTACKER
createsprite gPsychoCutSpiralSpriteTemplate, 2, 4, 0, 0, 0, 0
createvisualtask AnimTask_BlendBattleAnimPal, 1, 1, 2, 0, 4, RGB_BLACK
createvisualtask AnimTask_BlendBattleAnimPal, 1, 2, 2, 0, 10, RGB(20, 12, 23)
@ -3000,8 +3003,10 @@ Move_PSYCHO_CUT:
splitbgprio ANIM_TARGET
setalpha 12, 8
playsewithpan SE_M_RAZOR_WIND2, SOUND_PAN_ATTACKER,
createsprite gPsychoCutSpriteTemplate, 130, 5, 20, 0, -8, 0, 20
createsprite gPsychoCutSpriteTemplate, ANIM_TARGET, 2, 20, 0, -8, 0, 20
waitforvisualfinish
createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 7, 0, 9, 1
createsprite gCrossImpactSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 1, 20
createvisualtask AnimTask_BlendBattleAnimPal, 1, 1, 2, 4, 0, RGB_BLACK
createvisualtask AnimTask_BlendBattleAnimPal, 1, 2, 2, 10, 0, RGB(20, 12, 23)
clearmonbg ANIM_TARGET

View File

@ -51,7 +51,7 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectBide @ EFFECT_BIDE
.4byte BattleScript_EffectRampage @ EFFECT_RAMPAGE
.4byte BattleScript_EffectRoar @ EFFECT_ROAR
.4byte BattleScript_EffectMultiHit @ EFFECT_MULTI_HIT
.4byte BattleScript_EffectHit @ EFFECT_MULTI_HIT
.4byte BattleScript_EffectConversion @ EFFECT_CONVERSION
.4byte BattleScript_EffectFlinchHit @ EFFECT_FLINCH_HIT
.4byte BattleScript_EffectRestoreHp @ EFFECT_RESTORE_HP
@ -66,11 +66,10 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectDragonRage @ EFFECT_DRAGON_RAGE
.4byte BattleScript_EffectTrap @ EFFECT_TRAP
.4byte BattleScript_EffectHealBlock @ EFFECT_HEAL_BLOCK
.4byte BattleScript_EffectDoubleHit @ EFFECT_DOUBLE_HIT
.4byte BattleScript_EffectRecoilIfMiss @ EFFECT_RECOIL_IF_MISS
.4byte BattleScript_EffectMist @ EFFECT_MIST
.4byte BattleScript_EffectFocusEnergy @ EFFECT_FOCUS_ENERGY
.4byte BattleScript_EffectRecoil25 @ EFFECT_RECOIL_25
.4byte BattleScript_EffectHit @ EFFECT_RECOIL_25
.4byte BattleScript_EffectConfuse @ EFFECT_CONFUSE
.4byte BattleScript_EffectAttackUp2 @ EFFECT_ATTACK_UP_2
.4byte BattleScript_EffectDefenseUp2 @ EFFECT_DEFENSE_UP_2
@ -99,7 +98,6 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectHit @ EFFECT_EVASION_DOWN_HIT
.4byte BattleScript_EffectTwoTurnsAttack @ EFFECT_TWO_TURNS_ATTACK
.4byte BattleScript_EffectConfuseHit @ EFFECT_CONFUSE_HIT
.4byte BattleScript_EffectTwineedle @ EFFECT_TWINEEDLE
.4byte BattleScript_EffectHit @ EFFECT_VITAL_THROW
.4byte BattleScript_EffectSubstitute @ EFFECT_SUBSTITUTE
.4byte BattleScript_EffectRecharge @ EFFECT_RECHARGE
@ -220,7 +218,7 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectSnatch @ EFFECT_SNATCH
.4byte BattleScript_EffectHit @ EFFECT_LOW_KICK
.4byte BattleScript_EffectSecretPower @ EFFECT_SECRET_POWER
.4byte BattleScript_EffectRecoil33 @ EFFECT_RECOIL_33
.4byte BattleScript_EffectHit @ EFFECT_RECOIL_33
.4byte BattleScript_EffectTeeterDance @ EFFECT_TEETER_DANCE
.4byte BattleScript_EffectHitEscape @ EFFECT_HIT_ESCAPE
.4byte BattleScript_EffectMudSport @ EFFECT_MUD_SPORT
@ -308,9 +306,9 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectGrowth @ EFFECT_GROWTH
.4byte BattleScript_EffectCloseCombat @ EFFECT_CLOSE_COMBAT
.4byte BattleScript_EffectLastResort @ EFFECT_LAST_RESORT
.4byte BattleScript_EffectRecoil33Status @ EFFECT_RECOIL_33_STATUS
.4byte BattleScript_EffectHit @ EFFECT_RECOIL_33_STATUS
.4byte BattleScript_EffectFlinchStatus @ EFFECT_FLINCH_STATUS
.4byte BattleScript_EffectRecoil50 @ EFFECT_RECOIL_50
.4byte BattleScript_EffectHit @ EFFECT_RECOIL_50
.4byte BattleScript_EffectShellSmash @ EFFECT_SHELL_SMASH
.4byte BattleScript_EffectShiftGear @ EFFECT_SHIFT_GEAR
.4byte BattleScript_EffectDefenseUp3 @ EFFECT_DEFENSE_UP_3
@ -380,12 +378,10 @@ gBattleScriptsForMoveEffects::
.4byte BattleScript_EffectHit @ EFFECT_DYNAMAX_DOUBLE_DMG
.4byte BattleScript_EffectDecorate @ EFFECT_DECORATE
.4byte BattleScript_EffectHit @ EFFECT_SNIPE_SHOT
.4byte BattleScript_EffectTripleHit @ EFFECT_TRIPLE_HIT
.4byte BattleScript_EffectRecoilHP25 @ EFFECT_RECOIL_HP_25
.4byte BattleScript_EffectStuffCheeks @ EFFECT_STUFF_CHEEKS
.4byte BattleScript_EffectDefenseDownHit @ EFFECT_GRAV_APPLE
.4byte BattleScript_EffectEvasionUpHit @ EFFECT_EVASION_UP_HIT
.4byte BattleScript_EffectDoubleIronBash @ EFFECT_DOUBLE_IRON_BASH
.4byte BattleScript_EffectGlitzyGlow @ EFFECT_GLITZY_GLOW
.4byte BattleScript_EffectBaddyBad @ EFFECT_BADDY_BAD
.4byte BattleScript_EffectSappySeed @ EFFECT_SAPPY_SEED
@ -1073,16 +1069,6 @@ BattleScript_EffectGlitzyGlow:
waitmessage B_WAIT_TIME_LONG
goto BattleScript_MoveEnd
BattleScript_EffectDoubleIronBash:
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
setmultihitcounter 2
initmultihitstring
sethword sMULTIHIT_EFFECT, MOVE_EFFECT_FLINCH
goto BattleScript_MultiHitLoop
BattleScript_EffectEvasionUpHit:
setmoveeffect MOVE_EFFECT_EVS_PLUS_1 | MOVE_EFFECT_AFFECTS_USER
goto BattleScript_EffectHit
@ -1285,27 +1271,16 @@ BattleScript_EffectBurnUp:
ppreduce
jumpiftype BS_ATTACKER, TYPE_FIRE, BattleScript_BurnUpWorks
goto BattleScript_ButItFailed
BattleScript_BurnUpWorks:
accuracycheck BattleScript_MoveMissedPause, ACC_CURR_MOVE
critcalc
damagecalc
adjustdamage
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage B_WAIT_TIME_LONG
resultmessage
waitmessage B_WAIT_TIME_LONG
setmoveeffect MOVE_EFFECT_BURN_UP | MOVE_EFFECT_CERTAIN
goto BattleScript_EffectHit
BattleScript_BurnUpRemoveType::
losetype BS_ATTACKER, TYPE_FIRE
printstring STRINGID_ATTACKERLOSTFIRETYPE
waitmessage B_WAIT_TIME_LONG
tryfaintmon BS_TARGET
goto BattleScript_MoveEnd
return
BattleScript_EffectPurify:
attackcanceler
@ -3025,6 +3000,7 @@ BattleScript_EffectNaturalGift:
waitmessage B_WAIT_TIME_LONG
seteffectwithchance
jumpifmovehadnoeffect BattleScript_EffectNaturalGiftEnd
checkparentalbondcounter 2, BattleScript_EffectNaturalGiftEnd
removeitem BS_ATTACKER
BattleScript_EffectNaturalGiftEnd:
tryfaintmon BS_TARGET
@ -3570,6 +3546,8 @@ BattleScript_MultiHitPrintStrings::
copyarray gBattleTextBuff1, sMULTIHIT_STRING, 6
printstring STRINGID_HITXTIMES
waitmessage B_WAIT_TIME_LONG
return
BattleScript_MultiHitEnd::
seteffectwithchance
tryfaintmon BS_TARGET
@ -3788,26 +3766,6 @@ BattleScript_EffectTrap::
setmoveeffect MOVE_EFFECT_WRAP
goto BattleScript_EffectHit
BattleScript_EffectTripleHit::
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
setmultihitcounter 3
initmultihitstring
sethword sMULTIHIT_EFFECT, 0
goto BattleScript_MultiHitLoop
BattleScript_EffectDoubleHit::
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
setmultihitcounter 2
initmultihitstring
sethword sMULTIHIT_EFFECT, 0
goto BattleScript_MultiHitLoop
BattleScript_EffectRecoilIfMiss::
attackcanceler
accuracycheck BattleScript_MoveMissedDoDamage, ACC_CURR_MOVE
@ -4164,16 +4122,6 @@ BattleScript_EffectConfuseHit::
setmoveeffect MOVE_EFFECT_CONFUSION
goto BattleScript_EffectHit
BattleScript_EffectTwineedle::
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
sethword sMULTIHIT_EFFECT, MOVE_EFFECT_POISON
attackstring
ppreduce
setmultihitcounter 2
initmultihitstring
goto BattleScript_MultiHitLoop
BattleScript_EffectSubstitute::
attackcanceler
ppreduce
@ -4519,64 +4467,16 @@ BattleScript_PartyHealEnd::
BattleScript_EffectTripleKick::
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
attackstring
ppreduce
sethword sTRIPLE_KICK_POWER, 0
initmultihitstring
setmultihit 3
BattleScript_TripleKickLoop::
jumpifhasnohp BS_ATTACKER, BattleScript_TripleKickEnd
jumpifhasnohp BS_TARGET, BattleScript_TripleKickNoMoreHits
jumpifhalfword CMP_EQUAL, gChosenMove, MOVE_SLEEP_TALK, BattleScript_DoTripleKickAttack
jumpifstatus BS_ATTACKER, STATUS1_SLEEP, BattleScript_TripleKickNoMoreHits
BattleScript_DoTripleKickAttack::
accuracycheck BattleScript_TripleKickNoMoreHits, ACC_CURR_MOVE
movevaluescleanup
jumpifmove MOVE_SURGING_STRIKES, EffectTripleKick_DoDmgCalcs @ no power boost each hit
jumpifmove MOVE_TRIPLE_AXEL, EffectTripleKick_TripleAxelBoost @ triple axel gets +20 power
jumpifmove MOVE_TRIPLE_AXEL BS_TripleAxel
addbyte sTRIPLE_KICK_POWER, 10 @ triple kick gets +10 power
goto EffectTripleKick_DoDmgCalcs
EffectTripleKick_TripleAxelBoost:
addbyte sTRIPLE_KICK_POWER, 20
EffectTripleKick_DoDmgCalcs:
addbyte sTRIPLE_KICK_POWER, 10
addbyte sMULTIHIT_STRING + 4, 1
critcalc
damagecalc
adjustdamage
jumpifmovehadnoeffect BattleScript_TripleKickNoMoreHits
attackanimation
waitanimation
effectivenesssound
hitanimation BS_TARGET
waitstate
healthbarupdate BS_TARGET
datahpupdate BS_TARGET
critmessage
waitmessage B_WAIT_TIME_LONG
printstring STRINGID_EMPTYSTRING3
waitmessage 1
moveendto MOVEEND_NEXT_TARGET
jumpifbyte CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_FOE_ENDURED, BattleScript_TripleKickPrintStrings
decrementmultihit BattleScript_TripleKickLoop
goto BattleScript_TripleKickPrintStrings
BattleScript_TripleKickNoMoreHits::
pause B_WAIT_TIME_SHORT
jumpifbyte CMP_EQUAL, sMULTIHIT_STRING + 4, 0, BattleScript_TripleKickPrintStrings
bichalfword gMoveResultFlags, MOVE_RESULT_MISSED
BattleScript_TripleKickPrintStrings::
resultmessage
waitmessage B_WAIT_TIME_LONG
jumpifbyte CMP_EQUAL, sMULTIHIT_STRING + 4, 0, BattleScript_TripleKickEnd
jumpifhalfword CMP_COMMON_BITS, gMoveResultFlags, MOVE_RESULT_DOESNT_AFFECT_FOE, BattleScript_TripleKickEnd
copyarray gBattleTextBuff1, sMULTIHIT_STRING, 6
printstring STRINGID_HITXTIMES
waitmessage B_WAIT_TIME_LONG
BattleScript_TripleKickEnd::
seteffectwithchance
tryfaintmon BS_TARGET
moveendfrom MOVEEND_UPDATE_LAST_MOVES
end
goto BattleScript_HitFromAtkString
BS_TripleAxel:
addbyte sTRIPLE_KICK_POWER, 20 @ triple axel gets +20 power
goto BattleScript_HitFromAtkString
BattleScript_EffectThief::
setmoveeffect MOVE_EFFECT_STEAL_ITEM
@ -5216,6 +5116,7 @@ BattleScript_EffectTeleportNew:
BattleScript_EffectTeleportNewEnd:
goto BattleScript_MoveEnd
.if B_BEAT_UP < GEN_5
BattleScript_EffectBeatUp::
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
@ -5248,6 +5149,13 @@ BattleScript_BeatUpAttack::
goto BattleScript_BeatUpLoop
BattleScript_BeatUpEnd::
end
.else
BattleScript_EffectBeatUp::
attackcanceler
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE
addbyte gBattleCommunication, 1
goto BattleScript_HitFromAtkString
.endif
BattleScript_EffectSemiInvulnerable::
jumpifstatus2 BS_ATTACKER, STATUS2_MULTIPLETURNS, BattleScript_SecondTurnSemiInvulnerable
@ -5410,9 +5318,11 @@ BattleScript_EffectSpitUp::
stockpiletobasedamage BattleScript_SpitUpFail
goto BattleScript_HitFromAtkAnimation
BattleScript_SpitUpFail::
checkparentalbondcounter 2, BattleScript_SpitUpEnd
pause B_WAIT_TIME_SHORT
printstring STRINGID_FAILEDTOSPITUP
waitmessage B_WAIT_TIME_LONG
BattleScript_SpitUpEnd:
goto BattleScript_MoveEnd
BattleScript_SpitUpFailProtect::
@ -5897,24 +5807,6 @@ BattleScript_EffectSecretPower::
getsecretpowereffect
goto BattleScript_EffectHit
BattleScript_EffectRecoil25:
setmoveeffect MOVE_EFFECT_RECOIL_25 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
jumpifnotmove MOVE_STRUGGLE, BattleScript_EffectHit
incrementgamestat GAME_STAT_USED_STRUGGLE
goto BattleScript_EffectHit
BattleScript_EffectRecoil33::
setmoveeffect MOVE_EFFECT_RECOIL_33 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
goto BattleScript_EffectHit
BattleScript_EffectRecoil33Status:
setmoveeffect MOVE_EFFECT_RECOIL_33_STATUS | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
goto BattleScript_EffectHit
BattleScript_EffectRecoil50:
setmoveeffect MOVE_EFFECT_RECOIL_50 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
goto BattleScript_EffectHit
BattleScript_EffectRecoilHP25:
setmoveeffect MOVE_EFFECT_RECOIL_HP_25 | MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN
jumpifnotmove MOVE_STRUGGLE, BattleScript_EffectHit
@ -8044,7 +7936,6 @@ BattleScript_MoveEffectConfusion::
BattleScript_MoveEffectRecoilWithStatus::
argumentstatuseffect
copyword gBattleMoveDamage, sSAVED_DMG
BattleScript_MoveEffectRecoil::
jumpifmove MOVE_STRUGGLE, BattleScript_DoRecoil
jumpifability BS_ATTACKER, ABILITY_ROCK_HEAD, BattleScript_RecoilEnd
@ -9125,6 +9016,7 @@ BattleScript_BerryCureSlpRet::
BattleScript_GemActivates::
playanimation BS_ATTACKER, B_ANIM_HELD_ITEM_EFFECT
waitanimation
setlastuseditem BS_ATTACKER
printstring STRINGID_GEMACTIVATES
waitmessage B_WAIT_TIME_LONG
removeitem BS_ATTACKER
@ -9133,6 +9025,7 @@ BattleScript_GemActivates::
BattleScript_BerryReduceDmg::
playanimation BS_TARGET, B_ANIM_HELD_ITEM_EFFECT
waitanimation
setlastuseditem BS_TARGET
printstring STRINGID_TARGETATEITEM
waitmessage B_WAIT_TIME_LONG
removeitem BS_TARGET
@ -9879,3 +9772,13 @@ BattleScript_SymbiosisActivates::
printstring STRINGID_SYMBIOSISITEMPASS
waitmessage B_WAIT_TIME_LONG
return
BattleScript_TargetAbilityStatRaiseRet::
copybyte gBattlerAbility, gEffectBattler
copybyte gBattlerAttacker, gBattlerTarget
call BattleScript_AbilityPopUp
statbuffchange MOVE_EFFECT_AFFECTS_USER | MOVE_EFFECT_CERTAIN, BattleScript_TargetAbilityStatRaiseRet_End
setgraphicalstatchangevalues
call BattleScript_StatUp
BattleScript_TargetAbilityStatRaiseRet_End:
return

View File

@ -30,6 +30,7 @@
#include "constants/frontier_util.h"
#include "constants/game_stat.h"
#include "constants/item.h"
#include "constants/item_config.h"
#include "constants/items.h"
#include "constants/heal_locations.h"
#include "constants/layouts.h"

View File

@ -1,6 +1,115 @@
EventScript_RepelWoreOff::
.if I_REPEL_LURE_MENU == TRUE
checkitem ITEM_REPEL, 1
goto_if_eq VAR_RESULT, TRUE, EventScript_RepelUseAnother
checkitem ITEM_SUPER_REPEL, 1
goto_if_eq VAR_RESULT, TRUE, EventScript_RepelUseAnother
checkitem ITEM_MAX_REPEL, 1
goto_if_eq VAR_RESULT, TRUE, EventScript_RepelUseAnother
.else
checkitem VAR_LAST_REPEL_LURE_USED, 1
goto_if_eq VAR_RESULT, TRUE, EventScript_RepelUseAnother
.endif
lock
msgbox Text_RepelWoreOff, MSGBOX_SIGN
release
end
EventScript_RepelUseAnother:
lock
msgbox Text_UseAnotherRepel, MSGBOX_YESNO
.if I_REPEL_LURE_MENU == TRUE
callnative TryDrawRepelMenu
goto_if_eq VAR_RESULT, FALSE, EventScript_RepelWoreOff_Chose
waitstate
goto_if_eq VAR_RESULT, 127, EventScript_RepelWoreOff_End
EventScript_RepelWoreOff_Chose:
callnative HandleRepelMenuChoice
bufferitemname 1, VAR_0x8004
removeitem VAR_0x8004, 1
playse SE_REPEL
msgbox Text_UsedNewRepelLure, MSGBOX_SIGN
.else
goto_if_eq VAR_RESULT, YES, EventScript_UsedRepel
.endif
EventScript_RepelWoreOff_End:
release
end
EventScript_UsedRepel:
bufferitemname 1, VAR_LAST_REPEL_LURE_USED
playse SE_REPEL
lock
msgbox Text_UsedNewRepelLure, MSGBOX_SIGN
removeitem VAR_LAST_REPEL_LURE_USED, 1
waitse
callnative HandleUseExpiredRepel
release
end
EventScript_LureWoreOff::
.if I_REPEL_LURE_MENU == TRUE
checkitem ITEM_LURE, 1
goto_if_eq VAR_RESULT, TRUE, EventScript_LureUseAnother
checkitem ITEM_SUPER_LURE, 1
goto_if_eq VAR_RESULT, TRUE, EventScript_LureUseAnother
checkitem ITEM_MAX_LURE, 1
goto_if_eq VAR_RESULT, TRUE, EventScript_LureUseAnother
.else
checkitem VAR_LAST_REPEL_LURE_USED, 1
goto_if_eq VAR_RESULT, TRUE, EventScript_LureUseAnother
.endif
lock
msgbox Text_LureWoreOff, MSGBOX_SIGN
release
end
EventScript_LureUseAnother:
lock
msgbox Text_UseAnotherLure, MSGBOX_YESNO
.if I_REPEL_LURE_MENU == TRUE
callnative TryDrawLureMenu
goto_if_eq VAR_RESULT, FALSE, EventScript_LureWoreOff_Chose
waitstate
goto_if_eq VAR_RESULT, 127, EventScript_LureWoreOff_End
EventScript_LureWoreOff_Chose:
callnative HandleLureMenuChoice
bufferitemname 1, VAR_0x8004
removeitem VAR_0x8004, 1
playse SE_REPEL
msgbox Text_UsedNewRepelLure, MSGBOX_SIGN
.else
goto_if_eq VAR_RESULT, YES, EventScript_UsedLure
.endif
EventScript_LureWoreOff_End:
release
end
EventScript_UsedLure:
bufferitemname 1, VAR_LAST_REPEL_LURE_USED
playse SE_REPEL
lock
msgbox Text_UsedNewRepelLure, MSGBOX_SIGN
removeitem VAR_LAST_REPEL_LURE_USED, 1
waitse
callnative HandleUseExpiredLure
release
end
Text_RepelWoreOff:
.string "REPEL's effect wore off…$"
Text_UseAnotherRepel::
.string "REPEL's effect wore off!\n"
.string "Use another?$"
Text_LureWoreOff:
.string "Lure's effect wore off…$"
Text_UseAnotherLure::
.string "Lure's effect wore off!\n"
.string "Use another?$"
Text_UsedNewRepelLure::
.string "{PLAYER} used the\n"
.string "{STR_VAR_2}.$"

View File

@ -163,15 +163,20 @@ struct SpecialStatus
u8 ppNotAffectedByPressure:1;
u8 faintedHasReplacement:1;
u8 focusBanded:1;
// End of byte
u8 focusSashed:1;
u8 sturdied:1;
u8 stormDrainRedirected:1;
u8 switchInAbilityDone:1;
u8 switchInItemDone:1;
u8 instructedChosenTarget:3;
// End of byte
u8 berryReduced:1;
u8 gemBoost:1;
u8 rototillerAffected:1; // to be affected by rototiller
u8 parentalBondState:2;
u8 multiHitOn:1;
// End of byte, two bits unused
u8 gemParam;
u8 damagedMons:4; // Mons that have been damaged directly by using a move, includes substitute.
u8 dancerUsedMove:1;

View File

@ -429,6 +429,9 @@ extern const u8 BattleScript_DefDownSpeedUp[];
extern const u8 BattleScript_AffectionBasedStatusHeal[];
extern const u8 BattleScript_AffectionBasedEndurance[];
extern const u8 BattleScript_SymbiosisActivates[];
extern const u8 BattleScript_MultiHitPrintStrings[];
extern const u8 BattleScript_BurnUpRemoveType[];
extern const u8 BattleScript_TargetAbilityStatRaiseRet[];
// zmoves
extern const u8 BattleScript_ZMoveActivateDamaging[];

View File

@ -186,6 +186,7 @@ void TryToRevertMimicry(void);
void RestoreBattlerOriginalTypes(u8 battlerId);
u32 GetBattlerMoveTargetType(u8 battlerId, u16 move);
bool32 CanTargetBattler(u8 battlerAtk, u8 battlerDef, u16 move);
bool8 IsMoveAffectedByParentalBond(u16 move, u8 battlerId);
// Ability checks
bool32 IsRolePlayBannedAbilityAtk(u16 ability);
bool32 IsRolePlayBannedAbility(u16 ability);
@ -202,6 +203,6 @@ bool32 CanBeParalyzed(u8 battlerId);
bool32 CanBeFrozen(u8 battlerId);
bool32 CanBeConfused(u8 battlerId);
bool32 IsBattlerTerrainAffected(u8 battlerId, u32 terrainFlag);
u32 GetMonFriendshipScore(struct Pokemon *pokemon);
u32 GetBattlerFriendshipScore(u8 battlerId);
#endif // GUARD_BATTLE_UTIL_H

View File

@ -307,7 +307,7 @@
#define MOVE_EFFECT_PAYDAY 0xB
#define MOVE_EFFECT_CHARGING 0xC
#define MOVE_EFFECT_WRAP 0xD
#define MOVE_EFFECT_RECOIL_25 0xE
#define MOVE_EFFECT_BURN_UP 0xE // MOVE_EFFECT_BURN_UP replaces unused MOVE_EFFECT_RECOIL_25 so that stat change animations don't break
#define MOVE_EFFECT_ATK_PLUS_1 0xF
#define MOVE_EFFECT_DEF_PLUS_1 0x10
#define MOVE_EFFECT_SPD_PLUS_1 0x11
@ -331,7 +331,7 @@
#define MOVE_EFFECT_RAPIDSPIN 0x23
#define MOVE_EFFECT_REMOVE_STATUS 0x24
#define MOVE_EFFECT_ATK_DEF_DOWN 0x25
#define MOVE_EFFECT_RECOIL_33 0x26
#define MOVE_EFFECT_SCALE_SHOT 0x26 // MOVE_EFFECT_SCALE_SHOT replaces unused MOVE_EFFECT_RECOIL_33 so that stat change animations don't break
#define MOVE_EFFECT_ATK_PLUS_2 0x27
#define MOVE_EFFECT_DEF_PLUS_2 0x28
#define MOVE_EFFECT_SPD_PLUS_2 0x29
@ -349,27 +349,23 @@
#define MOVE_EFFECT_THRASH 0x35
#define MOVE_EFFECT_KNOCK_OFF 0x36
#define MOVE_EFFECT_DEF_SPDEF_DOWN 0x37
#define MOVE_EFFECT_RECOIL_33_STATUS 0x38
#define MOVE_EFFECT_RECOIL_50 0x39
#define MOVE_EFFECT_CLEAR_SMOG 0x3A
#define MOVE_EFFECT_SP_ATK_TWO_DOWN 0x3B
#define MOVE_EFFECT_SMACK_DOWN 0x3C
#define MOVE_EFFECT_FLAME_BURST 0x3D
#define MOVE_EFFECT_FEINT 0x3E
#define MOVE_EFFECT_SPECTRAL_THIEF 0x3F
#define MOVE_EFFECT_V_CREATE 0x40
#define MOVE_EFFECT_HAPPY_HOUR 0x41
#define MOVE_EFFECT_CORE_ENFORCER 0x42
#define MOVE_EFFECT_THROAT_CHOP 0x43
#define MOVE_EFFECT_INCINERATE 0x44
#define MOVE_EFFECT_BUG_BITE 0x45
#define MOVE_EFFECT_RECOIL_HP_25 0x46
#define MOVE_EFFECT_RELIC_SONG 0x47
#define MOVE_EFFECT_TRAP_BOTH 0x48
#define MOVE_EFFECT_SKY_DROP 0x49
#define MOVE_EFFECT_SCALE_SHOT 0x4A
#define MOVE_EFFECT_CLEAR_SMOG 0x38
#define MOVE_EFFECT_SP_ATK_TWO_DOWN 0x39
#define MOVE_EFFECT_SMACK_DOWN 0x3A
#define MOVE_EFFECT_FLAME_BURST 0x3B
#define MOVE_EFFECT_FEINT 0x3C
#define MOVE_EFFECT_SPECTRAL_THIEF 0x3D
#define MOVE_EFFECT_V_CREATE 0x3E
#define MOVE_EFFECT_HAPPY_HOUR 0x3F
#define MOVE_EFFECT_CORE_ENFORCER 0x40
#define MOVE_EFFECT_THROAT_CHOP 0x41
#define MOVE_EFFECT_INCINERATE 0x42
#define MOVE_EFFECT_BUG_BITE 0x43
#define MOVE_EFFECT_RECOIL_HP_25 0x44
#define MOVE_EFFECT_RELIC_SONG 0x45
#define MOVE_EFFECT_TRAP_BOTH 0x46
#define NUM_MOVE_EFFECTS 0x4B
#define NUM_MOVE_EFFECTS 0x47
#define MOVE_EFFECT_AFFECTS_USER 0x4000
#define MOVE_EFFECT_CERTAIN 0x8000
@ -401,10 +397,10 @@
#define BATTLE_TERRAIN_COUNT 22
#define B_WAIT_TIME_LONG 64
#define B_WAIT_TIME_MED 48
#define B_WAIT_TIME_SHORT 32
#define B_WAIT_TIME_SHORTEST 16
#define B_WAIT_TIME_LONG (B_WAIT_TIME_MULTIPLIER * 4)
#define B_WAIT_TIME_MED (B_WAIT_TIME_MULTIPLIER * 3)
#define B_WAIT_TIME_SHORT (B_WAIT_TIME_MULTIPLIER * 2)
#define B_WAIT_TIME_SHORTEST (B_WAIT_TIME_MULTIPLIER)
#define CHERRIM_OVERCAST 0
#define CHERRIM_SUNSHINE 1
@ -483,4 +479,9 @@
// For the second argument of GetMoveTarget, when no target override is needed
#define NO_TARGET_OVERRIDE 0
// Constants for Parental Bond
#define PARENTAL_BOND_1ST_HIT 2
#define PARENTAL_BOND_2ND_HIT 1
#define PARENTAL_BOND_OFF 0
#endif // GUARD_CONSTANTS_BATTLE_H

View File

@ -29,6 +29,7 @@
#define B_KNOCK_OFF_DMG GEN_LATEST // In Gen6+, Knock Off deals 50% more damage when knocking off an item.
#define B_SPORT_DMG_REDUCTION GEN_LATEST // In Gen5+, Water/Mud Sport reduce Fire/Electric Damage by 67% instead of 50%.
#define B_EXPLOSION_DEFENSE GEN_LATEST // In Gen5+, Self-Destruct and Explosion don't halve the targets' defense.
#define B_PARENTAL_BOND_DMG GEN_LATEST // In Gen7+, Parental Bond's second hit does 25% of the initial hits damage. Before, it did 50%.
// Type settings
#define B_GHOSTS_ESCAPE GEN_LATEST // In Gen6+, abilities like Shadow Tag or moves like Mean Look fail on Ghost-type Pokémon. They can also escape any Wild Battle.
@ -89,6 +90,7 @@
#define B_ROOTED_GROUNDING GEN_LATEST // In Gen4+, Ingrain causes the affected Pokémon to become grounded.
#define B_METRONOME_MOVES GEN_LATEST // This config will determine up to which generation will Metronome pull moves from.
#define B_TELEPORT_BEHAVIOR GEN_LATEST // In Gen7+, starting with Pokémon LGPE, Teleport allows the user to swap out with another party member.
#define B_BEAT_UP GEN_LATEST // In Gen5+, Beat Up uses a different formula to calculate its damage, and deals Dark-type damage. Prior to Gen 5, each hit also announces the party member's name.
#define B_BURN_HIT_THAW GEN_LATEST // In Gen6+, damaging moves with a chance of burn will thaw the target, regardless if they're fire-type moves or not.
// Ability settings
@ -161,6 +163,7 @@
#define B_SHOW_SPLIT_ICON TRUE // If set to TRUE, it will show an icon in the summary showing the move's category split.
#define B_HIDE_HEALTHBOX_IN_ANIMS TRUE // If set to TRUE, hides healthboxes during move animations.
#define B_EXPANDED_MOVE_NAMES FALSE // If set to TRUE, move names are increased from 12 characters to 16 characters.
#define B_WAIT_TIME_MULTIPLIER 16 // This determines how long text pauses in battle last. Vanilla is 16. Lower values result in faster battles.
// Catching settings
#define B_SEMI_INVULNERABLE_CATCH GEN_LATEST // In Gen4+, you cannot throw a ball against a Pokemon that is in a semi-invulnerable state (dig/fly/etc)
@ -175,6 +178,7 @@
#define B_EVOLUTION_AFTER_WHITEOUT GEN_LATEST // In Gen6+, Pokemon that qualify for evolution after battle will evolve even if the player loses.
#define B_WILD_NATURAL_ENEMIES TRUE // If set to TRUE, certain wild mon species will attack other species when partnered in double wild battles (eg. Zangoose vs Seviper)
#define B_AFFECTION_MECHANICS FALSE // In Gen6+, there's a stat called affection that can trigger different effects in battle. From LGPE onwards, those effects use friendship instead.
#define B_TRAINER_CLASS_POKE_BALLS GEN_LATEST // In Gen7+, trainers will use certain types of Poké Balls depending on their trainer class.
// Animation Settings
#define B_NEW_SWORD_PARTICLE FALSE // If set to TRUE, it updates Swords Dance's particle.

View File

@ -45,357 +45,353 @@
#define EFFECT_DRAGON_RAGE 41
#define EFFECT_TRAP 42
#define EFFECT_HEAL_BLOCK 43
#define EFFECT_DOUBLE_HIT 44
#define EFFECT_RECOIL_IF_MISS 45
#define EFFECT_MIST 46
#define EFFECT_FOCUS_ENERGY 47
#define EFFECT_RECOIL_25 48
#define EFFECT_CONFUSE 49
#define EFFECT_ATTACK_UP_2 50
#define EFFECT_DEFENSE_UP_2 51
#define EFFECT_SPEED_UP_2 52
#define EFFECT_SPECIAL_ATTACK_UP_2 53
#define EFFECT_SPECIAL_DEFENSE_UP_2 54
#define EFFECT_ACCURACY_UP_2 55
#define EFFECT_EVASION_UP_2 56
#define EFFECT_TRANSFORM 57
#define EFFECT_ATTACK_DOWN_2 58
#define EFFECT_DEFENSE_DOWN_2 59
#define EFFECT_SPEED_DOWN_2 60
#define EFFECT_SPECIAL_ATTACK_DOWN_2 61
#define EFFECT_SPECIAL_DEFENSE_DOWN_2 62
#define EFFECT_ACCURACY_DOWN_2 63
#define EFFECT_EVASION_DOWN_2 64
#define EFFECT_REFLECT 65
#define EFFECT_POISON 66
#define EFFECT_PARALYZE 67
#define EFFECT_ATTACK_DOWN_HIT 68
#define EFFECT_DEFENSE_DOWN_HIT 69
#define EFFECT_SPEED_DOWN_HIT 70
#define EFFECT_SPECIAL_ATTACK_DOWN_HIT 71
#define EFFECT_SPECIAL_DEFENSE_DOWN_HIT 72
#define EFFECT_ACCURACY_DOWN_HIT 73
#define EFFECT_EVASION_DOWN_HIT 74
#define EFFECT_TWO_TURNS_ATTACK 75
#define EFFECT_CONFUSE_HIT 76
#define EFFECT_TWINEEDLE 77
#define EFFECT_VITAL_THROW 78
#define EFFECT_SUBSTITUTE 79
#define EFFECT_RECHARGE 80
#define EFFECT_RAGE 81
#define EFFECT_MIMIC 82
#define EFFECT_METRONOME 83
#define EFFECT_LEECH_SEED 84
#define EFFECT_DO_NOTHING 85
#define EFFECT_DISABLE 86
#define EFFECT_LEVEL_DAMAGE 87
#define EFFECT_PSYWAVE 88
#define EFFECT_COUNTER 89
#define EFFECT_ENCORE 90
#define EFFECT_PAIN_SPLIT 91
#define EFFECT_SNORE 92
#define EFFECT_CONVERSION_2 93
#define EFFECT_LOCK_ON 94
#define EFFECT_SKETCH 95
#define EFFECT_HAMMER_ARM 96
#define EFFECT_SLEEP_TALK 97
#define EFFECT_DESTINY_BOND 98
#define EFFECT_FLAIL 99
#define EFFECT_SPITE 100
#define EFFECT_FALSE_SWIPE 101
#define EFFECT_HEAL_BELL 102
#define EFFECT_ALWAYS_CRIT 103
#define EFFECT_TRIPLE_KICK 104
#define EFFECT_THIEF 105
#define EFFECT_MEAN_LOOK 106
#define EFFECT_NIGHTMARE 107
#define EFFECT_MINIMIZE 108
#define EFFECT_CURSE 109
#define EFFECT_HEALING_WISH 110
#define EFFECT_PROTECT 111
#define EFFECT_SPIKES 112
#define EFFECT_FORESIGHT 113
#define EFFECT_PERISH_SONG 114
#define EFFECT_SANDSTORM 115
#define EFFECT_ENDURE 116
#define EFFECT_ROLLOUT 117
#define EFFECT_SWAGGER 118
#define EFFECT_FURY_CUTTER 119
#define EFFECT_ATTRACT 120
#define EFFECT_RETURN 121
#define EFFECT_PRESENT 122
#define EFFECT_FRUSTRATION 123
#define EFFECT_SAFEGUARD 124
#define EFFECT_UNUSED_125 125
#define EFFECT_MAGNITUDE 126
#define EFFECT_BATON_PASS 127
#define EFFECT_PURSUIT 128
#define EFFECT_RAPID_SPIN 129
#define EFFECT_SONICBOOM 130
#define EFFECT_CAPTIVATE 131
#define EFFECT_MORNING_SUN 132
#define EFFECT_SYNTHESIS 133
#define EFFECT_MOONLIGHT 134
#define EFFECT_HIDDEN_POWER 135
#define EFFECT_RAIN_DANCE 136
#define EFFECT_SUNNY_DAY 137
#define EFFECT_DEFENSE_UP_HIT 138
#define EFFECT_ATTACK_UP_HIT 139
#define EFFECT_ALL_STATS_UP_HIT 140
#define EFFECT_FELL_STINGER 141
#define EFFECT_BELLY_DRUM 142
#define EFFECT_PSYCH_UP 143
#define EFFECT_MIRROR_COAT 144
#define EFFECT_SKULL_BASH 145
#define EFFECT_TWISTER 146
#define EFFECT_EARTHQUAKE 147
#define EFFECT_FUTURE_SIGHT 148
#define EFFECT_GUST 149
#define EFFECT_FLINCH_MINIMIZE_HIT 150
#define EFFECT_SOLAR_BEAM 151
#define EFFECT_THUNDER 152
#define EFFECT_TELEPORT 153
#define EFFECT_BEAT_UP 154
#define EFFECT_SEMI_INVULNERABLE 155
#define EFFECT_DEFENSE_CURL 156
#define EFFECT_SOFTBOILED 157
#define EFFECT_FAKE_OUT 158
#define EFFECT_UPROAR 159
#define EFFECT_STOCKPILE 160
#define EFFECT_SPIT_UP 161
#define EFFECT_SWALLOW 162
#define EFFECT_WORRY_SEED 163
#define EFFECT_HAIL 164
#define EFFECT_TORMENT 165
#define EFFECT_FLATTER 166
#define EFFECT_WILL_O_WISP 167
#define EFFECT_MEMENTO 168
#define EFFECT_FACADE 169
#define EFFECT_FOCUS_PUNCH 170
#define EFFECT_SMELLINGSALT 171
#define EFFECT_FOLLOW_ME 172
#define EFFECT_NATURE_POWER 173
#define EFFECT_CHARGE 174
#define EFFECT_TAUNT 175
#define EFFECT_HELPING_HAND 176
#define EFFECT_TRICK 177
#define EFFECT_ROLE_PLAY 178
#define EFFECT_WISH 179
#define EFFECT_ASSIST 180
#define EFFECT_INGRAIN 181
#define EFFECT_SUPERPOWER 182
#define EFFECT_MAGIC_COAT 183
#define EFFECT_RECYCLE 184
#define EFFECT_REVENGE 185
#define EFFECT_BRICK_BREAK 186
#define EFFECT_YAWN 187
#define EFFECT_KNOCK_OFF 188
#define EFFECT_ENDEAVOR 189
#define EFFECT_ERUPTION 190
#define EFFECT_SKILL_SWAP 191
#define EFFECT_IMPRISON 192
#define EFFECT_REFRESH 193
#define EFFECT_GRUDGE 194
#define EFFECT_SNATCH 195
#define EFFECT_LOW_KICK 196
#define EFFECT_SECRET_POWER 197
#define EFFECT_RECOIL_33 198
#define EFFECT_TEETER_DANCE 199
#define EFFECT_HIT_ESCAPE 200
#define EFFECT_MUD_SPORT 201
#define EFFECT_POISON_FANG 202
#define EFFECT_WEATHER_BALL 203
#define EFFECT_OVERHEAT 204
#define EFFECT_TICKLE 205
#define EFFECT_COSMIC_POWER 206
#define EFFECT_SKY_UPPERCUT 207
#define EFFECT_BULK_UP 208
#define EFFECT_PLACEHOLDER 209
#define EFFECT_WATER_SPORT 210
#define EFFECT_CALM_MIND 211
#define EFFECT_DRAGON_DANCE 212
#define EFFECT_CAMOUFLAGE 213
#define EFFECT_RECOIL_IF_MISS 44
#define EFFECT_MIST 45
#define EFFECT_FOCUS_ENERGY 46
#define EFFECT_RECOIL_25 47
#define EFFECT_CONFUSE 48
#define EFFECT_ATTACK_UP_2 49
#define EFFECT_DEFENSE_UP_2 50
#define EFFECT_SPEED_UP_2 51
#define EFFECT_SPECIAL_ATTACK_UP_2 52
#define EFFECT_SPECIAL_DEFENSE_UP_2 53
#define EFFECT_ACCURACY_UP_2 54
#define EFFECT_EVASION_UP_2 55
#define EFFECT_TRANSFORM 56
#define EFFECT_ATTACK_DOWN_2 57
#define EFFECT_DEFENSE_DOWN_2 58
#define EFFECT_SPEED_DOWN_2 59
#define EFFECT_SPECIAL_ATTACK_DOWN_2 60
#define EFFECT_SPECIAL_DEFENSE_DOWN_2 61
#define EFFECT_ACCURACY_DOWN_2 62
#define EFFECT_EVASION_DOWN_2 63
#define EFFECT_REFLECT 64
#define EFFECT_POISON 65
#define EFFECT_PARALYZE 66
#define EFFECT_ATTACK_DOWN_HIT 67
#define EFFECT_DEFENSE_DOWN_HIT 68
#define EFFECT_SPEED_DOWN_HIT 69
#define EFFECT_SPECIAL_ATTACK_DOWN_HIT 70
#define EFFECT_SPECIAL_DEFENSE_DOWN_HIT 71
#define EFFECT_ACCURACY_DOWN_HIT 72
#define EFFECT_EVASION_DOWN_HIT 73
#define EFFECT_TWO_TURNS_ATTACK 74
#define EFFECT_CONFUSE_HIT 75
#define EFFECT_VITAL_THROW 76
#define EFFECT_SUBSTITUTE 77
#define EFFECT_RECHARGE 78
#define EFFECT_RAGE 79
#define EFFECT_MIMIC 80
#define EFFECT_METRONOME 81
#define EFFECT_LEECH_SEED 82
#define EFFECT_DO_NOTHING 83
#define EFFECT_DISABLE 84
#define EFFECT_LEVEL_DAMAGE 85
#define EFFECT_PSYWAVE 86
#define EFFECT_COUNTER 87
#define EFFECT_ENCORE 88
#define EFFECT_PAIN_SPLIT 89
#define EFFECT_SNORE 90
#define EFFECT_CONVERSION_2 91
#define EFFECT_LOCK_ON 92
#define EFFECT_SKETCH 93
#define EFFECT_HAMMER_ARM 94
#define EFFECT_SLEEP_TALK 95
#define EFFECT_DESTINY_BOND 96
#define EFFECT_FLAIL 97
#define EFFECT_SPITE 98
#define EFFECT_FALSE_SWIPE 99
#define EFFECT_HEAL_BELL 100
#define EFFECT_ALWAYS_CRIT 101
#define EFFECT_TRIPLE_KICK 102
#define EFFECT_THIEF 103
#define EFFECT_MEAN_LOOK 104
#define EFFECT_NIGHTMARE 105
#define EFFECT_MINIMIZE 106
#define EFFECT_CURSE 107
#define EFFECT_HEALING_WISH 108
#define EFFECT_PROTECT 109
#define EFFECT_SPIKES 110
#define EFFECT_FORESIGHT 111
#define EFFECT_PERISH_SONG 112
#define EFFECT_SANDSTORM 113
#define EFFECT_ENDURE 114
#define EFFECT_ROLLOUT 115
#define EFFECT_SWAGGER 116
#define EFFECT_FURY_CUTTER 117
#define EFFECT_ATTRACT 118
#define EFFECT_RETURN 119
#define EFFECT_PRESENT 120
#define EFFECT_FRUSTRATION 121
#define EFFECT_SAFEGUARD 122
#define EFFECT_UNUSED_125 123
#define EFFECT_MAGNITUDE 124
#define EFFECT_BATON_PASS 125
#define EFFECT_PURSUIT 126
#define EFFECT_RAPID_SPIN 127
#define EFFECT_SONICBOOM 128
#define EFFECT_CAPTIVATE 129
#define EFFECT_MORNING_SUN 130
#define EFFECT_SYNTHESIS 131
#define EFFECT_MOONLIGHT 132
#define EFFECT_HIDDEN_POWER 133
#define EFFECT_RAIN_DANCE 134
#define EFFECT_SUNNY_DAY 135
#define EFFECT_DEFENSE_UP_HIT 136
#define EFFECT_ATTACK_UP_HIT 137
#define EFFECT_ALL_STATS_UP_HIT 138
#define EFFECT_FELL_STINGER 139
#define EFFECT_BELLY_DRUM 140
#define EFFECT_PSYCH_UP 141
#define EFFECT_MIRROR_COAT 142
#define EFFECT_SKULL_BASH 143
#define EFFECT_TWISTER 144
#define EFFECT_EARTHQUAKE 145
#define EFFECT_FUTURE_SIGHT 146
#define EFFECT_GUST 147
#define EFFECT_FLINCH_MINIMIZE_HIT 148
#define EFFECT_SOLAR_BEAM 149
#define EFFECT_THUNDER 150
#define EFFECT_TELEPORT 151
#define EFFECT_BEAT_UP 152
#define EFFECT_SEMI_INVULNERABLE 153
#define EFFECT_DEFENSE_CURL 154
#define EFFECT_SOFTBOILED 155
#define EFFECT_FAKE_OUT 156
#define EFFECT_UPROAR 157
#define EFFECT_STOCKPILE 158
#define EFFECT_SPIT_UP 159
#define EFFECT_SWALLOW 160
#define EFFECT_WORRY_SEED 161
#define EFFECT_HAIL 162
#define EFFECT_TORMENT 163
#define EFFECT_FLATTER 164
#define EFFECT_WILL_O_WISP 165
#define EFFECT_MEMENTO 166
#define EFFECT_FACADE 167
#define EFFECT_FOCUS_PUNCH 168
#define EFFECT_SMELLINGSALT 169
#define EFFECT_FOLLOW_ME 170
#define EFFECT_NATURE_POWER 171
#define EFFECT_CHARGE 172
#define EFFECT_TAUNT 173
#define EFFECT_HELPING_HAND 174
#define EFFECT_TRICK 175
#define EFFECT_ROLE_PLAY 176
#define EFFECT_WISH 177
#define EFFECT_ASSIST 178
#define EFFECT_INGRAIN 179
#define EFFECT_SUPERPOWER 180
#define EFFECT_MAGIC_COAT 181
#define EFFECT_RECYCLE 182
#define EFFECT_REVENGE 183
#define EFFECT_BRICK_BREAK 184
#define EFFECT_YAWN 185
#define EFFECT_KNOCK_OFF 186
#define EFFECT_ENDEAVOR 187
#define EFFECT_ERUPTION 188
#define EFFECT_SKILL_SWAP 189
#define EFFECT_IMPRISON 190
#define EFFECT_REFRESH 191
#define EFFECT_GRUDGE 192
#define EFFECT_SNATCH 193
#define EFFECT_LOW_KICK 194
#define EFFECT_SECRET_POWER 195
#define EFFECT_RECOIL_33 196
#define EFFECT_TEETER_DANCE 197
#define EFFECT_HIT_ESCAPE 198
#define EFFECT_MUD_SPORT 199
#define EFFECT_POISON_FANG 200
#define EFFECT_WEATHER_BALL 201
#define EFFECT_OVERHEAT 202
#define EFFECT_TICKLE 203
#define EFFECT_COSMIC_POWER 204
#define EFFECT_SKY_UPPERCUT 205
#define EFFECT_BULK_UP 206
#define EFFECT_PLACEHOLDER 207
#define EFFECT_WATER_SPORT 208
#define EFFECT_CALM_MIND 209
#define EFFECT_DRAGON_DANCE 210
#define EFFECT_CAMOUFLAGE 211
// New move effects
#define EFFECT_PLEDGE 214
#define EFFECT_FLING 215
#define EFFECT_NATURAL_GIFT 216
#define EFFECT_WAKE_UP_SLAP 217
#define EFFECT_WRING_OUT 218
#define EFFECT_HEX 219
#define EFFECT_ASSURANCE 220
#define EFFECT_TRUMP_CARD 221
#define EFFECT_ACROBATICS 222
#define EFFECT_HEAT_CRASH 223
#define EFFECT_PUNISHMENT 224
#define EFFECT_STORED_POWER 225
#define EFFECT_ELECTRO_BALL 226
#define EFFECT_GYRO_BALL 227
#define EFFECT_ECHOED_VOICE 228
#define EFFECT_PAYBACK 229
#define EFFECT_ROUND 230
#define EFFECT_BRINE 231
#define EFFECT_VENOSHOCK 232
#define EFFECT_RETALIATE 233
#define EFFECT_BULLDOZE 234
#define EFFECT_FOUL_PLAY 235
#define EFFECT_PSYSHOCK 236
#define EFFECT_ROOST 237
#define EFFECT_GRAVITY 238
#define EFFECT_MIRACLE_EYE 239
#define EFFECT_TAILWIND 240
#define EFFECT_EMBARGO 241
#define EFFECT_AQUA_RING 242
#define EFFECT_TRICK_ROOM 243
#define EFFECT_WONDER_ROOM 244
#define EFFECT_MAGIC_ROOM 245
#define EFFECT_MAGNET_RISE 246
#define EFFECT_TOXIC_SPIKES 247
#define EFFECT_GASTRO_ACID 248
#define EFFECT_STEALTH_ROCK 249
#define EFFECT_TELEKINESIS 250
#define EFFECT_POWER_SWAP 251
#define EFFECT_GUARD_SWAP 252
#define EFFECT_HEART_SWAP 253
#define EFFECT_POWER_SPLIT 254
#define EFFECT_GUARD_SPLIT 255
#define EFFECT_STICKY_WEB 256
#define EFFECT_METAL_BURST 257
#define EFFECT_LUCKY_CHANT 258
#define EFFECT_SUCKER_PUNCH 259
#define EFFECT_SPECIAL_DEFENSE_DOWN_HIT_2 260
#define EFFECT_SIMPLE_BEAM 261
#define EFFECT_ENTRAINMENT 262
#define EFFECT_HEAL_PULSE 263
#define EFFECT_QUASH 264
#define EFFECT_ION_DELUGE 265
#define EFFECT_FREEZE_DRY 266
#define EFFECT_TOPSY_TURVY 267
#define EFFECT_MISTY_TERRAIN 268
#define EFFECT_GRASSY_TERRAIN 269
#define EFFECT_ELECTRIC_TERRAIN 270
#define EFFECT_PSYCHIC_TERRAIN 271
#define EFFECT_ATTACK_ACCURACY_UP 272
#define EFFECT_ATTACK_SPATK_UP 273
#define EFFECT_HURRICANE 274
#define EFFECT_TWO_TYPED_MOVE 275
#define EFFECT_ME_FIRST 276
#define EFFECT_SPEED_UP_HIT 277
#define EFFECT_QUIVER_DANCE 278
#define EFFECT_COIL 279
#define EFFECT_ELECTRIFY 280
#define EFFECT_REFLECT_TYPE 281
#define EFFECT_SOAK 282
#define EFFECT_GROWTH 283
#define EFFECT_CLOSE_COMBAT 284
#define EFFECT_LAST_RESORT 285
#define EFFECT_RECOIL_33_STATUS 286
#define EFFECT_FLINCH_STATUS 287
#define EFFECT_RECOIL_50 288
#define EFFECT_SHELL_SMASH 289
#define EFFECT_SHIFT_GEAR 290
#define EFFECT_DEFENSE_UP_3 291
#define EFFECT_NOBLE_ROAR 292
#define EFFECT_VENOM_DRENCH 293
#define EFFECT_TOXIC_THREAD 294
#define EFFECT_CLEAR_SMOG 295
#define EFFECT_HIT_SWITCH_TARGET 296
#define EFFECT_FINAL_GAMBIT 297
#define EFFECT_CHANGE_TYPE_ON_ITEM 298
#define EFFECT_AUTOTOMIZE 299
#define EFFECT_COPYCAT 300
#define EFFECT_DEFOG 301
#define EFFECT_HIT_ENEMY_HEAL_ALLY 302
#define EFFECT_SMACK_DOWN 303
#define EFFECT_SYNCHRONOISE 304
#define EFFECT_PSYCHO_SHIFT 305
#define EFFECT_POWER_TRICK 306
#define EFFECT_FLAME_BURST 307
#define EFFECT_AFTER_YOU 308
#define EFFECT_BESTOW 309
#define EFFECT_ROTOTILLER 310
#define EFFECT_FLOWER_SHIELD 311
#define EFFECT_HIT_PREVENT_ESCAPE 312
#define EFFECT_SPEED_SWAP 313
#define EFFECT_DEFENSE_UP2_HIT 314
#define EFFECT_REVELATION_DANCE 315
#define EFFECT_AURORA_VEIL 316
#define EFFECT_THIRD_TYPE 317
#define EFFECT_FEINT 318
#define EFFECT_SPARKLING_ARIA 319
#define EFFECT_ACUPRESSURE 320
#define EFFECT_AROMATIC_MIST 321
#define EFFECT_POWDER 322
#define EFFECT_SP_ATTACK_UP_HIT 323
#define EFFECT_BELCH 324
#define EFFECT_PARTING_SHOT 325
#define EFFECT_SPECTRAL_THIEF 326
#define EFFECT_V_CREATE 327
#define EFFECT_MAT_BLOCK 328
#define EFFECT_STOMPING_TANTRUM 329
#define EFFECT_CORE_ENFORCER 330
#define EFFECT_INSTRUCT 331
#define EFFECT_THROAT_CHOP 332
#define EFFECT_LASER_FOCUS 333
#define EFFECT_MAGNETIC_FLUX 334
#define EFFECT_GEAR_UP 335
#define EFFECT_INCINERATE 336
#define EFFECT_BUG_BITE 337
#define EFFECT_STRENGTH_SAP 338
#define EFFECT_MIND_BLOWN 339
#define EFFECT_PURIFY 340
#define EFFECT_BURN_UP 341
#define EFFECT_SHORE_UP 342
#define EFFECT_GEOMANCY 343
#define EFFECT_FAIRY_LOCK 344
#define EFFECT_ALLY_SWITCH 345
#define EFFECT_RELIC_SONG 346
#define EFFECT_ATTACKER_DEFENSE_DOWN_HIT 347
#define EFFECT_BODY_PRESS 348
#define EFFECT_EERIE_SPELL 349
#define EFFECT_JUNGLE_HEALING 350
#define EFFECT_COACHING 351
#define EFFECT_LASH_OUT 352
#define EFFECT_GRASSY_GLIDE 353
#define EFFECT_REMOVE_TERRAIN 354
#define EFFECT_DYNAMAX_DOUBLE_DMG 355
#define EFFECT_DECORATE 356
#define EFFECT_SNIPE_SHOT 357
#define EFFECT_TRIPLE_HIT 358
#define EFFECT_RECOIL_HP_25 359
#define EFFECT_STUFF_CHEEKS 360
#define EFFECT_GRAV_APPLE 361
#define EFFECT_EVASION_UP_HIT 362
#define EFFECT_DOUBLE_IRON_BASH 363
#define EFFECT_GLITZY_GLOW 364
#define EFFECT_BADDY_BAD 365
#define EFFECT_SAPPY_SEED 366
#define EFFECT_FREEZY_FROST 367
#define EFFECT_SPARKLY_SWIRL 368
#define EFFECT_PLASMA_FISTS 369
#define EFFECT_HYPERSPACE_FURY 370
#define EFFECT_AURA_WHEEL 371
#define EFFECT_PHOTON_GEYSER 372
#define EFFECT_SHELL_SIDE_ARM 373
#define EFFECT_TERRAIN_PULSE 374
#define EFFECT_JAW_LOCK 375
#define EFFECT_NO_RETREAT 376
#define EFFECT_TAR_SHOT 377
#define EFFECT_POLTERGEIST 378
#define EFFECT_OCTOLOCK 379
#define EFFECT_CLANGOROUS_SOUL 380
#define EFFECT_BOLT_BEAK 381
#define EFFECT_SKY_DROP 382
#define EFFECT_EXPANDING_FORCE 383
#define EFFECT_SCALE_SHOT 384
#define EFFECT_METEOR_BEAM 385
#define EFFECT_RISING_VOLTAGE 386
#define EFFECT_BEAK_BLAST 387
#define EFFECT_COURT_CHANGE 388
#define EFFECT_STEEL_BEAM 389
#define EFFECT_EXTREME_EVOBOOST 390
#define EFFECT_DAMAGE_SET_TERRAIN 391 // genesis supernova
#define EFFECT_PLEDGE 212
#define EFFECT_FLING 213
#define EFFECT_NATURAL_GIFT 214
#define EFFECT_WAKE_UP_SLAP 215
#define EFFECT_WRING_OUT 216
#define EFFECT_HEX 217
#define EFFECT_ASSURANCE 218
#define EFFECT_TRUMP_CARD 219
#define EFFECT_ACROBATICS 220
#define EFFECT_HEAT_CRASH 221
#define EFFECT_PUNISHMENT 222
#define EFFECT_STORED_POWER 223
#define EFFECT_ELECTRO_BALL 224
#define EFFECT_GYRO_BALL 225
#define EFFECT_ECHOED_VOICE 226
#define EFFECT_PAYBACK 227
#define EFFECT_ROUND 228
#define EFFECT_BRINE 229
#define EFFECT_VENOSHOCK 230
#define EFFECT_RETALIATE 231
#define EFFECT_BULLDOZE 232
#define EFFECT_FOUL_PLAY 233
#define EFFECT_PSYSHOCK 234
#define EFFECT_ROOST 235
#define EFFECT_GRAVITY 236
#define EFFECT_MIRACLE_EYE 237
#define EFFECT_TAILWIND 238
#define EFFECT_EMBARGO 239
#define EFFECT_AQUA_RING 240
#define EFFECT_TRICK_ROOM 241
#define EFFECT_WONDER_ROOM 242
#define EFFECT_MAGIC_ROOM 243
#define EFFECT_MAGNET_RISE 244
#define EFFECT_TOXIC_SPIKES 245
#define EFFECT_GASTRO_ACID 246
#define EFFECT_STEALTH_ROCK 247
#define EFFECT_TELEKINESIS 248
#define EFFECT_POWER_SWAP 249
#define EFFECT_GUARD_SWAP 250
#define EFFECT_HEART_SWAP 251
#define EFFECT_POWER_SPLIT 252
#define EFFECT_GUARD_SPLIT 253
#define EFFECT_STICKY_WEB 254
#define EFFECT_METAL_BURST 255
#define EFFECT_LUCKY_CHANT 256
#define EFFECT_SUCKER_PUNCH 257
#define EFFECT_SPECIAL_DEFENSE_DOWN_HIT_2 258
#define EFFECT_SIMPLE_BEAM 259
#define EFFECT_ENTRAINMENT 260
#define EFFECT_HEAL_PULSE 261
#define EFFECT_QUASH 262
#define EFFECT_ION_DELUGE 263
#define EFFECT_FREEZE_DRY 264
#define EFFECT_TOPSY_TURVY 265
#define EFFECT_MISTY_TERRAIN 266
#define EFFECT_GRASSY_TERRAIN 267
#define EFFECT_ELECTRIC_TERRAIN 268
#define EFFECT_PSYCHIC_TERRAIN 269
#define EFFECT_ATTACK_ACCURACY_UP 270
#define EFFECT_ATTACK_SPATK_UP 271
#define EFFECT_HURRICANE 272
#define EFFECT_TWO_TYPED_MOVE 273
#define EFFECT_ME_FIRST 274
#define EFFECT_SPEED_UP_HIT 275
#define EFFECT_QUIVER_DANCE 276
#define EFFECT_COIL 277
#define EFFECT_ELECTRIFY 278
#define EFFECT_REFLECT_TYPE 279
#define EFFECT_SOAK 280
#define EFFECT_GROWTH 281
#define EFFECT_CLOSE_COMBAT 282
#define EFFECT_LAST_RESORT 283
#define EFFECT_RECOIL_33_STATUS 284
#define EFFECT_FLINCH_STATUS 285
#define EFFECT_RECOIL_50 286
#define EFFECT_SHELL_SMASH 287
#define EFFECT_SHIFT_GEAR 288
#define EFFECT_DEFENSE_UP_3 289
#define EFFECT_NOBLE_ROAR 290
#define EFFECT_VENOM_DRENCH 291
#define EFFECT_TOXIC_THREAD 292
#define EFFECT_CLEAR_SMOG 293
#define EFFECT_HIT_SWITCH_TARGET 294
#define EFFECT_FINAL_GAMBIT 295
#define EFFECT_CHANGE_TYPE_ON_ITEM 296
#define EFFECT_AUTOTOMIZE 297
#define EFFECT_COPYCAT 298
#define EFFECT_DEFOG 299
#define EFFECT_HIT_ENEMY_HEAL_ALLY 300
#define EFFECT_SMACK_DOWN 301
#define EFFECT_SYNCHRONOISE 302
#define EFFECT_PSYCHO_SHIFT 303
#define EFFECT_POWER_TRICK 304
#define EFFECT_FLAME_BURST 305
#define EFFECT_AFTER_YOU 306
#define EFFECT_BESTOW 307
#define EFFECT_ROTOTILLER 308
#define EFFECT_FLOWER_SHIELD 309
#define EFFECT_HIT_PREVENT_ESCAPE 310
#define EFFECT_SPEED_SWAP 311
#define EFFECT_DEFENSE_UP2_HIT 312
#define EFFECT_REVELATION_DANCE 313
#define EFFECT_AURORA_VEIL 314
#define EFFECT_THIRD_TYPE 315
#define EFFECT_FEINT 316
#define EFFECT_SPARKLING_ARIA 317
#define EFFECT_ACUPRESSURE 318
#define EFFECT_AROMATIC_MIST 319
#define EFFECT_POWDER 320
#define EFFECT_SP_ATTACK_UP_HIT 321
#define EFFECT_BELCH 322
#define EFFECT_PARTING_SHOT 323
#define EFFECT_SPECTRAL_THIEF 324
#define EFFECT_V_CREATE 325
#define EFFECT_MAT_BLOCK 326
#define EFFECT_STOMPING_TANTRUM 327
#define EFFECT_CORE_ENFORCER 328
#define EFFECT_INSTRUCT 329
#define EFFECT_THROAT_CHOP 330
#define EFFECT_LASER_FOCUS 331
#define EFFECT_MAGNETIC_FLUX 332
#define EFFECT_GEAR_UP 333
#define EFFECT_INCINERATE 334
#define EFFECT_BUG_BITE 335
#define EFFECT_STRENGTH_SAP 336
#define EFFECT_MIND_BLOWN 337
#define EFFECT_PURIFY 338
#define EFFECT_BURN_UP 339
#define EFFECT_SHORE_UP 340
#define EFFECT_GEOMANCY 341
#define EFFECT_FAIRY_LOCK 342
#define EFFECT_ALLY_SWITCH 343
#define EFFECT_RELIC_SONG 344
#define EFFECT_ATTACKER_DEFENSE_DOWN_HIT 345
#define EFFECT_BODY_PRESS 346
#define EFFECT_EERIE_SPELL 347
#define EFFECT_JUNGLE_HEALING 348
#define EFFECT_COACHING 349
#define EFFECT_LASH_OUT 350
#define EFFECT_GRASSY_GLIDE 351
#define EFFECT_REMOVE_TERRAIN 352
#define EFFECT_DYNAMAX_DOUBLE_DMG 353
#define EFFECT_DECORATE 354
#define EFFECT_SNIPE_SHOT 355
#define EFFECT_RECOIL_HP_25 356
#define EFFECT_STUFF_CHEEKS 357
#define EFFECT_GRAV_APPLE 358
#define EFFECT_EVASION_UP_HIT 359
#define EFFECT_GLITZY_GLOW 360
#define EFFECT_BADDY_BAD 361
#define EFFECT_SAPPY_SEED 362
#define EFFECT_FREEZY_FROST 363
#define EFFECT_SPARKLY_SWIRL 364
#define EFFECT_PLASMA_FISTS 365
#define EFFECT_HYPERSPACE_FURY 366
#define EFFECT_AURA_WHEEL 367
#define EFFECT_PHOTON_GEYSER 368
#define EFFECT_SHELL_SIDE_ARM 369
#define EFFECT_TERRAIN_PULSE 370
#define EFFECT_JAW_LOCK 371
#define EFFECT_NO_RETREAT 372
#define EFFECT_TAR_SHOT 373
#define EFFECT_POLTERGEIST 374
#define EFFECT_OCTOLOCK 375
#define EFFECT_CLANGOROUS_SOUL 376
#define EFFECT_BOLT_BEAK 377
#define EFFECT_SKY_DROP 378
#define EFFECT_EXPANDING_FORCE 379
#define EFFECT_SCALE_SHOT 380
#define EFFECT_METEOR_BEAM 381
#define EFFECT_RISING_VOLTAGE 382
#define EFFECT_BEAK_BLAST 383
#define EFFECT_COURT_CHANGE 384
#define EFFECT_STEEL_BEAM 385
#define EFFECT_EXTREME_EVOBOOST 386
#define EFFECT_DAMAGE_SET_TERRAIN 387 // genesis supernova
#define NUM_BATTLE_MOVE_EFFECTS 392
#define NUM_BATTLE_MOVE_EFFECTS 388
#endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H

View File

@ -245,6 +245,7 @@
#define VARIOUS_TRY_SYMBIOSIS 154
#define VARIOUS_CAN_TELEPORT 155
#define VARIOUS_GET_BATTLER_SIDE 156
#define VARIOUS_CHECK_PARENTAL_BOND_COUNTER 157
// Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0
@ -284,40 +285,43 @@
#define PARTY_SCREEN_OPTIONAL (1 << 7) // Flag for first argument to openpartyscreen
// cases for Cmd_moveend
#define MOVEEND_PROTECT_LIKE_EFFECT 0
#define MOVEEND_RAGE 1
#define MOVEEND_DEFROST 2
#define MOVEEND_SUM_DAMAGE 0
#define MOVEEND_PROTECT_LIKE_EFFECT 1
#define MOVEEND_RAGE 2
#define MOVEEND_SYNCHRONIZE_TARGET 3
#define MOVEEND_ABILITIES 4
#define MOVEEND_ABILITIES_ATTACKER 5
#define MOVEEND_STATUS_IMMUNITY_ABILITIES 6
#define MOVEEND_SYNCHRONIZE_ATTACKER 7
#define MOVEEND_CHOICE_MOVE 8
#define MOVEEND_CHANGED_ITEMS 9
#define MOVEEND_ATTACKER_INVISIBLE 10
#define MOVEEND_ATTACKER_VISIBLE 11
#define MOVEEND_TARGET_VISIBLE 12
#define MOVEEND_ITEM_EFFECTS_TARGET 13
#define MOVEEND_MOVE_EFFECTS2 14
#define MOVEEND_ITEM_EFFECTS_ALL 15
#define MOVEEND_KINGSROCK 16 // These item effects will occur each strike of a multi-hit move
#define MOVEEND_SUBSTITUTE 17
#define MOVEEND_SKY_DROP_CONFUSE 18
#define MOVEEND_UPDATE_LAST_MOVES 19
#define MOVEEND_MIRROR_MOVE 20
#define MOVEEND_NEXT_TARGET 21 // Everything up until here is handled for each strike of a multi-hit move
#define MOVEEND_MAGICIAN 22 // Occurs after final multi-hit strike, and after other items/abilities would activate
#define MOVEEND_EJECT_BUTTON 23
#define MOVEEND_RED_CARD 24
#define MOVEEND_EJECT_PACK 25
#define MOVEEND_LIFEORB_SHELLBELL 26 // Includes shell bell, throat spray, etc
#define MOVEEND_PICKPOCKET 27
#define MOVEEND_DANCER 28
#define MOVEEND_EMERGENCY_EXIT 29
#define MOVEEND_WEATHER_FORM 30
#define MOVEEND_SYMBIOSIS 31
#define MOVEEND_CLEAR_BITS 32
#define MOVEEND_COUNT 33
#define MOVEEND_ATTACKER_INVISIBLE 9
#define MOVEEND_ATTACKER_VISIBLE 10
#define MOVEEND_TARGET_VISIBLE 11
#define MOVEEND_ITEM_EFFECTS_TARGET 12
#define MOVEEND_ITEM_EFFECTS_ALL 13
#define MOVEEND_KINGSROCK 14 // These item effects will occur each strike of a multi-hit move
#define MOVEEND_SUBSTITUTE 15
#define MOVEEND_SKY_DROP_CONFUSE 16
#define MOVEEND_UPDATE_LAST_MOVES 17
#define MOVEEND_MIRROR_MOVE 18
#define MOVEEND_NEXT_TARGET 19 // Everything up until here is handled for each strike of a multi-hit move
#define MOVEEND_MULTIHIT_MOVE 20
#define MOVEEND_DEFROST 21
#define MOVEEND_MOVE_EFFECTS2 22
#define MOVEEND_RECOIL 23
#define MOVEEND_MAGICIAN 24 // Occurs after final multi-hit strike, and after other items/abilities would activate
#define MOVEEND_EJECT_BUTTON 25
#define MOVEEND_RED_CARD 26
#define MOVEEND_EJECT_PACK 27
#define MOVEEND_LIFEORB_SHELLBELL 28 // Includes shell bell, throat spray, etc
#define MOVEEND_CHANGED_ITEMS 29
#define MOVEEND_PICKPOCKET 30
#define MOVEEND_DANCER 31
#define MOVEEND_EMERGENCY_EXIT 32
#define MOVEEND_WEATHER_FORM 33
#define MOVEEND_SYMBIOSIS 34
#define MOVEEND_CLEAR_BITS 35
#define MOVEEND_COUNT 36
// switch cases
#define B_SWITCH_NORMAL 0

View File

@ -16,4 +16,10 @@
#define KEYITEMS_POCKET 4
#define POCKETS_COUNT 5
#define REPEL_LURE_MASK (1 << 15)
#define IS_LAST_USED_LURE(var) (var & REPEL_LURE_MASK)
#define REPEL_LURE_STEPS(var) (var & (REPEL_LURE_MASK - 1))
#define LURE_STEP_COUNT (IS_LAST_USED_LURE(VarGet(VAR_REPEL_STEP_COUNT)) ? REPEL_LURE_STEPS(VarGet(VAR_REPEL_STEP_COUNT)) : 0)
#define REPEL_STEP_COUNT (!IS_LAST_USED_LURE(VarGet(VAR_REPEL_STEP_COUNT)) ? REPEL_LURE_STEPS(VarGet(VAR_REPEL_STEP_COUNT)) : 0)
#endif // GUARD_ITEM_CONSTANTS_H

View File

@ -9,4 +9,9 @@
#define I_SITRUS_BERRY_HEAL GEN_LATEST // In Gen4+, Sitrus Berry was changed from healing 30 HP to healing 25% of Max HP.
#define I_VITAMIN_EV_CAP GEN_LATEST // In Gen8, the Vitamins no longer have a cap of 100 EV per stat.
// Repel/Lure config
// These two settings are both independent and complementary.
#define VAR_LAST_REPEL_LURE_USED 0 // If this var has been assigned, last Repel/Lure used will be saved and the player will get prompted with the vanilla repel YES/NO option, unless I_REPEL_LURE_MENU is set to TRUE.
#define I_REPEL_LURE_MENU TRUE // If TRUE, the player is able to choose which Repel/Lure to use once the previous one runs out. Cursor position is saved by VAR_LAST_REPEL_LURE_USED if not 0.
#endif // GUARD_CONSTANTS_ITEM_CONFIG_H

View File

@ -931,6 +931,10 @@
#define ITEMS_COUNT 758
#define ITEM_FIELD_ARROW ITEMS_COUNT
// A special item id associated with "Cancel"/"Exit" etc. in a list of items or decorations
// Its icon is defined at ITEMS_COUNT as the "return to field" arrow
#define ITEM_LIST_END 0xFFFF
// Range of berries given out by various NPCS
#define FIRST_BERRY_MASTER_BERRY ITEM_POMEG_BERRY
#define LAST_BERRY_MASTER_BERRY ITEM_NOMEL_BERRY

View File

@ -1,6 +1,9 @@
#ifndef GUARD_CONSTANTS_OVERWORLD_CONFIG_H
#define GUARD_CONSTANTS_OVERWORLD_CONFIG_H
// Movement config
#define OW_RUNNING_INDOORS GEN_LATEST // In Gen4+, players are allowed to run indoors.
// Overworld flags
#define OW_FLAG_NO_ENCOUNTER 0 // If this flag is set, wild encounters will be disabled.
#define OW_FLAG_NO_TRAINER_SEE 0 // If this flag is set, trainers will not battle the player unless they're talked to.
@ -13,6 +16,5 @@
// Replace the used flags with others or disable with a 0
#define DEBUG_FLAG_NO_COLLISION 0 // If this flag is set, the debug function in the Utility submenu to disable player collision can be used.
#define DEBUG_FLAG_PC_FROM_DEBUG_MENU 0 // If this flag is set, the debug function in debug menu to access the player PC works.
#endif // GUARD_CONSTANTS_OVERWORLD_CONFIG_H

View File

@ -332,6 +332,7 @@
#define BATTLE_ALIVE_EXCEPT_ACTIVE 0
#define BATTLE_ALIVE_ATK_SIDE 1
#define BATTLE_ALIVE_DEF_SIDE 2
#define BATTLE_ALIVE_EXCEPT_ATTACKER 3
#define SKIP_FRONT_ANIM (1 << 7)

View File

@ -352,6 +352,7 @@
#define TRAINER_CLASS_PIKE_QUEEN 0x3f
#define TRAINER_CLASS_PYRAMID_KING 0x40
#define TRAINER_CLASS_RS_PROTAG 0x41
#define TRAINER_CLASS_COUNT 0x42
#define TRAINER_ENCOUNTER_MUSIC_MALE 0 // standard male encounter music
#define TRAINER_ENCOUNTER_MUSIC_FEMALE 1 // standard female encounter music

View File

@ -35,6 +35,7 @@ bool8 FldEff_UseStrength(void);
// sweet scent
bool8 SetUpFieldMove_SweetScent(void);
bool8 FldEff_SweetScent(void);
void StartSweetScentFieldEffect(void);
// teleport
bool8 SetUpFieldMove_Teleport(void);

View File

@ -67,6 +67,9 @@
#define DISPLAY_WIDTH 240
#define DISPLAY_HEIGHT 160
#define DISPLAY_TILE_WIDTH (DISPLAY_WIDTH / 8)
#define DISPLAY_TILE_HEIGHT (DISPLAY_HEIGHT / 8)
#define TILE_SIZE_4BPP 32
#define TILE_SIZE_8BPP 64

View File

@ -64,13 +64,11 @@ u16 CountTotalItemQuantityInBag(u16 itemId);
bool8 AddPyramidBagItem(u16 itemId, u16 count);
bool8 RemovePyramidBagItem(u16 itemId, u16 count);
const u8 *ItemId_GetName(u16 itemId);
u16 ItemId_GetId(u16 itemId);
u16 ItemId_GetPrice(u16 itemId);
u8 ItemId_GetHoldEffect(u16 itemId);
u8 ItemId_GetHoldEffectParam(u16 itemId);
const u8 *ItemId_GetDescription(u16 itemId);
u8 ItemId_GetImportance(u16 itemId);
u8 ItemId_GetRegistrability(u16 itemId);
u8 ItemId_GetPocket(u16 itemId);
u8 ItemId_GetType(u16 itemId);
ItemUseFunc ItemId_GetFieldFunc(u16 itemId);

View File

@ -20,6 +20,7 @@ void ItemUseOutOfBattle_PPUp(u8);
void ItemUseOutOfBattle_RareCandy(u8);
void ItemUseOutOfBattle_TMHM(u8);
void ItemUseOutOfBattle_Repel(u8);
void ItemUseOutOfBattle_Lure(u8);
void ItemUseOutOfBattle_EscapeRope(u8);
void ItemUseOutOfBattle_BlackWhiteFlute(u8);
void ItemUseOutOfBattle_EvolutionStone(u8);
@ -27,6 +28,7 @@ void ItemUseOutOfBattle_Berry(u8);
void ItemUseOutOfBattle_EnigmaBerry(u8);
void ItemUseOutOfBattle_FormChange(u8);
void ItemUseOutOfBattle_FormChange_ConsumedOnUse(u8);
void ItemUseOutOfBattle_Honey(u8);
void ItemUseOutOfBattle_CannotUse(u8);
void ItemUseInBattle_PokeBall(u8);
void ItemUseInBattle_StatIncrease(u8);

View File

@ -565,5 +565,6 @@ u16 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *mon, u16 method, u32 arg
u16 MonTryLearningNewMoveEvolution(struct Pokemon *mon, bool8 firstMove);
bool32 ShouldShowFemaleDifferences(u16 species, u32 personality);
void TryToSetBattleFormChangeMoves(struct Pokemon *mon);
u32 GetMonFriendshipScore(struct Pokemon *pokemon);
#endif // GUARD_POKEMON_H

View File

@ -3,47 +3,6 @@
extern EWRAM_DATA struct ItemSlot gMartPurchaseHistory[3];
enum
{
MART_TYPE_NORMAL, // normal mart
MART_TYPE_DECOR,
MART_TYPE_DECOR2,
};
// shop view window NPC info enum
enum
{
OBJ_EVENT_ID,
X_COORD,
Y_COORD,
ANIM_NUM,
LAYER_TYPE
};
struct MartInfo
{
/*0x0*/ void (*callback)(void);
/*0x4*/ const struct MenuAction *menuActions;
/*0x8*/ const u16 *itemList;
/*0xC*/ u16 itemCount;
/*0xE*/ u8 windowId;
/*0xF*/ u8 martType;
};
struct ShopData
{
/*0x0000*/ u16 tilemapBuffers[4][0x400];
/*0x2000*/ u32 totalCost;
/*0x2004*/ u16 itemsShowed;
/*0x2006*/ u16 selectedRow;
/*0x2008*/ u16 scrollOffset;
/*0x200A*/ u8 maxQuantity;
/*0x200B*/ u8 scrollIndicatorsTaskId;
/*0x200C*/ u8 iconSlot;
/*0x200D*/ u8 itemSpriteIds[2];
/*0x2010*/ s16 viewportObjects[OBJECT_EVENTS_COUNT][5];
};
void CreatePokemartMenu(const u16 *);
void CreateDecorationShop1Menu(const u16 *);
void CreateDecorationShop2Menu(const u16 *);

View File

@ -938,6 +938,7 @@ extern const u8 gText_BootedUpTM[];
extern const u8 gText_TMHMContainedVar1[];
extern const u8 gText_PlayerUsedVar2[];
extern const u8 gText_RepelEffectsLingered[];
extern const u8 gText_LureEffectsLingered[];
extern const u8 gText_UsedVar2WildLured[];
extern const u8 gText_UsedVar2WildRepelled[];
extern const u8 gText_BoxFull[];

View File

@ -3407,7 +3407,6 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
score += min(CountPositiveStatStages(battlerDef), 4);
break;
case EFFECT_MULTI_HIT:
case EFFECT_DOUBLE_HIT:
case EFFECT_TRIPLE_KICK:
if (AI_MoveMakesContact(AI_DATA->abilities[battlerAtk], AI_DATA->holdEffects[battlerAtk], move)
&& AI_DATA->abilities[battlerAtk] != ABILITY_MAGIC_GUARD

View File

@ -1333,7 +1333,7 @@ bool32 IsConfusionMoveEffect(u16 moveEffect)
{
switch (moveEffect)
{
case EFFECT_CONFUSE_HIT:
case EFFECT_CONFUSE:
case EFFECT_SWAGGER:
case EFFECT_FLATTER:
case EFFECT_TEETER_DANCE:

View File

@ -19,6 +19,7 @@
#include "constants/hold_effects.h"
#include "constants/items.h"
#include "constants/pokemon.h"
#include "battle_util.h"
// function declarations
static void SpriteCB_SpriteToCentreOfSide(struct Sprite *sprite);
@ -7856,8 +7857,8 @@ static void SpriteCB_TwinkleOnBattler(struct Sprite *sprite)
void AnimTask_PrimalReversion(u8 taskId)
{
if (ItemId_GetId(gBattleMons[gBattleAnimAttacker].item) == ITEM_RED_ORB)
gBattleAnimArgs[0] = ItemId_GetId(gBattleMons[gBattleAnimAttacker].item);
if (gBattleMons[gBattleAnimAttacker].item == ITEM_RED_ORB)
gBattleAnimArgs[0] = gBattleMons[gBattleAnimAttacker].item;
else
gBattleAnimArgs[0] = 0;
DestroyAnimVisualTask(taskId);
@ -7899,6 +7900,6 @@ void AnimTask_AffectionHangedOn(u8 taskId)
int side = GetBattlerSide(gBattleAnimTarget);
struct Pokemon *party = (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
gBattleAnimArgs[0] = GetMonFriendshipScore(&party[gBattlerPartyIndexes[gBattleAnimTarget]]);
gBattleAnimArgs[0] = GetBattlerFriendshipScore(gBattleAnimTarget);
DestroyAnimVisualTask(taskId);
}

View File

@ -1547,19 +1547,18 @@ static void OpponentHandleYesNoBox(void)
}
static void OpponentHandleChooseMove(void)
{
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{
BtlController_EmitTwoReturnValues(BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace());
OpponentBufferExecCompleted();
}
else
{
u8 chosenMoveId;
struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[gActiveBattler][4]);
if (gBattleTypeFlags & (BATTLE_TYPE_TRAINER | BATTLE_TYPE_FIRST_BATTLE | BATTLE_TYPE_SAFARI | BATTLE_TYPE_ROAMER)
|| IsWildMonSmart())
{
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{
BtlController_EmitTwoReturnValues(BUFFER_B, 10, ChooseMoveAndTargetInBattlePalace());
}
else
{
chosenMoveId = gBattleStruct->aiMoveOrAction[gActiveBattler];
gBattlerTarget = gBattleStruct->aiChosenTarget[gActiveBattler];
@ -1598,6 +1597,7 @@ static void OpponentHandleChooseMove(void)
}
break;
}
}
OpponentBufferExecCompleted();
}
else // Wild pokemon - use random move
@ -1659,7 +1659,6 @@ static void OpponentHandleChooseMove(void)
OpponentBufferExecCompleted();
}
}
}
static void OpponentHandleChooseItem(void)
{

View File

@ -164,6 +164,7 @@ u16 ChooseMoveAndTargetInBattlePalace(void)
{
gBattleStruct->palaceFlags &= 0xF;
gBattleStruct->palaceFlags |= (selectedMoves << 4);
sBattler_AI = gActiveBattler;
BattleAI_SetupAIData(selectedMoves);
chosenMoveId = BattleAI_ChooseMoveOrAction();
}
@ -171,8 +172,9 @@ u16 ChooseMoveAndTargetInBattlePalace(void)
// If no moves matched the selected group, pick a new move from groups the pokemon has
// In this case the AI is not checked again, so the choice may be worse
// If a move is chosen this way, there's a 50% chance that it will be unable to use it anyway
if (chosenMoveId == -1)
if (chosenMoveId == -1 || chosenMoveId >= MAX_MON_MOVES)
{
chosenMoveId = -1;
if (unusableMovesBits != 0xF)
{
validMoveFlags = 0, numValidMoveGroups = 0;

View File

@ -325,10 +325,13 @@ static const struct SpriteTemplate sHealthbarSpriteTemplates[MAX_BATTLERS_COUNT]
}
};
/* v-- Origin
[0 + ][1 ] 64x8
*/
static const struct Subsprite sHealthBar_Subsprites_Player[] =
{
{
.x = DISPLAY_WIDTH,
.x = -16,
.y = 0,
.shape = SPRITE_SHAPE(32x8),
.size = SPRITE_SIZE(32x8),
@ -345,10 +348,14 @@ static const struct Subsprite sHealthBar_Subsprites_Player[] =
}
};
/* v-- Origin
[] [0 + ][1 ] 8x8 + 64x8
2^ ^--- Note 8px space
*/
static const struct Subsprite sHealthBar_Subsprites_Opponent[] =
{
{
.x = DISPLAY_WIDTH,
.x = -16,
.y = 0,
.shape = SPRITE_SHAPE(32x8),
.size = SPRITE_SIZE(32x8),
@ -364,7 +371,7 @@ static const struct Subsprite sHealthBar_Subsprites_Opponent[] =
.priority = 1
},
{
.x = DISPLAY_WIDTH - 16,
.x = -32,
.y = 0,
.shape = SPRITE_SHAPE(8x8),
.size = SPRITE_SIZE(8x8),
@ -378,11 +385,13 @@ static const struct SubspriteTable sHealthBar_SubspriteTables[] =
[B_SIDE_PLAYER] = {ARRAY_COUNT(sHealthBar_Subsprites_Player), sHealthBar_Subsprites_Player},
[B_SIDE_OPPONENT] = {ARRAY_COUNT(sHealthBar_Subsprites_Opponent), sHealthBar_Subsprites_Opponent}
};
/* v-- Origin
[0 ][1 ][2 ][3 ] 128x8
*/
static const struct Subsprite sStatusSummaryBar_Subsprites_Enter[] =
{
{
.x = 32 * 5,
.x = 32 * -3,
.y = 0,
.shape = SPRITE_SHAPE(32x8),
.size = SPRITE_SIZE(32x8),
@ -390,7 +399,7 @@ static const struct Subsprite sStatusSummaryBar_Subsprites_Enter[] =
.priority = 1
},
{
.x = 32 * 6,
.x = 32 * -2,
.y = 0,
.shape = SPRITE_SHAPE(32x8),
.size = SPRITE_SIZE(32x8),
@ -398,7 +407,7 @@ static const struct Subsprite sStatusSummaryBar_Subsprites_Enter[] =
.priority = 1
},
{
.x = 32 * 7,
.x = 32 * -1,
.y = 0,
.shape = SPRITE_SHAPE(32x8),
.size = SPRITE_SIZE(32x8),
@ -415,10 +424,14 @@ static const struct Subsprite sStatusSummaryBar_Subsprites_Enter[] =
}
};
/* v-- Origin
[0 ][1 ][2 ][3 ][4 ][5 ] 192x8
^-- uses same tiles --^
*/
static const struct Subsprite sStatusSummaryBar_Subsprites_Exit[] =
{
{
.x = 32 * 5,
.x = 32 * -3,
.y = 0,
.shape = SPRITE_SHAPE(32x8),
.size = SPRITE_SIZE(32x8),
@ -426,7 +439,7 @@ static const struct Subsprite sStatusSummaryBar_Subsprites_Exit[] =
.priority = 1
},
{
.x = 32 * 6,
.x = 32 * -2,
.y = 0,
.shape = SPRITE_SHAPE(32x8),
.size = SPRITE_SIZE(32x8),
@ -434,7 +447,7 @@ static const struct Subsprite sStatusSummaryBar_Subsprites_Exit[] =
.priority = 1
},
{
.x = 32 * 7,
.x = 32 * -1,
.y = 0,
.shape = SPRITE_SHAPE(32x8),
.size = SPRITE_SIZE(32x8),

View File

@ -392,6 +392,32 @@ const struct TrainerMoney gTrainerMoneyTable[] =
{0xFF, 5}, // Any trainer class not listed above uses this
};
#if B_TRAINER_CLASS_POKE_BALLS >= GEN_7
static const u16 sTrainerBallTable[TRAINER_CLASS_COUNT] =
{
#if B_TRAINER_CLASS_POKE_BALLS == GEN_7
[TRAINER_CLASS_PKMN_BREEDER] = ITEM_FRIEND_BALL,
#elif B_TRAINER_CLASS_POKE_BALLS == GEN_8
[TRAINER_CLASS_PKMN_BREEDER] = ITEM_HEAL_BALL,
#endif
[TRAINER_CLASS_COOLTRAINER] = ITEM_ULTRA_BALL,
[TRAINER_CLASS_COLLECTOR] = ITEM_PREMIER_BALL,
[TRAINER_CLASS_SWIMMER_M] = ITEM_DIVE_BALL,
[TRAINER_CLASS_BLACK_BELT] = ITEM_ULTRA_BALL,
[TRAINER_CLASS_AQUA_LEADER] = ITEM_MASTER_BALL,
[TRAINER_CLASS_GENTLEMAN] = ITEM_LUXURY_BALL,
[TRAINER_CLASS_ELITE_FOUR] = ITEM_ULTRA_BALL,
#if B_TRAINER_CLASS_POKE_BALLS == GEN_7
[TRAINER_CLASS_FISHERMAN] = ITEM_LURE_BALL,
#elif B_TRAINER_CLASS_POKE_BALLS == GEN_8
[TRAINER_CLASS_FISHERMAN] = ITEM_DIVE_BALL,
#endif
[TRAINER_CLASS_SWIMMER_F] = ITEM_DIVE_BALL,
[TRAINER_CLASS_COOLTRAINER_2] = ITEM_ULTRA_BALL,
[TRAINER_CLASS_MAGMA_LEADER] = ITEM_MASTER_BALL,
};
#endif
#include "data/text/abilities.h"
static void (* const sTurnActionsFuncsTable[])(void) =
@ -1847,6 +1873,7 @@ static u8 CreateNPCTrainerParty(struct Pokemon *party, u16 trainerNum, bool8 fir
u8 fixedIV;
s32 i, j;
u8 monsCount;
u16 ball;
if (trainerNum == TRAINER_SECRET_BASE)
return 0;
@ -1950,6 +1977,11 @@ static u8 CreateNPCTrainerParty(struct Pokemon *party, u16 trainerNum, bool8 fir
break;
}
}
#if B_TRAINER_CLASS_POKE_BALLS >= GEN_7
ball = (sTrainerBallTable[gTrainers[trainerNum].trainerClass]) ? sTrainerBallTable[gTrainers[trainerNum].trainerClass] : ITEM_POKE_BALL;
SetMonData(&party[i], MON_DATA_POKEBALL, &ball);
#endif
}
gBattleTypeFlags |= gTrainers[trainerNum].doubleBattle;
@ -2969,6 +3001,7 @@ static void BattleStartClearSetData(void)
gBattleScripting.monCaught = FALSE;
gMultiHitCounter = 0;
gBattleScripting.savedDmg = 0;
gBattleOutcome = 0;
gBattleControllerExecFlags = 0;
gPaydayMoney = 0;
@ -3271,6 +3304,11 @@ void FaintClearSetData(void)
}
}
}
// Clear Z-Move data
gBattleStruct->zmove.active = FALSE;
gBattleStruct->zmove.toBeUsed[gActiveBattler] = MOVE_NONE;
gBattleStruct->zmove.effect = EFFECT_HIT;
}
static void DoBattleIntro(void)
@ -3936,7 +3974,8 @@ static void HandleTurnActionSelectionState(void)
gBattleCommunication[gActiveBattler] = STATE_BEFORE_ACTION_CHOSEN;
// Do AI score computations here so we can use them in AI_TrySwitchOrUseItem
if ((gBattleTypeFlags & BATTLE_TYPE_HAS_AI || IsWildMonSmart()) && IsBattlerAIControlled(gActiveBattler)) {
if ((gBattleTypeFlags & BATTLE_TYPE_HAS_AI || IsWildMonSmart())
&& (IsBattlerAIControlled(gActiveBattler) && !(gBattleTypeFlags & BATTLE_TYPE_PALACE))) {
gBattleStruct->aiMoveOrAction[gActiveBattler] = ComputeBattleAiScores(gActiveBattler);
}
break;
@ -4804,6 +4843,8 @@ static void TurnValuesCleanUp(bool8 var0)
if (gDisableStructs[gActiveBattler].substituteHP == 0)
gBattleMons[gActiveBattler].status2 &= ~STATUS2_SUBSTITUTE;
gSpecialStatuses[gActiveBattler].parentalBondState = PARENTAL_BOND_OFF;
}
gSideStatuses[0] &= ~(SIDE_STATUS_QUICK_GUARD | SIDE_STATUS_WIDE_GUARD | SIDE_STATUS_CRAFTY_SHIELD | SIDE_STATUS_MAT_BLOCK);

View File

@ -645,7 +645,7 @@ static void BagCursorMoved(s32 itemIndex, bool8 onInit, struct ListMenu *list)
if (itemIndex != LIST_CANCEL)
ShowItemIcon(gSaveBlock2Ptr->frontier.pyramidBag.itemId[gSaveBlock2Ptr->frontier.lvlMode][itemIndex], gPyramidBagMenu->isAltIcon);
else
ShowItemIcon(0xFFFF, gPyramidBagMenu->isAltIcon); // Show exit arrow if on Cancel
ShowItemIcon(ITEM_LIST_END, gPyramidBagMenu->isAltIcon); // Show exit arrow if on Cancel
gPyramidBagMenu->isAltIcon ^= 1;
PrintItemDescription(itemIndex);
}

View File

@ -318,6 +318,7 @@ static void DrawLevelUpBannerText(void);
static void SpriteCB_MonIconOnLvlUpBanner(struct Sprite *sprite);
static bool32 CriticalCapture(u32 odds);
static void BestowItem(u32 battlerAtk, u32 battlerDef);
static bool8 IsFinalStrikeEffect(u16 move);
static void Cmd_attackcanceler(void);
static void Cmd_accuracycheck(void);
@ -884,8 +885,6 @@ static const u8 *const sMoveEffectBS_Ptrs[] =
[MOVE_EFFECT_UPROAR] = BattleScript_MoveEffectUproar,
[MOVE_EFFECT_PAYDAY] = BattleScript_MoveEffectPayDay,
[MOVE_EFFECT_WRAP] = BattleScript_MoveEffectWrap,
[MOVE_EFFECT_RECOIL_25] = BattleScript_MoveEffectRecoil,
[MOVE_EFFECT_RECOIL_33] = BattleScript_MoveEffectRecoil,
};
static const struct WindowTemplate sUnusedWinTemplate =
@ -938,6 +937,7 @@ static const u16 sProtectSuccessRates[] = {USHRT_MAX, USHRT_MAX / 2, USHRT_MAX /
#define FORBIDDEN_COPYCAT (1 << 3)
#define FORBIDDEN_SLEEP_TALK (1 << 4)
#define FORBIDDEN_INSTRUCT (1 << 5)
#define FORBIDDEN_PARENTAL_BOND (1 << 6)
static const u8 sForbiddenMoves[MOVES_COUNT] =
{
@ -945,28 +945,35 @@ static const u8 sForbiddenMoves[MOVES_COUNT] =
[MOVE_STRUGGLE] = 0xFF, // Neither Struggle
[MOVE_AFTER_YOU] = FORBIDDEN_METRONOME,
[MOVE_APPLE_ACID] = FORBIDDEN_METRONOME,
[MOVE_ARM_THRUST] = FORBIDDEN_PARENTAL_BOND,
[MOVE_ASSIST] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_ASTRAL_BARRAGE] = FORBIDDEN_METRONOME,
[MOVE_AURA_WHEEL] = FORBIDDEN_METRONOME,
[MOVE_BADDY_BAD] = FORBIDDEN_METRONOME,
[MOVE_BANEFUL_BUNKER] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_BARRAGE] = FORBIDDEN_PARENTAL_BOND,
[MOVE_BEAK_BLAST] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_BEAT_UP] = FORBIDDEN_PARENTAL_BOND,
[MOVE_BEHEMOTH_BASH] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_BEHEMOTH_BLADE] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_BELCH] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_BESTOW] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_BIDE] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_BIDE] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND, // Note: Bide should work with Parental Bond. This will be addressed in future.
[MOVE_BLAST_BURN] = FORBIDDEN_INSTRUCT,
[MOVE_BODY_PRESS] = FORBIDDEN_METRONOME,
[MOVE_BOUNCE] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_BONE_RUSH] = FORBIDDEN_PARENTAL_BOND,
[MOVE_BONEMERANG] = FORBIDDEN_PARENTAL_BOND,
[MOVE_BOUNCE] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND,
[MOVE_BOUNCY_BUBBLE] = FORBIDDEN_METRONOME,
[MOVE_BRANCH_POKE] = FORBIDDEN_METRONOME,
[MOVE_BREAKING_SWIPE] = FORBIDDEN_METRONOME,
[MOVE_BULLET_SEED] = FORBIDDEN_PARENTAL_BOND,
[MOVE_BUZZY_BUZZ] = FORBIDDEN_METRONOME,
[MOVE_CELEBRATE] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_CHATTER] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_MIMIC | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_CIRCLE_THROW] = FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_CLANGOROUS_SOUL] = FORBIDDEN_METRONOME,
[MOVE_COMET_PUNCH] = FORBIDDEN_PARENTAL_BOND,
[MOVE_COPYCAT] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_COUNTER] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_COVET] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
@ -975,41 +982,57 @@ static const u8 sForbiddenMoves[MOVES_COUNT] =
[MOVE_DESTINY_BOND] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_DETECT] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_DIAMOND_STORM] = FORBIDDEN_METRONOME,
[MOVE_DIG] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_DIVE] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_DOUBLE_IRON_BASH] = FORBIDDEN_METRONOME,
[MOVE_DIG] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND,
[MOVE_DIVE] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND,
[MOVE_DOUBLE_IRON_BASH] = FORBIDDEN_METRONOME | FORBIDDEN_PARENTAL_BOND,
[MOVE_DOUBLE_HIT] = FORBIDDEN_PARENTAL_BOND,
[MOVE_DOUBLE_KICK] = FORBIDDEN_PARENTAL_BOND,
[MOVE_DOUBLE_SLAP] = FORBIDDEN_PARENTAL_BOND,
[MOVE_DRAGON_ASCENT] = FORBIDDEN_METRONOME,
[MOVE_DRAGON_ENERGY] = FORBIDDEN_METRONOME,
[MOVE_DRAGON_DARTS] = FORBIDDEN_PARENTAL_BOND,
[MOVE_DRAGON_TAIL] = FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_DRUM_BEATING] = FORBIDDEN_METRONOME,
[MOVE_DUAL_CHOP] = FORBIDDEN_PARENTAL_BOND,
[MOVE_DUAL_WINGBEAT] = FORBIDDEN_PARENTAL_BOND,
[MOVE_DYNAMAX_CANNON] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_ENDEAVOR] = FORBIDDEN_PARENTAL_BOND,
[MOVE_ENDURE] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_ETERNABEAM] = FORBIDDEN_METRONOME | FORBIDDEN_INSTRUCT,
[MOVE_EXPLOSION] = FORBIDDEN_PARENTAL_BOND,
[MOVE_FALSE_SURRENDER] = FORBIDDEN_METRONOME,
[MOVE_FEINT] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_FIERY_WRATH] = FORBIDDEN_METRONOME,
[MOVE_FINAL_GAMBIT] = FORBIDDEN_PARENTAL_BOND,
[MOVE_FISSURE] = FORBIDDEN_PARENTAL_BOND,
[MOVE_FLEUR_CANNON] = FORBIDDEN_METRONOME,
[MOVE_FLING] = FORBIDDEN_PARENTAL_BOND,
[MOVE_FLOATY_FALL] = FORBIDDEN_METRONOME,
[MOVE_FLY] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_FLY] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND,
[MOVE_FOCUS_PUNCH] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_FOLLOW_ME] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_FREEZE_SHOCK] = FORBIDDEN_METRONOME | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_FREEZE_SHOCK] = FORBIDDEN_METRONOME | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT| FORBIDDEN_PARENTAL_BOND,
[MOVE_FREEZING_GLARE] = FORBIDDEN_METRONOME,
[MOVE_FREEZY_FROST] = FORBIDDEN_METRONOME,
[MOVE_FRENZY_PLANT] = FORBIDDEN_INSTRUCT,
[MOVE_GEOMANCY] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_FURY_ATTACK] = FORBIDDEN_PARENTAL_BOND,
[MOVE_FURY_SWIPES] = FORBIDDEN_PARENTAL_BOND,
[MOVE_GEAR_GRIND] = FORBIDDEN_PARENTAL_BOND,
[MOVE_GEOMANCY] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND,
[MOVE_GIGA_IMPACT] = FORBIDDEN_INSTRUCT,
[MOVE_GLACIAL_LANCE] = FORBIDDEN_METRONOME,
[MOVE_GLITZY_GLOW] = FORBIDDEN_METRONOME,
[MOVE_GRAV_APPLE] = FORBIDDEN_METRONOME,
[MOVE_GUILLOTINE] = FORBIDDEN_PARENTAL_BOND,
[MOVE_HELPING_HAND] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_HOLD_HANDS] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_HORN_DRILL] = FORBIDDEN_PARENTAL_BOND,
[MOVE_HYDRO_CANNON] = FORBIDDEN_INSTRUCT,
[MOVE_HYPER_BEAM] = FORBIDDEN_INSTRUCT,
[MOVE_HYPERSPACE_FURY] = FORBIDDEN_METRONOME,
[MOVE_HYPERSPACE_HOLE] = FORBIDDEN_METRONOME,
[MOVE_ICE_BALL] = FORBIDDEN_INSTRUCT,
[MOVE_ICE_BURN] = FORBIDDEN_METRONOME | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_ICE_BALL] = FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND,
[MOVE_ICE_BURN] = FORBIDDEN_METRONOME | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND,
[MOVE_ICICLE_SPEAR] = FORBIDDEN_PARENTAL_BOND,
[MOVE_INSTRUCT] = FORBIDDEN_METRONOME | FORBIDDEN_INSTRUCT,
[MOVE_JUNGLE_HEALING] = FORBIDDEN_METRONOME,
[MOVE_KINGS_SHIELD] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_INSTRUCT,
@ -1018,12 +1041,13 @@ static const u8 sForbiddenMoves[MOVES_COUNT] =
[MOVE_MAT_BLOCK] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_ME_FIRST] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_METEOR_ASSAULT] = FORBIDDEN_METRONOME | FORBIDDEN_INSTRUCT,
[MOVE_METEOR_BEAM] = FORBIDDEN_INSTRUCT,
[MOVE_METEOR_BEAM] = FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND,
[MOVE_METRONOME] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_MIMIC] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_MIMIC | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_MIND_BLOWN] = FORBIDDEN_METRONOME,
[MOVE_MIRROR_COAT] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_MIRROR_MOVE] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_MISTY_EXPLOSION] = FORBIDDEN_PARENTAL_BOND,
[MOVE_MOONGEIST_BEAM] = FORBIDDEN_METRONOME,
[MOVE_NATURE_POWER] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_NATURES_MADNESS] = FORBIDDEN_METRONOME,
@ -1031,42 +1055,43 @@ static const u8 sForbiddenMoves[MOVES_COUNT] =
[MOVE_ORIGIN_PULSE] = FORBIDDEN_METRONOME,
[MOVE_OUTRAGE] = FORBIDDEN_INSTRUCT,
[MOVE_OVERDRIVE] = FORBIDDEN_METRONOME,
[MOVE_PETAL_DANCE] = FORBIDDEN_INSTRUCT,
[MOVE_PHANTOM_FORCE] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_PHANTOM_FORCE] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND,
[MOVE_PHOTON_GEYSER] = FORBIDDEN_METRONOME,
[MOVE_PIKA_PAPOW] = FORBIDDEN_METRONOME,
[MOVE_PLASMA_FISTS] = FORBIDDEN_METRONOME,
[MOVE_PRECIPICE_BLADES] = FORBIDDEN_METRONOME,
[MOVE_PRISMATIC_LASER] = FORBIDDEN_INSTRUCT,
[MOVE_PROTECT] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_PYRO_BALL] = FORBIDDEN_METRONOME,
[MOVE_QUASH] = FORBIDDEN_METRONOME,
[MOVE_QUICK_GUARD] = FORBIDDEN_METRONOME,
[MOVE_RAGE_POWDER] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_RAZOR_WIND] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_RAZOR_WIND] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND,
[MOVE_RELIC_SONG] = FORBIDDEN_METRONOME,
[MOVE_ROAR] = FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_ROAR_OF_TIME] = FORBIDDEN_INSTRUCT,
[MOVE_ROCK_BLAST] = FORBIDDEN_PARENTAL_BOND,
[MOVE_ROCK_WRECKER] = FORBIDDEN_INSTRUCT,
[MOVE_ROLLOUT] = FORBIDDEN_INSTRUCT,
[MOVE_ROLLOUT] = FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND,
[MOVE_SAPPY_SEED] = FORBIDDEN_METRONOME,
[MOVE_SCALE_SHOT] = FORBIDDEN_PARENTAL_BOND,
[MOVE_SECRET_SWORD] = FORBIDDEN_METRONOME,
[MOVE_SHADOW_FORCE] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_SELF_DESTRUCT] = FORBIDDEN_PARENTAL_BOND,
[MOVE_SHADOW_FORCE] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND,
[MOVE_SHEER_COLD] = FORBIDDEN_PARENTAL_BOND,
[MOVE_SHELL_TRAP] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_SIZZLY_SLIDE] = FORBIDDEN_METRONOME,
[MOVE_SKETCH] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_MIMIC | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_SKULL_BASH] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_SKY_ATTACK] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_SKY_DROP] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_SKULL_BASH] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND,
[MOVE_SKY_ATTACK] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND,
[MOVE_SKY_DROP] = FORBIDDEN_ASSIST | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND,
[MOVE_SLEEP_TALK] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_SNAP_TRAP] = FORBIDDEN_METRONOME,
[MOVE_SNARL] = FORBIDDEN_METRONOME,
[MOVE_SNATCH] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_INSTRUCT,
[MOVE_SNORE] = FORBIDDEN_METRONOME,
[MOVE_SOLAR_BEAM] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_SOLAR_BLADE] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_SOLAR_BEAM] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND,
[MOVE_SOLAR_BLADE] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND,
[MOVE_SPARKLY_SWIRL] = FORBIDDEN_METRONOME,
[MOVE_SPECTRAL_THIEF] = FORBIDDEN_METRONOME,
[MOVE_SPIKE_CANNON] = FORBIDDEN_PARENTAL_BOND,
[MOVE_SPIKY_SHIELD] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_SPIRIT_BREAK] = FORBIDDEN_METRONOME,
[MOVE_SPLISHY_SPLASH] = FORBIDDEN_METRONOME,
@ -1075,8 +1100,9 @@ static const u8 sForbiddenMoves[MOVES_COUNT] =
[MOVE_STEEL_BEAM] = FORBIDDEN_METRONOME,
[MOVE_STRANGE_STEAM] = FORBIDDEN_METRONOME,
[MOVE_SUNSTEEL_STRIKE] = FORBIDDEN_METRONOME,
[MOVE_SURGING_STRIKES] = FORBIDDEN_METRONOME,
[MOVE_SURGING_STRIKES] = FORBIDDEN_METRONOME | FORBIDDEN_PARENTAL_BOND,
[MOVE_SWITCHEROO] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_TAIL_SLAP] = FORBIDDEN_PARENTAL_BOND,
[MOVE_TECHNO_BLAST] = FORBIDDEN_METRONOME,
[MOVE_THIEF] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_THOUSAND_ARROWS] = FORBIDDEN_METRONOME,
@ -1086,15 +1112,36 @@ static const u8 sForbiddenMoves[MOVES_COUNT] =
[MOVE_THUNDEROUS_KICK] = FORBIDDEN_METRONOME,
[MOVE_TRANSFORM] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT | FORBIDDEN_MIMIC | FORBIDDEN_INSTRUCT,
[MOVE_TRICK] = FORBIDDEN_METRONOME | FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_UPROAR] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT,
[MOVE_TRIPLE_AXEL] = FORBIDDEN_PARENTAL_BOND,
[MOVE_TRIPLE_KICK] = FORBIDDEN_PARENTAL_BOND,
[MOVE_TWINEEDLE] = FORBIDDEN_PARENTAL_BOND,
[MOVE_UPROAR] = FORBIDDEN_SLEEP_TALK | FORBIDDEN_INSTRUCT | FORBIDDEN_PARENTAL_BOND,
[MOVE_V_CREATE] = FORBIDDEN_METRONOME,
[MOVE_VEEVEE_VOLLEY] = FORBIDDEN_METRONOME,
[MOVE_WATER_SHURIKEN] = FORBIDDEN_PARENTAL_BOND,
[MOVE_WHIRLWIND] = FORBIDDEN_ASSIST | FORBIDDEN_COPYCAT,
[MOVE_WICKED_BLOW] = FORBIDDEN_METRONOME,
[MOVE_WIDE_GUARD] = FORBIDDEN_METRONOME,
[MOVE_ZIPPY_ZAP] = FORBIDDEN_METRONOME,
};
static const u16 sFinalStrikeOnlyEffects[] =
{
EFFECT_RELIC_SONG,
EFFECT_BUG_BITE,
EFFECT_THIEF,
EFFECT_BURN_UP,
EFFECT_SECRET_POWER,
EFFECT_SMACK_DOWN,
EFFECT_SPARKLING_ARIA,
EFFECT_SMELLINGSALT,
EFFECT_WAKE_UP_SLAP,
EFFECT_HIT_ESCAPE,
EFFECT_RECOIL_HP_25,
EFFECT_HIT_PREVENT_ESCAPE,
EFFECT_HIT_SWITCH_TARGET,
};
static const u16 sNaturePowerMoves[BATTLE_TERRAIN_COUNT] =
{
#if B_NATURE_POWER_MOVES >= GEN_7
@ -1404,6 +1451,18 @@ static void Cmd_attackcanceler(void)
if (AtkCanceller_UnableToUseMove())
return;
if (gSpecialStatuses[gBattlerAttacker].parentalBondState == PARENTAL_BOND_OFF
&& GetBattlerAbility(gBattlerAttacker) == ABILITY_PARENTAL_BOND
&& IsMoveAffectedByParentalBond(gCurrentMove, gBattlerAttacker)
&& !(gAbsentBattlerFlags & gBitTable[gBattlerTarget])
&& gBattleStruct->zmove.toBeUsed[gBattlerAttacker] == MOVE_NONE)
{
gSpecialStatuses[gBattlerAttacker].parentalBondState = PARENTAL_BOND_1ST_HIT;
gMultiHitCounter = 2;
PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 1, 0)
return;
}
// Check Protean activation.
if ((attackerAbility == ABILITY_PROTEAN || attackerAbility == ABILITY_LIBERO)
&& (gBattleMons[gBattlerAttacker].type1 != moveType || gBattleMons[gBattlerAttacker].type2 != moveType ||
@ -1535,6 +1594,13 @@ static void Cmd_attackcanceler(void)
gMoveResultFlags |= MOVE_RESULT_MISSED;
gLastLandedMoves[gBattlerTarget] = 0;
gLastHitByType[gBattlerTarget] = 0;
if (gSpecialStatuses[gBattlerAttacker].parentalBondState == PARENTAL_BOND_1ST_HIT)
{
gSpecialStatuses[gBattlerAttacker].parentalBondState = PARENTAL_BOND_OFF; // No second hit if first hit was blocked
gSpecialStatuses[gBattlerAttacker].multiHitOn = 0;
gMultiHitCounter = 0;
}
gBattleCommunication[MISS_TYPE] = B_MSG_PROTECTED;
gBattlescriptCurrInstr++;
}
@ -1760,7 +1826,7 @@ u32 GetTotalAccuracy(u32 battlerAtk, u32 battlerDef, u32 move, u32 atkAbility, u
#if B_AFFECTION_MECHANICS == TRUE
// With high affection/friendship there's a chance to evade a move by substracting 10% of its accuracy.
// I can't find exact information about that chance, so I'm just gonna write it as a 20% chance for now.
if (GetMonFriendshipScore(&gPlayerParty[gBattlerPartyIndexes[battlerDef]]) >= FRIENDSHIP_150_TO_199 && (Random() % 100) <= 20)
if (GetBattlerFriendshipScore(battlerDef) >= FRIENDSHIP_150_TO_199 && (Random() % 100) <= 20)
calc = (calc * 90) / 100;
#endif
@ -1784,6 +1850,13 @@ static void Cmd_accuracycheck(void)
else if (!JumpIfMoveAffectedByProtect(0))
gBattlescriptCurrInstr += 7;
}
else if (gSpecialStatuses[gBattlerAttacker].parentalBondState == PARENTAL_BOND_2ND_HIT
|| (gSpecialStatuses[gBattlerAttacker].multiHitOn && (gBattleMoves[move].effect != EFFECT_TRIPLE_KICK
|| GetBattlerAbility(gBattlerAttacker) == ABILITY_SKILL_LINK)))
{
// No acc checks for second hit of Parental Bond or multi hit moves, except Triple Kick/Triple Axel
gBattlescriptCurrInstr += 7;
}
else
{
GET_MOVE_TYPE(move, type);
@ -1866,7 +1939,8 @@ static void Cmd_ppreduce(void)
// For item Metronome, echoed voice
if (gCurrentMove == gLastResultingMoves[gBattlerAttacker]
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
&& !WasUnableToUseMove(gBattlerAttacker))
&& !WasUnableToUseMove(gBattlerAttacker)
&& gSpecialStatuses[gBattlerAttacker].parentalBondState != PARENTAL_BOND_1ST_HIT) // Don't increment counter on first hit
gBattleStruct->sameMoveTurns[gBattlerAttacker]++;
else
gBattleStruct->sameMoveTurns[gBattlerAttacker] = 0;
@ -1933,7 +2007,7 @@ s32 CalcCritChanceStage(u8 battlerAtk, u8 battlerDef, u32 move, bool32 recordAbi
+ 2 * (holdEffectAtk == HOLD_EFFECT_LUCKY_PUNCH && gBattleMons[gBattlerAttacker].species == SPECIES_CHANSEY)
+ 2 * BENEFITS_FROM_LEEK(battlerAtk, holdEffectAtk)
#if B_AFFECTION_MECHANICS == TRUE
+ 2 * (GetMonFriendshipScore(&gPlayerParty[gBattlerPartyIndexes[gBattlerAttacker]]) >= FRIENDSHIP_200_TO_254)
+ 2 * (GetBattlerFriendshipScore(gBattlerAttacker) >= FRIENDSHIP_200_TO_254)
#endif
+ (abilityAtk == ABILITY_SUPER_LUCK);
@ -2003,7 +2077,7 @@ static void Cmd_adjustdamage(void)
{
u8 holdEffect, param;
u32 moveType;
u32 friendshipScore = GetMonFriendshipScore(&gPlayerParty[gBattlerPartyIndexes[gBattlerTarget]]);
u32 friendshipScore = GetBattlerFriendshipScore(gBattlerTarget);
u32 rand = Random() % 100;
GET_MOVE_TYPE(gCurrentMove, moveType);
@ -2183,6 +2257,12 @@ static void Cmd_attackanimation(void)
}
else
{
if (gSpecialStatuses[gBattlerAttacker].parentalBondState == PARENTAL_BOND_2ND_HIT) // No animation on second hit
{
gBattlescriptCurrInstr++;
return;
}
if ((moveTarget & MOVE_TARGET_BOTH
|| moveTarget & MOVE_TARGET_FOES_AND_ALLY
|| moveTarget & MOVE_TARGET_DEPENDS)
@ -2470,9 +2550,11 @@ static void Cmd_resultmessage(void)
switch (gMoveResultFlags & ~MOVE_RESULT_MISSED)
{
case MOVE_RESULT_SUPER_EFFECTIVE:
if (!gMultiHitCounter) // Don't print effectiveness on each hit in a multi hit attack
stringId = STRINGID_SUPEREFFECTIVE;
break;
case MOVE_RESULT_NOT_VERY_EFFECTIVE:
if (!gMultiHitCounter)
stringId = STRINGID_NOTVERYEFFECTIVE;
break;
case MOVE_RESULT_ONE_HIT_KO:
@ -2562,7 +2644,6 @@ static void Cmd_resultmessage(void)
if (gSpecialStatuses[gBattlerTarget].berryReduced
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT))
{
gLastUsedItem = gBattleMons[gBattlerTarget].item;
gSpecialStatuses[gBattlerTarget].berryReduced = FALSE;
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_PrintBerryReduceString;
@ -2709,9 +2790,19 @@ void SetMoveEffect(bool32 primary, u32 certain)
u32 flags = 0;
u16 battlerAbility;
if (gSpecialStatuses[gBattlerAttacker].parentalBondState == PARENTAL_BOND_1ST_HIT
&& gBattleMons[gBattlerTarget].hp != 0
&& IsFinalStrikeEffect(gCurrentMove))
{
gBattlescriptCurrInstr++;
return;
}
switch (gBattleScripting.moveEffect) // Set move effects which happen later on
{
case MOVE_EFFECT_KNOCK_OFF:
case MOVE_EFFECT_SMACK_DOWN:
case MOVE_EFFECT_REMOVE_STATUS:
gBattleStruct->moveEffect2 = gBattleScripting.moveEffect;
gBattlescriptCurrInstr++;
return;
@ -3074,15 +3165,21 @@ void SetMoveEffect(bool32 primary, u32 certain)
}
break;
case MOVE_EFFECT_PAYDAY:
if (GET_BATTLER_SIDE(gBattlerAttacker) == B_SIDE_PLAYER)
// Don't scatter coins on the second hit of Parental Bond
if (GET_BATTLER_SIDE(gBattlerAttacker) == B_SIDE_PLAYER && gSpecialStatuses[gBattlerAttacker].parentalBondState!= PARENTAL_BOND_2ND_HIT)
{
u16 payday = gPaydayMoney;
gPaydayMoney += (gBattleMons[gBattlerAttacker].level * 5);
if (payday > gPaydayMoney)
gPaydayMoney = 0xFFFF;
}
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect];
gBattlescriptCurrInstr = BattleScript_MoveEffectPayDay;
}
else
{
gBattlescriptCurrInstr++;
}
break;
case MOVE_EFFECT_HAPPY_HOUR:
if (GET_BATTLER_SIDE(gBattlerAttacker) == B_SIDE_PLAYER && !gBattleStruct->moneyMultiplierMove)
@ -3320,34 +3417,6 @@ void SetMoveEffect(bool32 primary, u32 certain)
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_RapidSpinAway;
break;
case MOVE_EFFECT_REMOVE_STATUS: // Smelling salts
if (!(gBattleMons[gBattlerTarget].status1 & gBattleMoves[gCurrentMove].argument))
{
gBattlescriptCurrInstr++;
}
else
{
gBattleMons[gBattlerTarget].status1 &= ~gBattleMoves[gCurrentMove].argument;
gActiveBattler = gBattlerTarget;
BtlController_EmitSetMonData(BUFFER_A, REQUEST_STATUS_BATTLE, 0, sizeof(gBattleMons[gActiveBattler].status1), &gBattleMons[gActiveBattler].status1);
MarkBattlerForControllerExec(gActiveBattler);
BattleScriptPush(gBattlescriptCurrInstr + 1);
switch (gBattleMoves[gCurrentMove].argument)
{
case STATUS1_PARALYSIS:
gBattlescriptCurrInstr = BattleScript_TargetPRLZHeal;
break;
case STATUS1_SLEEP:
gBattlescriptCurrInstr = BattleScript_TargetWokeUp;
break;
case STATUS1_BURN:
gBattlescriptCurrInstr = BattleScript_TargetBurnHeal;
break;
}
}
break;
case MOVE_EFFECT_ATK_DEF_DOWN: // SuperPower
if (!NoAliveMonsForEitherParty())
{
@ -3362,42 +3431,12 @@ void SetMoveEffect(bool32 primary, u32 certain)
gBattlescriptCurrInstr = BattleScript_DefSpDefDown;
}
break;
case MOVE_EFFECT_RECOIL_25: // Take Down, 25% recoil
gBattleMoveDamage = (gHpDealt) / 4;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect];
break;
case MOVE_EFFECT_RECOIL_33: // Double Edge, 33 % recoil
gBattleMoveDamage = gHpDealt / 3;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect];
break;
case MOVE_EFFECT_RECOIL_50: // Head Smash, 50 % recoil
gBattleMoveDamage = gHpDealt / 2;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_MoveEffectRecoil;
break;
case MOVE_EFFECT_RECOIL_33_STATUS: // Flare Blitz - can burn, Volt Tackle - can paralyze
gBattleScripting.savedDmg = gHpDealt / 3;
if (gBattleScripting.savedDmg == 0)
gBattleScripting.savedDmg = 1;
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_MoveEffectRecoilWithStatus;
break;
case MOVE_EFFECT_RECOIL_HP_25: // Struggle
gBattleMoveDamage = (gBattleMons[gEffectBattler].maxHP) / 4;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
if (GetBattlerAbility(gEffectBattler) == ABILITY_PARENTAL_BOND)
gBattleMoveDamage *= 2;
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_MoveEffectRecoil;
@ -3435,15 +3474,6 @@ void SetMoveEffect(bool32 primary, u32 certain)
gBattlescriptCurrInstr = BattleScript_MoveEffectClearSmog;
}
break;
case MOVE_EFFECT_SMACK_DOWN:
if (!IsBattlerGrounded(gBattlerTarget))
{
gStatuses3[gBattlerTarget] |= STATUS3_SMACKED_DOWN;
gStatuses3[gBattlerTarget] &= ~(STATUS3_MAGNET_RISE | STATUS3_TELEKINESIS | STATUS3_ON_AIR);
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_MoveEffectSmackDown;
}
break;
case MOVE_EFFECT_FLAME_BURST:
if (IsBattlerAlive(BATTLE_PARTNER(gBattlerTarget)) && GetBattlerAbility(BATTLE_PARTNER(gBattlerTarget)) != ABILITY_MAGIC_GUARD)
{
@ -3616,6 +3646,11 @@ void SetMoveEffect(bool32 primary, u32 certain)
gBattlescriptCurrInstr = BattleScript_DefDownSpeedUp;
}
break;
case MOVE_EFFECT_BURN_UP:
// This seems unnecessary but is done to make it work properly with Parental Bond
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_BurnUpRemoveType;
break;
}
}
}
@ -4113,7 +4148,7 @@ static void Cmd_getexp(void)
}
#endif
#if B_AFFECTION_MECHANICS == TRUE
if (GetMonFriendshipScore(&gPlayerParty[gBattleStruct->expGetterMonId]) >= FRIENDSHIP_50_TO_99)
if (GetBattlerFriendshipScore(gBattleStruct->expGetterMonId) >= FRIENDSHIP_50_TO_99)
gBattleMoveDamage = (gBattleMoveDamage * 120) / 100;
#endif
@ -5134,6 +5169,10 @@ static void Cmd_moveend(void)
{
switch (gBattleScripting.moveendState)
{
case MOVEEND_SUM_DAMAGE: // Sum and store damage dealt for multi strike recoil
gBattleScripting.savedDmg += gHpDealt;
gBattleScripting.moveendState++;
break;
case MOVEEND_PROTECT_LIKE_EFFECT:
if (gProtectStructs[gBattlerAttacker].touchedProtectLike)
{
@ -5236,6 +5275,42 @@ static void Cmd_moveend(void)
}
gBattleScripting.moveendState++;
break;
case MOVEEND_RECOIL:
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
&& !(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE)
&& IsBattlerAlive(gBattlerAttacker)
&& gBattleScripting.savedDmg != 0) // Some checks may be redundant alongside this one
{
switch (gBattleMoves[gCurrentMove].effect)
{
case EFFECT_RECOIL_25: // Take Down, 25% recoil
gBattleMoveDamage = max(1, gBattleScripting.savedDmg / 4);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_MoveEffectRecoil;
effect = TRUE;
break;
case EFFECT_RECOIL_33: // Double Edge, 33 % recoil
gBattleMoveDamage = max(1, gBattleScripting.savedDmg / 3);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_MoveEffectRecoil;
effect = TRUE;
break;
case EFFECT_RECOIL_50: // Head Smash, 50 % recoil
gBattleMoveDamage = max(1, gBattleScripting.savedDmg / 2);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_MoveEffectRecoil;
effect = TRUE;
break;
case EFFECT_RECOIL_33_STATUS: // Flare Blitz - can burn, Volt Tackle - can paralyze
gBattleMoveDamage = max(1, gBattleScripting.savedDmg / 3);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_MoveEffectRecoilWithStatus;
effect = TRUE;
break;
}
}
gBattleScripting.moveendState++;
break;
case MOVEEND_SYNCHRONIZE_TARGET: // target synchronize
if (AbilityBattleEffects(ABILITYEFFECT_SYNCHRONIZE, gBattlerTarget, 0, 0, 0))
effect = TRUE;
@ -5303,15 +5378,51 @@ static void Cmd_moveend(void)
gBattleScripting.moveendState++;
break;
case MOVEEND_MOVE_EFFECTS2: // For effects which should happen after target items, for example Knock Off after damage from Rocky Helmet.
{
switch (gBattleStruct->moveEffect2)
{
case MOVE_EFFECT_KNOCK_OFF:
effect = TryKnockOffBattleScript(gBattlerTarget);
break;
case MOVE_EFFECT_SMACK_DOWN:
if (!IsBattlerGrounded(gBattlerTarget) && IsBattlerAlive(gBattlerTarget))
{
gStatuses3[gBattlerTarget] |= STATUS3_SMACKED_DOWN;
gStatuses3[gBattlerTarget] &= ~(STATUS3_MAGNET_RISE | STATUS3_TELEKINESIS | STATUS3_ON_AIR);
effect = TRUE;
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = BattleScript_MoveEffectSmackDown;
}
break;
case MOVE_EFFECT_REMOVE_STATUS: // Smelling salts, Wake-Up Slap, Sparkling Aria
if ((gBattleMons[gBattlerTarget].status1 & gBattleMoves[gCurrentMove].argument) && IsBattlerAlive(gBattlerTarget))
{
gBattleMons[gBattlerTarget].status1 &= ~(gBattleMoves[gCurrentMove].argument);
gActiveBattler = gBattlerTarget;
BtlController_EmitSetMonData(0, REQUEST_STATUS_BATTLE, 0, 4, &gBattleMons[gActiveBattler].status1);
MarkBattlerForControllerExec(gActiveBattler);
effect = TRUE;
BattleScriptPush(gBattlescriptCurrInstr + 1);
switch (gBattleMoves[gCurrentMove].argument)
{
case STATUS1_PARALYSIS:
gBattlescriptCurrInstr = BattleScript_TargetPRLZHeal;
break;
case STATUS1_SLEEP:
gBattlescriptCurrInstr = BattleScript_TargetWokeUp;
break;
case STATUS1_BURN:
gBattlescriptCurrInstr = BattleScript_TargetBurnHeal;
break;
}
}
break; // MOVE_EFFECT_REMOVE_STATUS
}
gBattleStruct->moveEffect2 = 0;
gBattleScripting.moveendState++;
break;
break; // MOVEEND_MOVE_EFFECTS2
}
case MOVEEND_ITEM_EFFECTS_ALL: // item effects for all battlers
if (ItemBattleEffects(ITEMEFFECT_MOVE_END, 0, FALSE))
effect = TRUE;
@ -5559,6 +5670,61 @@ static void Cmd_moveend(void)
gBattleScripting.moveendState++;
break;
}
case MOVEEND_MULTIHIT_MOVE:
{
if (!(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
&& !(gHitMarker & HITMARKER_UNABLE_TO_USE_MOVE)
&& gMultiHitCounter
&& !(gCurrentMove == MOVE_PRESENT && gBattleStruct->presentBasePower == 0)) // Silly edge case
{
gBattleScripting.multihitString[4]++;
if (--gMultiHitCounter == 0)
{
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_MultiHitPrintStrings;
effect = TRUE;
}
else
{
if (gCurrentMove == MOVE_DRAGON_DARTS)
{
// TODO
}
if (gBattleMons[gBattlerAttacker].hp
&& gBattleMons[gBattlerTarget].hp
&& (gChosenMove == MOVE_SLEEP_TALK || !(gBattleMons[gBattlerAttacker].status1 & STATUS1_SLEEP))
&& !(gBattleMons[gBattlerAttacker].status1 & STATUS1_FREEZE))
{
if (gSpecialStatuses[gBattlerAttacker].parentalBondState)
gSpecialStatuses[gBattlerAttacker].parentalBondState--;
gHitMarker |= (HITMARKER_NO_PPDEDUCT | HITMARKER_NO_ATTACKSTRING);
gBattleScripting.animTargetsHit = 0;
gBattleScripting.moveendState = 0;
gSpecialStatuses[gBattlerTarget].sturdied = 0;
gSpecialStatuses[gBattlerTarget].focusBanded = 0; // Delete this line to make Focus Band last for the duration of the whole move turn.
gSpecialStatuses[gBattlerTarget].focusSashed = 0; // Delete this line to make Focus Sash last for the duration of the whole move turn.
gSpecialStatuses[gBattlerAttacker].multiHitOn = TRUE;
MoveValuesCleanUp();
BattleScriptPush(gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect]);
gBattlescriptCurrInstr = BattleScript_FlushMessageBox;
return;
}
else
{
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_MultiHitPrintStrings;
effect = TRUE;
}
}
}
gMultiHitCounter = 0;
gSpecialStatuses[gBattlerAttacker].parentalBondState = PARENTAL_BOND_OFF;
gSpecialStatuses[gBattlerAttacker].multiHitOn = 0;
gBattleScripting.moveendState++;
break;
}
case MOVEEND_EJECT_BUTTON:
if (gCurrentMove != MOVE_DRAGON_TAIL
&& gCurrentMove != MOVE_CIRCLE_THROW
@ -9902,6 +10068,18 @@ static void Cmd_various(void)
else
gBattleCommunication[0] = B_SIDE_OPPONENT;
break;
case VARIOUS_CHECK_PARENTAL_BOND_COUNTER:
{
// Some effects should only happen on the first or second strike of Parental Bond,
// so a way to check this in battle scripts is useful
u8 counter = T1_READ_8(gBattlescriptCurrInstr + 3);
if (gSpecialStatuses[gBattlerAttacker].parentalBondState == counter && gBattleMons[gBattlerTarget].hp != 0)
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 4);
else
gBattlescriptCurrInstr += 8;
return;
}
break;
} // End of switch (gBattlescriptCurrInstr[2])
gBattlescriptCurrInstr += 3;
@ -10376,10 +10554,13 @@ static void Cmd_stockpiletobasedamage(void)
if (gBattleCommunication[MISS_TYPE] != B_MSG_PROTECTED)
gBattleScripting.animTurn = gDisableStructs[gBattlerAttacker].stockpileCounter;
if (!(gSpecialStatuses[gBattlerAttacker].parentalBondState == PARENTAL_BOND_1ST_HIT && gBattleMons[gBattlerTarget].hp != 0))
{
gDisableStructs[gBattlerAttacker].stockpileCounter = 0;
// Restore stat changes from stockpile.
gBattleMons[gBattlerAttacker].statStages[STAT_DEF] -= gDisableStructs[gBattlerAttacker].stockpileDef;
gBattleMons[gBattlerAttacker].statStages[STAT_SPDEF] -= gDisableStructs[gBattlerAttacker].stockpileSpDef;
}
gBattlescriptCurrInstr += 5;
}
}
@ -12270,7 +12451,8 @@ static void Cmd_handlefurycutter(void)
}
else
{
if (gDisableStructs[gBattlerAttacker].furyCutterCounter != 5)
if (gDisableStructs[gBattlerAttacker].furyCutterCounter != 5
&& gSpecialStatuses[gBattlerAttacker].parentalBondState != PARENTAL_BOND_1ST_HIT) // Don't increment counter on first hit
gDisableStructs[gBattlerAttacker].furyCutterCounter++;
gBattlescriptCurrInstr++;
@ -12295,6 +12477,14 @@ static void Cmd_presentdamagecalculation(void)
{
u32 rand = Random() & 0xFF;
/* Don't reroll present effect/power for the second hit of Parental Bond.
* Not sure if this is the correct behaviour, but bulbapedia states
* that if present heals the foe, it doesn't strike twice, and if it deals
* damage, the second strike will always deal damage too. This is a simple way
* to replicate that effect.
*/
if (gSpecialStatuses[gBattlerAttacker].parentalBondState != PARENTAL_BOND_2ND_HIT)
{
if (rand < 102)
{
gBattleStruct->presentBasePower = 40;
@ -12313,9 +12503,11 @@ static void Cmd_presentdamagecalculation(void)
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
gBattleMoveDamage *= -1;
gBattleStruct->presentBasePower = 0;
}
}
if (rand < 204)
if (gBattleStruct->presentBasePower)
{
gBattlescriptCurrInstr = BattleScript_HitFromCritCalc;
}
@ -14647,3 +14839,44 @@ static bool32 CriticalCapture(u32 odds)
return FALSE;
#endif
}
bool8 IsMoveAffectedByParentalBond(u16 move, u8 battlerId)
{
if (gBattleMoves[move].split != SPLIT_STATUS
&& !(sForbiddenMoves[move] & FORBIDDEN_PARENTAL_BOND))
{
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
{
switch (GetBattlerMoveTargetType(battlerId, move))
{
// Both foes are alive, spread move strikes once
case MOVE_TARGET_BOTH:
if (CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) >= 2)
return FALSE;
break;
// Either both foes or one foe and its ally are alive; spread move strikes once
case MOVE_TARGET_FOES_AND_ALLY:
if (CountAliveMonsInBattle(BATTLE_ALIVE_EXCEPT_ATTACKER) >= 2)
return FALSE;
break;
default:
break;
}
}
return TRUE;
}
return FALSE;
}
static bool8 IsFinalStrikeEffect(u16 move)
{
u32 i;
u16 moveEffect = gBattleMoves[move].effect;
for (i = 0; i < ARRAY_COUNT(sFinalStrikeOnlyEffects); i++)
{
if (moveEffect == sFinalStrikeOnlyEffects[i])
return TRUE;
}
return FALSE;
}

View File

@ -130,7 +130,7 @@ static const u16 sPoints_MoveEffect[NUM_BATTLE_MOVE_EFFECTS] =
[EFFECT_DRAGON_RAGE] = 2,
[EFFECT_TRAP] = 4,
// [EFFECT_HIGH_CRITICAL] = 1,
[EFFECT_DOUBLE_HIT] = 1,
// [EFFECT_DOUBLE_HIT] = 1,
[EFFECT_RECOIL_IF_MISS] = 1,
[EFFECT_MIST] = 5,
[EFFECT_FOCUS_ENERGY] = 1,
@ -163,7 +163,7 @@ static const u16 sPoints_MoveEffect[NUM_BATTLE_MOVE_EFFECTS] =
[EFFECT_EVASION_DOWN_HIT] = 1,
// [EFFECT_SKY_ATTACK] = 4,
[EFFECT_CONFUSE_HIT] = 1,
[EFFECT_TWINEEDLE] = 1,
// [EFFECT_TWINEEDLE] = 1,
[EFFECT_VITAL_THROW] = 1,
[EFFECT_SUBSTITUTE] = 4,
[EFFECT_RECHARGE] = 5,

View File

@ -59,6 +59,7 @@ functions instead of at the top of the file with the other declarations.
static bool32 TryRemoveScreens(u8 battler);
static bool32 IsUnnerveAbilityOnOpposingSide(u8 battlerId);
static u8 GetFlingPowerFromItemId(u16 itemId);
static void SetRandomMultiHitCounter();
extern const u8 *const gBattleScriptsForMoveEffects[];
extern const u8 *const gBattlescriptsForRunningByItem[];
@ -218,6 +219,23 @@ static const u16 sEntrainmentTargetSimpleBeamBannedAbilities[] =
ABILITY_GULP_MISSILE,
};
static u8 CalcBeatUpPower(void)
{
struct Pokemon *party;
u8 basePower;
u16 species;
if (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER)
party = gPlayerParty;
else
party = gEnemyParty;
// Party slot is set in the battle script for Beat Up
species = GetMonData(&party[gBattleCommunication[0] - 1], MON_DATA_SPECIES);
basePower = (gBaseStats[species].baseAttack / 10) + 5;
return basePower;
}
bool32 IsAffectedByFollowMe(u32 battlerAtk, u32 defSide, u32 move)
{
u32 ability = GetBattlerAbility(battlerAtk);
@ -252,6 +270,7 @@ void HandleAction_UseMove(void)
gBattleStruct->atkCancellerTracker = 0;
gMoveResultFlags = 0;
gMultiHitCounter = 0;
gBattleScripting.savedDmg = 0;
gBattleCommunication[MISS_TYPE] = 0;
gBattleScripting.savedMoveEffect = 0;
gCurrMovePos = gChosenMovePos = *(gBattleStruct->chosenMovePositions + gBattlerAttacker);
@ -2105,24 +2124,23 @@ void TryToRevertMimicry(void)
}
}
u32 GetMonFriendshipScore(struct Pokemon *pokemon)
u32 GetBattlerFriendshipScore(u8 battlerId)
{
u32 friendshipScore = GetMonData(pokemon, MON_DATA_FRIENDSHIP);
if (friendshipScore == MAX_FRIENDSHIP)
return FRIENDSHIP_MAX;
if (friendshipScore >= 200)
return FRIENDSHIP_200_TO_254;
if (friendshipScore >= 150)
return FRIENDSHIP_150_TO_199;
if (friendshipScore >= 100)
return FRIENDSHIP_100_TO_149;
if (friendshipScore >= 50)
return FRIENDSHIP_50_TO_99;
if (friendshipScore >= 1)
return FRIENDSHIP_1_TO_49;
u8 side = GetBattlerSide(battlerId);
struct Pokemon *party = (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;
u16 species = GetMonData(&party[gBattlerPartyIndexes[battlerId]], MON_DATA_SPECIES);
if (side != B_SIDE_PLAYER)
return FRIENDSHIP_NONE;
else if (gBaseStats[species].flags & SPECIES_FLAG_MEGA_EVOLUTION
|| (gBattleTypeFlags & (BATTLE_TYPE_EREADER_TRAINER
| BATTLE_TYPE_FRONTIER
| BATTLE_TYPE_LINK
| BATTLE_TYPE_RECORDED_LINK
| BATTLE_TYPE_SECRET_BASE)))
return FRIENDSHIP_NONE;
return GetMonFriendshipScore(&party[gBattlerPartyIndexes[battlerId]]);
}
enum
@ -2611,7 +2629,7 @@ u8 DoFieldEndTurnEffects(void)
{
#if B_AFFECTION_MECHANICS == TRUE
if (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER
&& GetMonFriendshipScore(&gPlayerParty[gBattlerPartyIndexes[gBattlerAttacker]]) >= FRIENDSHIP_150_TO_199
&& GetBattlerFriendshipScore(gBattlerAttacker) >= FRIENDSHIP_150_TO_199
&& (Random() % 100 < 20))
{
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
@ -3458,6 +3476,7 @@ enum
CANCELLER_POWDER_MOVE,
CANCELLER_POWDER_STATUS,
CANCELLER_THROAT_CHOP,
CANCELLER_MULTIHIT_MOVES,
CANCELLER_Z_MOVES,
CANCELLER_END,
CANCELLER_PSYCHIC_TERRAIN,
@ -3475,6 +3494,7 @@ u8 AtkCanceller_UnableToUseMove(void)
case CANCELLER_FLAGS: // flags clear
gBattleMons[gBattlerAttacker].status2 &= ~STATUS2_DESTINY_BOND;
gStatuses3[gBattlerAttacker] &= ~STATUS3_GRUDGE;
gBattleScripting.tripleKickPower = 0;
gBattleStruct->atkCancellerTracker++;
break;
case CANCELLER_SKY_DROP:
@ -3832,6 +3852,67 @@ u8 AtkCanceller_UnableToUseMove(void)
}
gBattleStruct->atkCancellerTracker++;
break;
case CANCELLER_MULTIHIT_MOVES:
if (gBattleMoves[gCurrentMove].effect == EFFECT_MULTI_HIT)
{
u16 ability = gBattleMons[gBattlerAttacker].ability;
if (ability == ABILITY_SKILL_LINK)
{
gMultiHitCounter = 5;
}
else if (ability == ABILITY_BATTLE_BOND
&& gCurrentMove == MOVE_WATER_SHURIKEN
&& gBattleMons[gBattlerAttacker].species == SPECIES_GRENINJA_ASH)
{
gMultiHitCounter = 3;
}
else
{
SetRandomMultiHitCounter();
}
PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 1, 0)
}
else if (gBattleMoves[gCurrentMove].flags & FLAG_TWO_STRIKES)
{
gMultiHitCounter = 2;
PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 1, 0)
if (gCurrentMove == MOVE_DRAGON_DARTS)
{
// TODO
}
}
else if (gBattleMoves[gCurrentMove].effect == EFFECT_TRIPLE_KICK || gCurrentMove == MOVE_SURGING_STRIKES)
{
gMultiHitCounter = 3;
PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 1, 0)
}
#if B_BEAT_UP >= GEN_5
else if (gBattleMoves[gCurrentMove].effect == EFFECT_BEAT_UP)
{
struct Pokemon* party;
int i;
if (GetBattlerSide(gBattlerAttacker) == B_SIDE_PLAYER)
party = gPlayerParty;
else
party = gEnemyParty;
for (i = 0; i < PARTY_SIZE; i++)
{
if (GetMonData(&party[i], MON_DATA_HP)
&& GetMonData(&party[i], MON_DATA_SPECIES) != SPECIES_NONE
&& !GetMonData(&party[i], MON_DATA_IS_EGG)
&& !GetMonData(&party[i], MON_DATA_STATUS))
gMultiHitCounter++;
}
gBattleCommunication[0] = 0; // For later
PREPARE_BYTE_NUMBER_BUFFER(gBattleScripting.multihitString, 1, 0)
}
#endif
gBattleStruct->atkCancellerTracker++;
break;
case CANCELLER_END:
break;
}
@ -4922,9 +5003,9 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
gDisableStructs[gBattlerAttacker].truantCounter ^= 1;
break;
case ABILITY_BAD_DREAMS:
if (gBattleMons[battler].status1 & STATUS1_SLEEP
if (gBattleMons[BATTLE_PARTNER(BATTLE_OPPOSITE(battler))].status1 & STATUS1_SLEEP
|| gBattleMons[BATTLE_OPPOSITE(battler)].status1 & STATUS1_SLEEP
|| GetBattlerAbility(battler) == ABILITY_COMATOSE
|| GetBattlerAbility(BATTLE_PARTNER(BATTLE_OPPOSITE(battler))) == ABILITY_COMATOSE
|| GetBattlerAbility(BATTLE_OPPOSITE(battler)) == ABILITY_COMATOSE)
{
BattleScriptPushCursorAndCallback(BattleScript_BadDreamsActivates);
@ -5160,9 +5241,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
&& moveType == TYPE_DARK
&& CompareStat(battler, STAT_ATK, MAX_STAT_STAGE, CMP_LESS_THAN))
{
gEffectBattler = battler;
SET_STATCHANGER(STAT_ATK, 1, FALSE);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseOnMoveEnd;
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseRet;
effect++;
}
break;
@ -5173,9 +5255,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
&& (moveType == TYPE_DARK || moveType == TYPE_BUG || moveType == TYPE_GHOST)
&& CompareStat(battler, STAT_SPEED, MAX_STAT_STAGE, CMP_LESS_THAN))
{
gEffectBattler = battler;
SET_STATCHANGER(STAT_SPEED, 1, FALSE);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseOnMoveEnd;
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseRet;
effect++;
}
break;
@ -5186,9 +5269,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
&& moveType == TYPE_WATER
&& CompareStat(battler, STAT_DEF, MAX_STAT_STAGE, CMP_LESS_THAN))
{
gEffectBattler = battler;
SET_STATCHANGER(STAT_DEF, 2, FALSE);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseOnMoveEnd;
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseRet;
effect++;
}
break;
@ -5198,9 +5282,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
&& IsBattlerAlive(battler)
&& CompareStat(battler, STAT_DEF, MAX_STAT_STAGE, CMP_LESS_THAN))
{
gEffectBattler = battler;
SET_STATCHANGER(STAT_DEF, 1, FALSE);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseOnMoveEnd;
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseRet;
effect++;
}
break;
@ -5215,9 +5300,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
&& !(TestSheerForceFlag(gBattlerAttacker, gCurrentMove))
&& CompareStat(battler, STAT_SPATK, MAX_STAT_STAGE, CMP_LESS_THAN))
{
gEffectBattler = battler;
SET_STATCHANGER(STAT_SPATK, 1, FALSE);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseOnMoveEnd;
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseRet;
effect++;
}
break;
@ -5555,9 +5641,10 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u16 ability, u8 special, u16 move
&& CompareStat(battler, STAT_SPEED, MAX_STAT_STAGE, CMP_LESS_THAN)
&& (moveType == TYPE_FIRE || moveType == TYPE_WATER))
{
gEffectBattler = battler;
SET_STATCHANGER(STAT_SPEED, 6, FALSE);
BattleScriptPushCursor();
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseOnMoveEnd;
gBattlescriptCurrInstr = BattleScript_TargetAbilityStatRaiseRet;
effect++;
}
break;
@ -8232,7 +8319,7 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
basePower = gBattleStruct->presentBasePower;
break;
case EFFECT_TRIPLE_KICK:
basePower += gBattleScripting.tripleKickPower;
basePower *= (4 - gMultiHitCounter);
break;
case EFFECT_SPIT_UP:
basePower = 100 * gDisableStructs[battlerAtk].stockpileCounter;
@ -8405,6 +8492,11 @@ static u16 CalcMoveBasePower(u16 move, u8 battlerAtk, u8 battlerDef)
if (IsBattlerTerrainAffected(gBattlerTarget, STATUS_FIELD_ELECTRIC_TERRAIN))
basePower *= 2;
break;
case EFFECT_BEAT_UP:
#if B_BEAT_UP >= GEN_5
basePower = CalcBeatUpPower();
#endif
break;
}
// Move-specific base power changes
@ -9179,6 +9271,15 @@ static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 move
MulModifier(&finalModifier, UQ_4_12(0.5));
}
// Parental Bond Second Strike
if (gSpecialStatuses[gBattlerAttacker].parentalBondState == PARENTAL_BOND_2ND_HIT)
{
if (B_PARENTAL_BOND_DMG < GEN_7)
MulModifier(&finalModifier, UQ_4_12(0.5));
else
MulModifier(&finalModifier, UQ_4_12(0.25));
}
// attacker's abilities
switch (abilityAtk)
{
@ -9853,7 +9954,7 @@ bool32 SetIllusionMon(struct Pokemon *mon, u32 battlerId)
bool8 ShouldGetStatBadgeBoost(u16 badgeFlag, u8 battlerId)
{
#if B_BADGE_BOOST != GEN_3
#if B_BADGE_BOOST == GEN_3
if (gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_FRONTIER))
return FALSE;
else if (GetBattlerSide(battlerId) != B_SIDE_PLAYER)
@ -9984,7 +10085,7 @@ bool32 CanFling(u8 battlerId)
#endif
|| gFieldStatuses & STATUS_FIELD_MAGIC_ROOM
|| gDisableStructs[battlerId].embargoTimer != 0
|| GetFlingPowerFromItemId(item) != 0
|| GetFlingPowerFromItemId(item) == 0
|| !CanBattlerGetOrLoseItem(battlerId, item))
return FALSE;
@ -10397,3 +10498,31 @@ bool32 CanTargetBattler(u8 battlerAtk, u8 battlerDef, u16 move)
return FALSE; // Pokémon affected by Heal Block cannot target allies with Pollen Puff
return TRUE;
}
static void SetRandomMultiHitCounter()
{
#if (B_MULTI_HIT_CHANCE >= GEN_5)
// Based on Gen 5's odds
// 35% for 2 hits
// 35% for 3 hits
// 15% for 4 hits
// 15% for 5 hits
gMultiHitCounter = Random() % 100;
if (gMultiHitCounter < 35)
gMultiHitCounter = 2;
else if (gMultiHitCounter < 35 + 35)
gMultiHitCounter = 3;
else if (gMultiHitCounter < 35 + 35 + 15)
gMultiHitCounter = 4;
else
gMultiHitCounter = 5;
#else
// 2 and 3 hits: 37.5%
// 4 and 5 hits: 12.5%
gMultiHitCounter = Random() % 4;
if (gMultiHitCounter > 1)
gMultiHitCounter = (Random() % 4) + 2;
else
gMultiHitCounter += 2;
#endif
}

View File

@ -1008,7 +1008,7 @@ static bool8 LoadBerryBlenderGfx(void)
static void DrawBlenderBg(void)
{
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x1E, 0x14);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(0);
ShowBg(0);
ShowBg(1);
@ -1029,7 +1029,7 @@ static void InitBerryBlenderWindows(void)
for (i = 0; i < 5; i++)
FillWindowPixelBuffer(i, PIXEL_FILL(0));
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x1E, 0x14);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
Menu_LoadStdPalAt(0xE0);
}
}

View File

@ -1053,7 +1053,11 @@ void Bike_HandleBumpySlopeJump(void)
bool32 IsRunningDisallowed(u8 metatile)
{
#if OW_RUNNING_INDOORS == GEN_3
if (!gMapHeader.allowRunning || IsRunningDisallowedByMetatile(metatile) == TRUE)
#else
if (IsRunningDisallowedByMetatile(metatile) == TRUE)
#endif
return TRUE;
else
return FALSE;

View File

@ -525,6 +525,9 @@ static const struct SpriteTemplate sSpriteTemplates_NextTurn[CONTESTANT_COUNT] =
}
};
/* v-- Origin
[0 +][1 ] 64x8
*/
static const struct Subsprite sSubsprites_NextTurn[] =
{
{

View File

@ -1150,24 +1150,24 @@ static void TryCreateWirelessSprites(void)
static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId)
{
u16 windowId;
int origWidth;
int tileWidth;
int strWidth;
u8 *spriteTilePtrs[4];
u8 *dst;
struct WindowTemplate windowTemplate;
memset(&windowTemplate, 0, sizeof(windowTemplate));
windowTemplate.width = 30;
windowTemplate.width = DISPLAY_TILE_WIDTH;
windowTemplate.height = 2;
windowId = AddWindow(&windowTemplate);
FillWindowPixelBuffer(windowId, PIXEL_FILL(1));
origWidth = GetStringWidth(FONT_NORMAL, text, 0);
strWidth = (origWidth + 9) / 8;
if (strWidth > 30)
strWidth = 30;
strWidth = GetStringWidth(FONT_NORMAL, text, 0);
tileWidth = (strWidth + 9) / 8;
if (tileWidth > DISPLAY_TILE_WIDTH)
tileWidth = DISPLAY_TILE_WIDTH;
AddTextPrinterParameterized3(windowId, FONT_NORMAL, (strWidth * 8 - origWidth) / 2, 1, sContestLinkTextColors, TEXT_SKIP_DRAW, text);
AddTextPrinterParameterized3(windowId, FONT_NORMAL, (tileWidth * 8 - strWidth) / 2, 1, sContestLinkTextColors, TEXT_SKIP_DRAW, text);
{
s32 i;
struct Sprite *sprite;
@ -1190,7 +1190,7 @@ static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId)
CpuCopy32(src + 128, dst + 0x200, 0x20);
CpuCopy32(src + 64, dst + 0x300, 0x20);
for (i = 0; i < strWidth; i++)
for (i = 0; i < tileWidth; i++)
{
dst = &spriteTilePtrs[(i + 1) / 8][((i + 1) % 8) * 32];
CpuCopy32(src + 192, dst, 0x20);
@ -1208,7 +1208,7 @@ static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId)
}
RemoveWindow(windowId);
return (DISPLAY_WIDTH - (strWidth + 2) * 8) / 2;
return (DISPLAY_WIDTH - (tileWidth + 2) * 8) / 2;
}
static void CreateResultsTextWindowSprites(void)

View File

@ -184,7 +184,7 @@ static const struct WindowTemplate sWindowTemplates[] =
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 9,
.width = 30,
.width = DISPLAY_TILE_WIDTH,
.height = 12,
.paletteNum = 8,
.baseBlock = 1

View File

@ -10,7 +10,7 @@ static const u16 sFrontierExchangeCorner_Decor1[] =
DECOR_CYNDAQUIL_DOLL,
DECOR_CHIKORITA_DOLL,
DECOR_TOTODILE_DOLL,
0xFFFF
ITEM_LIST_END
};
static const u16 sFrontierExchangeCorner_Decor2[] =
@ -20,7 +20,7 @@ static const u16 sFrontierExchangeCorner_Decor2[] =
DECOR_VENUSAUR_DOLL,
DECOR_CHARIZARD_DOLL,
DECOR_BLASTOISE_DOLL,
0xFFFF
ITEM_LIST_END
};
static const u16 sFrontierExchangeCorner_Vitamins[] =
@ -31,7 +31,7 @@ static const u16 sFrontierExchangeCorner_Vitamins[] =
ITEM_ZINC,
ITEM_CARBOS,
ITEM_HP_UP,
0xFFFF
ITEM_LIST_END
};
static const u16 sFrontierExchangeCorner_HoldItems[] =
@ -45,7 +45,7 @@ static const u16 sFrontierExchangeCorner_HoldItems[] =
ITEM_KINGS_ROCK,
ITEM_FOCUS_BAND,
ITEM_SCOPE_LENS,
0xFFFF
ITEM_LIST_END
};
static const u8 *const sFrontierExchangeCorner_Decor1Descriptions[] =

View File

@ -417,7 +417,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
[MOVE_DOUBLE_KICK] =
{
.effect = EFFECT_DOUBLE_HIT,
.effect = EFFECT_HIT,
.power = 30,
.type = TYPE_FIGHTING,
.accuracy = 100,
@ -725,7 +725,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
[MOVE_TWINEEDLE] =
{
.effect = EFFECT_TWINEEDLE,
.effect = EFFECT_POISON_HIT,
.power = 25,
.type = TYPE_BUG,
.accuracy = 100,
@ -2782,7 +2782,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
[MOVE_BONEMERANG] =
{
.effect = EFFECT_DOUBLE_HIT,
.effect = EFFECT_HIT,
.power = 50,
.type = TYPE_GROUND,
.accuracy = 90,
@ -8224,7 +8224,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
[MOVE_DOUBLE_HIT] =
{
.effect = EFFECT_DOUBLE_HIT,
.effect = EFFECT_HIT,
.power = 35,
.type = TYPE_NORMAL,
.accuracy = 90,
@ -9473,7 +9473,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
[MOVE_DUAL_CHOP] =
{
.effect = EFFECT_DOUBLE_HIT,
.effect = EFFECT_HIT,
.power = 40,
.type = TYPE_DRAGON,
.accuracy = 90,
@ -9710,7 +9710,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
[MOVE_GEAR_GRIND] =
{
.effect = EFFECT_DOUBLE_HIT,
.effect = EFFECT_HIT,
.power = 50,
.type = TYPE_STEEL,
.accuracy = 85,
@ -11383,7 +11383,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
.type = TYPE_FIRE,
.accuracy = 100,
.pp = 5,
.secondaryEffectChance = 0,
.secondaryEffectChance = 100,
.target = MOVE_TARGET_SELECTED,
.priority = 0,
.flags = FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_KINGS_ROCK_AFFECTED | FLAG_THAW_USER,
@ -12177,7 +12177,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
#else
.flags = FLAG_MAKES_CONTACT | FLAG_PROTECT_AFFECTED | FLAG_MIRROR_MOVE_AFFECTED | FLAG_DMG_MINIMIZE | FLAG_IRON_FIST_BOOST | FLAG_SHEER_FORCE_BOOST | FLAG_TWO_STRIKES,
#endif
.effect = EFFECT_DOUBLE_IRON_BASH,
.effect = EFFECT_FLINCH_HIT,
.power = 60,
.type = TYPE_STEEL,
.accuracy = 100,
@ -13025,7 +13025,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
[MOVE_DUAL_WINGBEAT] =
{
.effect = EFFECT_DOUBLE_HIT,
.effect = EFFECT_HIT,
.power = 40,
.type = TYPE_FLYING,
.accuracy = 90,
@ -13088,7 +13088,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] =
[MOVE_SURGING_STRIKES] =
{
.effect = EFFECT_TRIPLE_HIT,
.effect = EFFECT_ALWAYS_CRIT,
.power = 25,
.type = TYPE_WATER,
.accuracy = 100,

View File

@ -1,4 +1,4 @@
const u32 *const gItemIconTable[][2] =
const u32 *const gItemIconTable[ITEMS_COUNT + 1][2] =
{
[ITEM_NONE] = {gItemIcon_QuestionMark, gItemIconPalette_QuestionMark},
// Poké Balls
@ -804,5 +804,5 @@ const u32 *const gItemIconTable[][2] =
[ITEM_RUBY] = {gItemIcon_Gem, gItemIconPalette_Ruby},
[ITEM_SAPPHIRE] = {gItemIcon_Gem, gItemIconPalette_Sapphire},
// Return to field arrow
[ITEM_FIELD_ARROW] = {gItemIcon_ReturnToFieldArrow, gItemIconPalette_ReturnToFieldArrow},
[ITEMS_COUNT] = {gItemIcon_ReturnToFieldArrow, gItemIconPalette_ReturnToFieldArrow},
};

View File

@ -1565,7 +1565,7 @@ const struct Item gItems[] =
.description = sLureDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
.fieldUseFunc = ItemUseOutOfBattle_Lure,
.secondaryId = 0,
.flingPower = 30,
},
@ -1579,7 +1579,7 @@ const struct Item gItems[] =
.description = sSuperLureDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
.fieldUseFunc = ItemUseOutOfBattle_Lure,
.secondaryId = 0,
.flingPower = 30,
},
@ -1593,7 +1593,7 @@ const struct Item gItems[] =
.description = sMaxLureDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
.fieldUseFunc = ItemUseOutOfBattle_Lure,
.secondaryId = 0,
.flingPower = 30,
},
@ -2035,8 +2035,8 @@ const struct Item gItems[] =
.price = 300,
.description = sHoneyDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
.type = ITEM_USE_FIELD,
.fieldUseFunc = ItemUseOutOfBattle_Honey,
.flingPower = 30,
},

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2792,16 +2792,6 @@ static void DebugAction_Give_CHEAT(u8 taskId)
ScriptContext_SetupScript(Debug_CheatStart);
}
static void Task_WaitFadeAccessPC(u8 taskId)
{
if (!gPaletteFade.active)
{
DestroyTask(taskId);
FlagSet(DEBUG_FLAG_PC_FROM_DEBUG_MENU);
EnterPokeStorage(2);
}
}
static void DebugAction_AccessPC(u8 taskId)
{
Debug_DestroyMenu_Full(taskId);

View File

@ -4675,7 +4675,7 @@ static void ShowNames(void)
ClearWindowTilemap(sGfx->windowIds[i]);
RemoveWindow(sGfx->windowIds[i]);
}
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(BG_INTERFACE);
sGfx->finished = TRUE;
}
@ -4859,7 +4859,7 @@ static void ShowResults(void)
sGfx->state++;
}
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 5, 30, 15);
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 5, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT - 5);
RemoveWindow(sGfx->windowIds[1]);
sGfx->windowIds[1] = AddWindow(&sWindowTemplate_Prize);
ClearWindowTilemap(sGfx->windowIds[1]);
@ -4917,7 +4917,7 @@ static void ShowResults(void)
ClearWindowTilemap(sGfx->windowIds[1]);
RemoveWindow(sGfx->windowIds[0]);
RemoveWindow(sGfx->windowIds[1]);
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(BG_INTERFACE);
sGfx->finished = TRUE;
break;
@ -5012,7 +5012,7 @@ static void Msg_WantToPlayAgain(void)
ClearWindowTilemap(sGfx->windowIds[WIN_YES_NO]);
RemoveWindow(sGfx->windowIds[WIN_PLAY_AGAIN]);
RemoveWindow(sGfx->windowIds[WIN_YES_NO]);
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(BG_INTERFACE);
sGfx->finished = TRUE;
break;
@ -5044,7 +5044,7 @@ static void Msg_SavingDontTurnOff(void)
sGfx->state++;
break;
default:
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(BG_INTERFACE);
sGfx->finished = TRUE;
break;
@ -5083,7 +5083,7 @@ static void EraseMessage(void)
{
ClearWindowTilemap(sGfx->windowIds[0]);
RemoveWindow(sGfx->windowIds[0]);
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(BG_INTERFACE);
sGfx->finished = TRUE;
}
@ -5121,7 +5121,7 @@ static void Msg_SomeoneDroppedOut(void)
sGfx->playAgainState = PLAY_AGAIN_DROPPED;
ClearWindowTilemap(sGfx->windowIds[0]);
RemoveWindow(sGfx->windowIds[0]);
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(BG_INTERFACE, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(BG_INTERFACE);
sGfx->finished = TRUE;
break;

View File

@ -405,6 +405,11 @@ static const struct SpriteFrameImage sPicTable_HofMonitorSmall[] =
{.data = sHofMonitorSmall_Gfx, .size = 0x200} // the macro breaks down here
};
/*
[0_][] <-1 24x16
[2 ][] <-3
^-- Origin
*/
static const struct Subsprite sSubsprites_PokecenterMonitor[] =
{
{
@ -443,6 +448,11 @@ static const struct Subsprite sSubsprites_PokecenterMonitor[] =
static const struct SubspriteTable sSubspriteTable_PokecenterMonitor = subsprite_table(sSubsprites_PokecenterMonitor);
/*
[0_____][1_____] 24x16
[2 ][3 ]
^-- Origin
*/
static const struct Subsprite sSubsprites_HofMonitorBig[] =
{
{

View File

@ -1136,7 +1136,7 @@ static void Task_OrbEffect(u8 taskId)
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(12, 7));
SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR);
SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ);
SetBgTilemapPalette(0, 0, 0, 0x1E, 0x14, 0xF);
SetBgTilemapPalette(0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT, 0xF);
ScheduleBgCopyTilemapToVram(0);
SetOrbFlashScanlineEffectWindowBoundaries(&gScanlineEffectRegBuffers[0][0], tCenterX, tCenterY, 1);
CpuFastSet(&gScanlineEffectRegBuffers[0], &gScanlineEffectRegBuffers[1], 480);

View File

@ -2925,7 +2925,7 @@ static void FillFrontierExchangeCornerWindowAndItemIcon(u16 menu, u16 selection)
{
case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_1:
AddTextPrinterParameterized2(0, FONT_NORMAL, sFrontierExchangeCorner_Decor1Descriptions[selection], 0, NULL, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_GRAY);
if (sFrontierExchangeCorner_Decor1[selection] == 0xFFFF)
if (sFrontierExchangeCorner_Decor1[selection] == ITEM_LIST_END)
{
ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_Decor1[selection]);
}
@ -2938,7 +2938,7 @@ static void FillFrontierExchangeCornerWindowAndItemIcon(u16 menu, u16 selection)
break;
case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_2:
AddTextPrinterParameterized2(0, FONT_NORMAL, sFrontierExchangeCorner_Decor2Descriptions[selection], 0, NULL, TEXT_COLOR_DARK_GRAY, TEXT_COLOR_WHITE, TEXT_COLOR_LIGHT_GRAY);
if (sFrontierExchangeCorner_Decor2[selection] == 0xFFFF)
if (sFrontierExchangeCorner_Decor2[selection] == ITEM_LIST_END)
{
ShowFrontierExchangeCornerItemIcon(sFrontierExchangeCorner_Decor2[selection]);
}

View File

@ -19,7 +19,6 @@
#include "constants/songs.h"
static void FieldCallback_SweetScent(void);
static void StartSweetScentFieldEffect(void);
static void TrySweetScentEncounter(u8 taskId);
static void FailSweetScentEncounter(u8 taskId);
@ -47,14 +46,15 @@ bool8 FldEff_SweetScent(void)
return FALSE;
}
static void StartSweetScentFieldEffect(void)
void StartSweetScentFieldEffect(void)
{
u8 taskId;
u32 palettes = ~(1 << (gSprites[GetPlayerAvatarSpriteId()].oam.paletteNum + 16) | (1 << 13) | (1 << 14) | (1 << 15));
PlaySE(SE_M_SWEET_SCENT);
CpuFastSet(gPlttBufferUnfaded, gPaletteDecompressionBuffer, 0x100);
CpuFastSet(gPlttBufferFaded, gPlttBufferUnfaded, 0x100);
BeginNormalPaletteFade(~(1 << (gSprites[GetPlayerAvatarSpriteId()].oam.paletteNum + 16)), 4, 0, 8, RGB_RED);
BeginNormalPaletteFade(palettes, 4, 0, 8, RGB_RED);
taskId = CreateTask(TrySweetScentEncounter, 0);
gTasks[taskId].data[0] = 0;
FieldEffectActiveListRemove(FLDEFF_SWEET_SCENT);

View File

@ -760,9 +760,9 @@ static bool32 InitFrontierPass(void)
case 7:
if (FreeTempTileDataBuffersIfPossible())
return FALSE;
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(2, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(2, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(0);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(2);
@ -1396,9 +1396,9 @@ static bool32 InitFrontierMap(void)
SetBgTilemapBuffer(0, sMapData->tilemapBuff0);
SetBgTilemapBuffer(1, sMapData->tilemapBuff1);
SetBgTilemapBuffer(2, sMapData->tilemapBuff2);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(2, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(1, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(2, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(0);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(2);

View File

@ -3322,24 +3322,29 @@ static u8 CreateGameFreakLogoSprites(s16 x, s16 y, s16 unused)
#undef sLetterX
#undef COLOR_CHANGES
#define sScale data[1]
#define sRot data[2]
#define sPos data[3]
#define sTimer data[7]
static void SpriteCB_FlygonSilhouette(struct Sprite *sprite)
{
sprite->data[7]++;
sprite->sTimer++;
if (sprite->sState != 0)
{
s16 sin1;
s16 sin2;
s16 sin;
s16 cos;
s16 a, b, c, d;
sin1 = gSineTable[(u8)sprite->data[2]];
sin2 = gSineTable[(u8)(sprite->data[2] + 64)];
d = Q_8_8_TO_INT(sin2 * sprite->data[1]);
c = Q_8_8_TO_INT(-sin1 * sprite->data[1]);
b = Q_8_8_TO_INT(sin1 * sprite->data[1]);
a = Q_8_8_TO_INT(sin2 * sprite->data[1]);
// Determines rotation of the sprite
sin = gSineTable[(u8)sprite->sRot];
cos = gSineTable[(u8)(sprite->sRot + 64)];
// Converts rotation and scale into the OAM matrix
d = Q_8_8_TO_INT( cos * sprite->sScale);
c = Q_8_8_TO_INT(-sin * sprite->sScale);
b = Q_8_8_TO_INT( sin * sprite->sScale);
a = Q_8_8_TO_INT( cos * sprite->sScale);
SetOamMatrix(1, a, b, c, d);
}
@ -3353,36 +3358,41 @@ static void SpriteCB_FlygonSilhouette(struct Sprite *sprite)
CalcCenterToCornerVec(sprite, SPRITE_SHAPE(64x32), SPRITE_SIZE(64x32), ST_OAM_AFFINE_DOUBLE);
sprite->invisible = FALSE;
sprite->sState = 1;
sprite->data[1] = 0x80;
sprite->data[2] = 0;
sprite->data[3] = 0;
sprite->sScale = 128;
sprite->sRot = 0;
sprite->sPos = 0;
break;
case 1:
sprite->x2 = -Sin((u8)sprite->data[3], 140);
sprite->y2 = -Sin((u8)sprite->data[3], 120);
sprite->data[1] += 7;
sprite->data[3] += 3;
sprite->x2 = -Sin((u8)sprite->sPos, 140);
sprite->y2 = -Sin((u8)sprite->sPos, 120);
sprite->sScale += 7;
sprite->sPos += 3;
if (sprite->x + sprite->x2 <= -16)
{
sprite->oam.priority = 3;
sprite->sState++;
sprite->x = 20;
sprite->y = 40;
sprite->data[1] = 0x200;
sprite->data[2] = 0;
sprite->data[3] = 0x10;
sprite->sScale = 512;
sprite->sRot = 0;
sprite->sPos = 16;
}
break;
case 2:
sprite->x2 = Sin((u8)sprite->data[3], 34);
sprite->y2 = -Cos((u8)sprite->data[3], 60);
sprite->data[1] += 2;
if (sprite->data[7] % 5 == 0)
sprite->data[3]++;
sprite->x2 = Sin((u8)sprite->sPos, 34);
sprite->y2 = -Cos((u8)sprite->sPos, 60);
sprite->sScale += 2;
if (sprite->sTimer % 5 == 0)
sprite->sPos++;
break;
}
}
#undef sScale
#undef sRot
#undef sPos
#undef sTimer
static void SpriteCB_RayquazaOrb(struct Sprite *sprite)
{
u16 foo;

View File

@ -880,11 +880,6 @@ const u8 *ItemId_GetName(u16 itemId)
return gItems[SanitizeItemId(itemId)].name;
}
u16 ItemId_GetId(u16 itemId)
{
return gItems[SanitizeItemId(itemId)].itemId;
}
u16 ItemId_GetPrice(u16 itemId)
{
return gItems[SanitizeItemId(itemId)].price;
@ -910,7 +905,7 @@ u8 ItemId_GetImportance(u16 itemId)
return gItems[SanitizeItemId(itemId)].importance;
}
// unused
// Unused
u8 ItemId_GetRegistrability(u16 itemId)
{
return gItems[SanitizeItemId(itemId)].registrability;

View File

@ -159,8 +159,8 @@ u8 AddCustomItemIconSprite(const struct SpriteTemplate *customSpriteTemplate, u1
const void *GetItemIconPicOrPalette(u16 itemId, u8 which)
{
if (itemId == 0xFFFF)
itemId = ITEM_FIELD_ARROW;
if (itemId == ITEM_LIST_END)
itemId = ITEMS_COUNT; // Use last icon, the "return to field" arrow
else if (itemId >= ITEMS_COUNT)
itemId = 0;

View File

@ -937,7 +937,7 @@ static void BagMenu_MoveCursorCallback(s32 itemIndex, bool8 onInit, struct ListM
if (itemIndex != LIST_CANCEL)
AddBagItemIconSprite(BagGetItemIdByPocketPosition(gBagPosition.pocket + 1, itemIndex), gBagMenu->itemIconSlot);
else
AddBagItemIconSprite(-1, gBagMenu->itemIconSlot);
AddBagItemIconSprite(ITEM_LIST_END, gBagMenu->itemIconSlot);
gBagMenu->itemIconSlot ^= 1;
if (!gBagMenu->inhibitItemDescriptionPrint)
PrintItemDescription(itemIndex);

View File

@ -18,6 +18,7 @@
#include "field_player_avatar.h"
#include "field_screen_effect.h"
#include "field_weather.h"
#include "fldeff.h"
#include "item.h"
#include "item_menu.h"
#include "item_use.h"
@ -67,10 +68,13 @@ static void Task_ShowTMHMContainedMessage(u8);
static void UseTMHMYesNo(u8);
static void UseTMHM(u8);
static void Task_StartUseRepel(u8);
static void Task_StartUseLure(u8 taskId);
static void Task_UseRepel(u8);
static void Task_UseLure(u8 taskId);
static void Task_CloseCantUseKeyItemMessage(u8);
static void SetDistanceOfClosestHiddenItem(u8, s16, s16);
static void CB2_OpenPokeblockFromBag(void);
static void ItemUseOnFieldCB_Honey(u8 taskId);
// EWRAM variables
EWRAM_DATA static void(*sItemUseOnFieldCB)(u8 taskId) = NULL;
@ -846,7 +850,7 @@ static void RemoveUsedItem(void)
void ItemUseOutOfBattle_Repel(u8 taskId)
{
if (VarGet(VAR_REPEL_STEP_COUNT) == 0)
if (REPEL_STEP_COUNT == 0)
gTasks[taskId].func = Task_StartUseRepel;
else if (!InBattlePyramid())
DisplayItemMessage(taskId, FONT_NORMAL, gText_RepelEffectsLingered, CloseItemMessage);
@ -871,6 +875,9 @@ static void Task_UseRepel(u8 taskId)
if (!IsSEPlaying())
{
VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(gSpecialVar_ItemId));
#if VAR_LAST_REPEL_LURE_USED != 0
VarSet(VAR_LAST_REPEL_LURE_USED, gSpecialVar_ItemId);
#endif
RemoveUsedItem();
if (!InBattlePyramid())
DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage);
@ -878,6 +885,57 @@ static void Task_UseRepel(u8 taskId)
DisplayItemMessageInBattlePyramid(taskId, gStringVar4, Task_CloseBattlePyramidBagMessage);
}
}
void HandleUseExpiredRepel(void)
{
#if VAR_LAST_REPEL_LURE_USED != 0
VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(VarGet(VAR_LAST_REPEL_LURE_USED)));
#endif
}
void ItemUseOutOfBattle_Lure(u8 taskId)
{
if (LURE_STEP_COUNT == 0)
gTasks[taskId].func = Task_StartUseLure;
else if (!InBattlePyramid())
DisplayItemMessage(taskId, FONT_NORMAL, gText_LureEffectsLingered, CloseItemMessage);
else
DisplayItemMessageInBattlePyramid(taskId, gText_LureEffectsLingered, Task_CloseBattlePyramidBagMessage);
}
static void Task_StartUseLure(u8 taskId)
{
s16* data = gTasks[taskId].data;
if (++data[8] > 7)
{
data[8] = 0;
PlaySE(SE_REPEL);
gTasks[taskId].func = Task_UseLure;
}
}
static void Task_UseLure(u8 taskId)
{
if (!IsSEPlaying())
{
VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(gSpecialVar_ItemId) | REPEL_LURE_MASK);
#if VAR_LAST_REPEL_LURE_USED != 0
VarSet(VAR_LAST_REPEL_LURE_USED, gSpecialVar_ItemId);
#endif
RemoveUsedItem();
if (!InBattlePyramid())
DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, CloseItemMessage);
else
DisplayItemMessageInBattlePyramid(taskId, gStringVar4, Task_CloseBattlePyramidBagMessage);
}
}
void HandleUseExpiredLure(void)
{
#if VAR_LAST_REPEL_LURE_USED != 0
VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(VarGet(VAR_LAST_REPEL_LURE_USED)) | REPEL_LURE_MASK);
#endif
}
static void Task_UsedBlackWhiteFlute(u8 taskId)
{
@ -1202,6 +1260,29 @@ void ItemUseOutOfBattle_FormChange_ConsumedOnUse(u8 taskId)
SetUpItemUseCallback(taskId);
}
void Task_UseHoneyOnField(u8 taskId)
{
//ResetInitialPlayerAvatarState();
StartSweetScentFieldEffect();
DestroyTask(taskId);
}
static void ItemUseOnFieldCB_Honey(u8 taskId)
{
Overworld_ResetStateAfterDigEscRope();
RemoveUsedItem();
gTasks[taskId].data[0] = 0;
DisplayItemMessageOnField(taskId, gStringVar4, Task_UseHoneyOnField);
}
void ItemUseOutOfBattle_Honey(u8 taskId)
{
sItemUseOnFieldCB = ItemUseOnFieldCB_Honey;
gFieldCallback = FieldCB_UseItemOnField;
gBagMenu->newScreenCallback = CB2_ReturnToField;
Task_FadeAndCloseBagMenu(taskId);
}
void ItemUseOutOfBattle_CannotUse(u8 taskId)
{
DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].tUsingRegisteredKeyItem);

View File

@ -198,7 +198,7 @@ static const struct WindowTemplate sLinkErrorWindowTemplates[] = {
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 0,
.width = 30,
.width = DISPLAY_TILE_WIDTH,
.height = 5,
.paletteNum = 15,
.baseBlock = 0x002
@ -206,7 +206,7 @@ static const struct WindowTemplate sLinkErrorWindowTemplates[] = {
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 6,
.width = 30,
.width = DISPLAY_TILE_WIDTH,
.height = 7,
.paletteNum = 15,
.baseBlock = 0x098
@ -214,7 +214,7 @@ static const struct WindowTemplate sLinkErrorWindowTemplates[] = {
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 13,
.width = 30,
.width = DISPLAY_TILE_WIDTH,
.height = 7,
.paletteNum = 15,
.baseBlock = 0x16A

View File

@ -556,8 +556,8 @@ static bool8 MailReadBuildGraphics(void)
}
break;
case 10:
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(2, 1, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(2, 1, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyToBgTilemapBuffer(1, sMailGraphics[sMailRead->mailType].tileMap, 0, 0);
break;
case 11:

View File

@ -408,9 +408,7 @@ static void IntrDummy(void)
static void WaitForVBlank(void)
{
gMain.intrCheck &= ~INTR_FLAG_VBLANK;
while (!(gMain.intrCheck & INTR_FLAG_VBLANK))
;
VBlankIntrWait();
}
void SetTrainerHillVBlankCounter(u32 *counter)

View File

@ -1121,7 +1121,7 @@ static void Task_DisplayMainMenuInvalidActionError(u8 taskId)
switch (gTasks[taskId].tCurrItem)
{
case 0:
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
switch (gTasks[taskId].tMenuType)
{
case 0:

View File

@ -90,7 +90,7 @@ void CB2_InitMysteryEventMenu(void)
for (i = 0; i < 2; i++)
FillWindowPixelBuffer(i, PIXEL_FILL(0));
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x1E, 0x14);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
LoadUserWindowBorderGfx(0, 1u, 0xD0u);
Menu_LoadStdPalAt(0xE0);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | DISPCNT_OBJ_1D_MAP | DISPCNT_BG0_ON);

View File

@ -102,7 +102,7 @@ static const struct WindowTemplate sMainWindows[] = {
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 0,
.width = 30,
.width = DISPLAY_TILE_WIDTH,
.height = 2,
.paletteNum = 12,
.baseBlock = 0x0013
@ -118,7 +118,7 @@ static const struct WindowTemplate sMainWindows[] = {
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 15,
.width = 30,
.width = DISPLAY_TILE_WIDTH,
.height = 5,
.paletteNum = 13,
.baseBlock = 0x004f
@ -640,8 +640,8 @@ static u32 MysteryGift_HandleThreeOptionMenu(u8 *unused0, u16 * unused1, u8 whic
width++;
windowTemplate.width = width;
if (width < 30)
windowTemplate.tilemapLeft = (30 - width) / 2;
if (width < DISPLAY_TILE_WIDTH)
windowTemplate.tilemapLeft = (DISPLAY_TILE_WIDTH - width) / 2;
else
windowTemplate.tilemapLeft = 0;

View File

@ -226,9 +226,9 @@ s32 WonderCard_Enter(void)
return 0;
break;
case 2:
FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(0);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(2);
@ -244,7 +244,7 @@ s32 WonderCard_Enter(void)
gPaletteFade.bufferTransferDisabled = TRUE;
LoadPalette(sWonderCardData->gfx->pal, 0x10, 0x20);
LZ77UnCompWram(sWonderCardData->gfx->map, sWonderCardData->bgTilemapBuffer);
CopyRectToBgTilemapBufferRect(2, sWonderCardData->bgTilemapBuffer, 0, 0, 30, 20, 0, 0, 30, 20, 1, 0x008, 0);
CopyRectToBgTilemapBufferRect(2, sWonderCardData->bgTilemapBuffer, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT, 1, 0x008, 0);
CopyBgTilemapBufferToVram(2);
break;
case 4:
@ -291,9 +291,9 @@ s32 WonderCard_Exit(bool32 useCancel)
return 0;
break;
case 2:
FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(0);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(2);
@ -595,7 +595,7 @@ static const struct WindowTemplate sNews_WindowTemplates[] = {
.tilemapLeft = 1,
.tilemapTop = 3,
.width = 28,
.height = 20,
.height = DISPLAY_TILE_HEIGHT,
.paletteNum = 2,
.baseBlock = 0x07C
}
@ -688,10 +688,10 @@ s32 WonderNews_Enter(void)
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON);
break;
case 2:
FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(3, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(3, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(0);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(2);
@ -707,8 +707,8 @@ s32 WonderNews_Enter(void)
gPaletteFade.bufferTransferDisabled = TRUE;
LoadPalette(sWonderNewsData->gfx->pal, 0x10, 0x20);
LZ77UnCompWram(sWonderNewsData->gfx->map, sWonderNewsData->bgTilemapBuffer);
CopyRectToBgTilemapBufferRect(1, sWonderNewsData->bgTilemapBuffer, 0, 0, 30, 3, 0, 0, 30, 3, 1, 8, 0);
CopyRectToBgTilemapBufferRect(3, sWonderNewsData->bgTilemapBuffer, 0, 3, 30, 23, 0, 3, 30, 23, 1, 8, 0);
CopyRectToBgTilemapBufferRect(1, sWonderNewsData->bgTilemapBuffer, 0, 0, DISPLAY_TILE_WIDTH, 3, 0, 0, DISPLAY_TILE_WIDTH, 3, 1, 8, 0);
CopyRectToBgTilemapBufferRect(3, sWonderNewsData->bgTilemapBuffer, 0, 3, DISPLAY_TILE_WIDTH, 3 + DISPLAY_TILE_HEIGHT, 0, 3, DISPLAY_TILE_WIDTH, 3 + DISPLAY_TILE_HEIGHT, 1, 8, 0);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(3);
break;
@ -760,10 +760,10 @@ s32 WonderNews_Exit(bool32 useCancel)
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON);
break;
case 2:
FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, 30, 24);
FillBgTilemapBufferRect_Palette0(3, 0x000, 0, 0, 30, 24);
FillBgTilemapBufferRect_Palette0(0, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(1, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
FillBgTilemapBufferRect_Palette0(2, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT + 4);
FillBgTilemapBufferRect_Palette0(3, 0x000, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT + 4);
CopyBgTilemapBufferToVram(0);
CopyBgTilemapBufferToVram(1);
CopyBgTilemapBufferToVram(2);

View File

@ -267,7 +267,7 @@ static const struct WindowTemplate sWindowTemplates[WIN_COUNT + 1] =
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 0,
.width = 30,
.width = DISPLAY_TILE_WIDTH,
.height = 2,
.paletteNum = 11,
.baseBlock = 0x074
@ -2179,6 +2179,12 @@ static const struct OamData sOam_32x16 =
.paletteNum = 0,
};
/*
[0_____][] <-1 40x32
[2_____][] <-3
[4___+_][] <-5/Origin
[6 ][] <-7
*/
static const struct Subsprite sSubsprites_PageSwapFrame[] =
{
{
@ -2247,6 +2253,10 @@ static const struct Subsprite sSubsprites_PageSwapFrame[] =
}
};
/*
[0_][] <-1 24x8
^-- Origin
*/
static const struct Subsprite sSubsprites_PageSwapText[] =
{
{
@ -2267,6 +2277,11 @@ static const struct Subsprite sSubsprites_PageSwapText[] =
}
};
/*
[0_____][] <-1 40x24
[2_____][] <-3
[4___+_][] <-5/Origin
*/
static const struct Subsprite sSubsprites_Button[] =
{
{
@ -2319,6 +2334,11 @@ static const struct Subsprite sSubsprites_Button[] =
}
};
/*
[0_] 16x24
[1+] <--Origin
[2_]
*/
static const struct Subsprite sSubsprites_PCIcon[] =
{
{

View File

@ -2857,7 +2857,7 @@ static bool8 TryMovePartySlot(s16 x, s16 width, u8 *leftMove, u8 *newX, u8 *newW
{
if (x + width < 0)
return FALSE;
if (x > 31)
if (x >= 32)
return FALSE;
if (x < 0)
@ -2870,7 +2870,7 @@ static bool8 TryMovePartySlot(s16 x, s16 width, u8 *leftMove, u8 *newX, u8 *newW
{
*leftMove = 0;
*newX = x;
if (x + width > 31)
if (x + width >= 32)
*newWidth = 32 - x;
else
*newWidth = width;
@ -4928,6 +4928,7 @@ void ItemUseCB_TMHM(u8 taskId, TaskFunc task)
u16 move = ItemIdToBattleMoveId(item);
gPartyMenu.data1 = move;
gPartyMenu.learnMoveState = 0;
PlaySE(SE_SELECT);
mon = &gPlayerParty[gPartyMenu.slotId];

View File

@ -1015,7 +1015,7 @@ static void ItemStorage_MoveCursor(s32 id, bool8 onInit, struct ListMenu *list)
if (id != LIST_CANCEL)
ItemStorage_DrawItemIcon(gSaveBlock1Ptr->pcItems[id].itemId);
else
ItemStorage_DrawItemIcon(MSG_GO_BACK_TO_PREV);
ItemStorage_DrawItemIcon(ITEM_LIST_END);
ItemStorage_PrintDescription(id);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1380,7 +1380,7 @@ static void UpdateSubmenuOneOptionValue(u8 taskId, bool8 increment)
UpdateBattlerValue(data);
ReloadPokemonSprites(data);
while (!(gMain.intrCheck & INTR_FLAG_VBLANK));
VBlankIntrWait();
PlaySE(SE_DEX_SCROLL);
}
break;
@ -1499,7 +1499,7 @@ static void Handle_Input_Debug_Pokemon(u8 taskId)
PrintDigitChars(data);
UpdateBattlerValue(data);
ReloadPokemonSprites(data);
while (!(gMain.intrCheck & INTR_FLAG_VBLANK));
VBlankIntrWait();
PlaySE(SE_DEX_SCROLL);
}
@ -1531,7 +1531,7 @@ static void Handle_Input_Debug_Pokemon(u8 taskId)
ResetOffsetSpriteValues(data);
}
PlaySE(SE_DEX_SCROLL);
while (!(gMain.intrCheck & INTR_FLAG_VBLANK));
VBlankIntrWait();
}
else if (JOY_NEW(DPAD_UP))
{

View File

@ -1669,18 +1669,10 @@ static void FieldTask_ReturnToPcMenu(void)
MainCallback vblankCb = gMain.vblankCallback;
SetVBlankCallback(NULL);
if (!FlagGet(DEBUG_FLAG_PC_FROM_DEBUG_MENU))
{
taskId = CreateTask(Task_PCMainMenu, 80);
gTasks[taskId].tState = 0;
gTasks[taskId].tSelectedOption = sPreviousBoxOption;
Task_PCMainMenu(taskId);
}
else
{
FlagClear(DEBUG_FLAG_PC_FROM_DEBUG_MENU);
ScriptContext_Enable();
}
SetVBlankCallback(vblankCb);
FadeInFromBlack();
}

View File

@ -90,12 +90,10 @@ static u16 GetLengthWithExpandedPlayerName(const u8 *str)
return length;
}
static void DrawMultichoiceMenu(u8 left, u8 top, u8 multichoiceId, bool8 ignoreBPress, u8 cursorPos)
static void DrawMultichoiceMenuInternal(u8 left, u8 top, u8 multichoiceId, bool8 ignoreBPress, u8 cursorPos, const struct MenuAction *actions, int count)
{
int i;
u8 windowId;
u8 count = sMultichoiceLists[multichoiceId].count;
const struct MenuAction *actions = sMultichoiceLists[multichoiceId].list;
int width = 0;
u8 newWidth;
@ -114,6 +112,84 @@ static void DrawMultichoiceMenu(u8 left, u8 top, u8 multichoiceId, bool8 ignoreB
InitMultichoiceCheckWrap(ignoreBPress, count, windowId, multichoiceId);
}
static void DrawMultichoiceMenu(u8 left, u8 top, u8 multichoiceId, bool8 ignoreBPress, u8 cursorPos)
{
DrawMultichoiceMenuInternal(left, top, multichoiceId, ignoreBPress, cursorPos, sMultichoiceLists[multichoiceId].list, sMultichoiceLists[multichoiceId].count);
}
#if I_REPEL_LURE_MENU == TRUE
void TryDrawRepelMenu(void)
{
static const u16 repelItems[] = {ITEM_REPEL, ITEM_SUPER_REPEL, ITEM_MAX_REPEL};
struct MenuAction menuItems[ARRAY_COUNT(repelItems) + 1] = {NULL};
int i, count = 0, menuPos = 0;
for (i = 0; i < ARRAY_COUNT(repelItems); i++)
{
if (CheckBagHasItem(repelItems[i], 1))
{
VarSet(VAR_0x8004 + count, repelItems[i]);
#if VAR_LAST_REPEL_LURE_USED != 0
if (VarGet(VAR_LAST_REPEL_LURE_USED) == repelItems[i])
menuPos = count;
#endif
menuItems[count].text = ItemId_GetName(repelItems[i]);
count++;
}
}
if (count > 1)
DrawMultichoiceMenuInternal(0, 0, 0, FALSE, menuPos, menuItems, count);
gSpecialVar_Result = (count > 1);
}
void HandleRepelMenuChoice(void)
{
gSpecialVar_0x8004 = VarGet(VAR_0x8004 + gSpecialVar_Result); // Get item Id;
VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(gSpecialVar_0x8004));
#if VAR_LAST_REPEL_LURE_USED != 0
VarSet(VAR_LAST_REPEL_LURE_USED, gSpecialVar_0x8004);
#endif
}
void TryDrawLureMenu(void)
{
static const u16 lureItems[] = {ITEM_LURE, ITEM_SUPER_LURE, ITEM_MAX_LURE};
struct MenuAction menuItems[ARRAY_COUNT(lureItems) + 1] = {NULL};
int i, count = 0, menuPos = 0;
for (i = 0; i < ARRAY_COUNT(lureItems); i++)
{
if (CheckBagHasItem(lureItems[i], 1))
{
VarSet(VAR_0x8004 + count, lureItems[i]);
#if VAR_LAST_REPEL_LURE_USED != 0
if (VarGet(VAR_LAST_REPEL_LURE_USED) == lureItems[i])
menuPos = count;
#endif
menuItems[count].text = ItemId_GetName(lureItems[i]);
count++;
}
}
if (count > 1)
DrawMultichoiceMenuInternal(0, 0, 0, FALSE, menuPos, menuItems, count);
gSpecialVar_Result = (count > 1);
}
void HandleLureMenuChoice(void)
{
gSpecialVar_0x8004 = VarGet(VAR_0x8004 + gSpecialVar_Result); // Get item Id;
VarSet(VAR_REPEL_STEP_COUNT, ItemId_GetHoldEffectParam(gSpecialVar_0x8004) | REPEL_LURE_MASK);
#if VAR_LAST_REPEL_LURE_USED != 0
VarSet(VAR_LAST_REPEL_LURE_USED, gSpecialVar_0x8004);
#endif
}
#endif //I_REPEL_LURE_MENU == TRUE
#define tLeft data[0]
#define tTop data[1]
#define tRight data[2]

View File

@ -42,10 +42,72 @@
#define TAG_SCROLL_ARROW 2100
#define TAG_ITEM_ICON_BASE 2110
#define MAX_ITEMS_SHOWN 8
enum {
WIN_BUY_SELL_QUIT,
WIN_BUY_QUIT,
};
enum {
WIN_MONEY,
WIN_ITEM_LIST,
WIN_ITEM_DESCRIPTION,
WIN_QUANTITY_IN_BAG,
WIN_QUANTITY_PRICE,
WIN_MESSAGE,
};
enum {
COLORID_NORMAL, // Item descriptions, quantity in bag, and quantity/price
COLORID_ITEM_LIST, // The text in the item list, and the cursor normally
COLORID_GRAY_CURSOR, // When the cursor has selected an item to purchase
};
enum {
MART_TYPE_NORMAL,
MART_TYPE_DECOR,
MART_TYPE_DECOR2,
};
// shop view window NPC info enum
enum
{
OBJ_EVENT_ID,
X_COORD,
Y_COORD,
ANIM_NUM,
LAYER_TYPE
};
struct MartInfo
{
void (*callback)(void);
const struct MenuAction *menuActions;
const u16 *itemList;
u16 itemCount;
u8 windowId;
u8 martType;
};
struct ShopData
{
u16 tilemapBuffers[4][0x400];
u32 totalCost;
u16 itemsShowed;
u16 selectedRow;
u16 scrollOffset;
u8 maxQuantity;
u8 scrollIndicatorsTaskId;
u8 iconSlot;
u8 itemSpriteIds[2];
s16 viewportObjects[OBJECT_EVENTS_COUNT][5];
};
static EWRAM_DATA struct MartInfo sMartInfo = {0};
static EWRAM_DATA struct ShopData *sShopData = NULL;
static EWRAM_DATA struct ListMenuItem *sListMenuItems = NULL;
static EWRAM_DATA u8 (*sItemNames)[16] = {0};
static EWRAM_DATA u8 (*sItemNames)[ITEM_NAME_LENGTH + 2] = {0};
static EWRAM_DATA u8 sPurchaseHistoryId = 0;
EWRAM_DATA struct ItemSlot gMartPurchaseHistory[SMARTSHOPPER_NUM_ITEMS] = {0};
@ -114,7 +176,7 @@ static const struct MenuAction sShopMenuActions_BuyQuit[] =
static const struct WindowTemplate sShopMenuWindowTemplates[] =
{
{
[WIN_BUY_SELL_QUIT] = {
.bg = 0,
.tilemapLeft = 2,
.tilemapTop = 1,
@ -123,7 +185,8 @@ static const struct WindowTemplate sShopMenuWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 0x0008,
},
{
// Separate shop menu window for decorations, which can't be sold
[WIN_BUY_QUIT] = {
.bg = 0,
.tilemapLeft = 2,
.tilemapTop = 1,
@ -141,7 +204,7 @@ static const struct ListMenuTemplate sShopBuyMenuListTemplate =
.itemPrintFunc = BuyMenuPrintPriceInList,
.totalItems = 0,
.maxShowed = 0,
.windowId = 1,
.windowId = WIN_ITEM_LIST,
.header_X = 0,
.item_X = 8,
.cursor_X = 0,
@ -198,7 +261,7 @@ static const struct BgTemplate sShopBuyMenuBgTemplates[] =
static const struct WindowTemplate sShopBuyMenuWindowTemplates[] =
{
{
[WIN_MONEY] = {
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 1,
@ -207,7 +270,7 @@ static const struct WindowTemplate sShopBuyMenuWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 0x001E,
},
{
[WIN_ITEM_LIST] = {
.bg = 0,
.tilemapLeft = 14,
.tilemapTop = 2,
@ -216,7 +279,7 @@ static const struct WindowTemplate sShopBuyMenuWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 0x0032,
},
{
[WIN_ITEM_DESCRIPTION] = {
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 13,
@ -225,7 +288,7 @@ static const struct WindowTemplate sShopBuyMenuWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 0x0122,
},
{
[WIN_QUANTITY_IN_BAG] = {
.bg = 0,
.tilemapLeft = 1,
.tilemapTop = 11,
@ -234,7 +297,7 @@ static const struct WindowTemplate sShopBuyMenuWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 0x0176,
},
{
[WIN_QUANTITY_PRICE] = {
.bg = 0,
.tilemapLeft = 18,
.tilemapTop = 11,
@ -243,7 +306,7 @@ static const struct WindowTemplate sShopBuyMenuWindowTemplates[] =
.paletteNum = 15,
.baseBlock = 0x018E,
},
{
[WIN_MESSAGE] = {
.bg = 0,
.tilemapLeft = 2,
.tilemapTop = 15,
@ -268,9 +331,9 @@ static const struct WindowTemplate sShopBuyMenuYesNoWindowTemplates =
static const u8 sShopBuyMenuTextColors[][3] =
{
{1, 2, 3},
{0, 2, 3},
{0, 3, 2}
[COLORID_NORMAL] = {1, 2, 3},
[COLORID_ITEM_LIST] = {0, 2, 3},
[COLORID_GRAY_CURSOR] = {0, 3, 2},
};
static u8 CreateShopMenu(u8 martType)
@ -282,8 +345,7 @@ static u8 CreateShopMenu(u8 martType)
if (martType == MART_TYPE_NORMAL)
{
struct WindowTemplate winTemplate;
winTemplate = sShopMenuWindowTemplates[0];
struct WindowTemplate winTemplate = sShopMenuWindowTemplates[WIN_BUY_SELL_QUIT];
winTemplate.width = GetMaxWidthInMenuTable(sShopMenuActions_BuySellQuit, ARRAY_COUNT(sShopMenuActions_BuySellQuit));
sMartInfo.windowId = AddWindow(&winTemplate);
sMartInfo.menuActions = sShopMenuActions_BuySellQuit;
@ -291,8 +353,7 @@ static u8 CreateShopMenu(u8 martType)
}
else
{
struct WindowTemplate winTemplate;
winTemplate = sShopMenuWindowTemplates[1];
struct WindowTemplate winTemplate = sShopMenuWindowTemplates[WIN_BUY_QUIT];
winTemplate.width = GetMaxWidthInMenuTable(sShopMenuActions_BuyQuit, ARRAY_COUNT(sShopMenuActions_BuyQuit));
sMartInfo.windowId = AddWindow(&winTemplate);
sMartInfo.menuActions = sShopMenuActions_BuyQuit;
@ -320,6 +381,7 @@ static void SetShopItemsForSale(const u16 *items)
sMartInfo.itemList = items;
sMartInfo.itemCount = 0;
// Read items until ITEM_NONE / DECOR_NONE is reached
while (sMartInfo.itemList[i])
{
sMartInfo.itemCount++;
@ -344,11 +406,17 @@ static void Task_ShopMenu(u8 taskId)
}
}
#define tItemCount data[1]
#define tItemId data[5]
#define tListTaskId data[7]
#define tCallbackHi data[8]
#define tCallbackLo data[9]
static void Task_HandleShopMenuBuy(u8 taskId)
{
s16 *data = gTasks[taskId].data;
data[8] = (u32)CB2_InitBuyMenu >> 16;
data[9] = (u32)CB2_InitBuyMenu;
tCallbackHi = (u32)CB2_InitBuyMenu >> 16;
tCallbackLo = (u32)CB2_InitBuyMenu;
gTasks[taskId].func = Task_GoToBuyOrSellMenu;
FadeScreen(FADE_TO_BLACK, 0);
}
@ -356,8 +424,8 @@ static void Task_HandleShopMenuBuy(u8 taskId)
static void Task_HandleShopMenuSell(u8 taskId)
{
s16 *data = gTasks[taskId].data;
data[8] = (u32)CB2_GoToSellMenu >> 16;
data[9] = (u32)CB2_GoToSellMenu;
tCallbackHi = (u32)CB2_GoToSellMenu >> 16;
tCallbackLo = (u32)CB2_GoToSellMenu;
gTasks[taskId].func = Task_GoToBuyOrSellMenu;
FadeScreen(FADE_TO_BLACK, 0);
}
@ -386,7 +454,7 @@ static void Task_GoToBuyOrSellMenu(u8 taskId)
if (!gPaletteFade.active)
{
DestroyTask(taskId);
SetMainCallback2((void *)((u16)data[8] << 16 | (u16)data[9]));
SetMainCallback2((void *)((u16)tCallbackHi << 16 | (u16)tCallbackLo));
}
}
@ -429,10 +497,6 @@ static void VBlankCB_BuyMenu(void)
TransferPlttBuffer();
}
#define tItemCount data[1]
#define tItemId data[5]
#define tListTaskId data[7]
static void CB2_InitBuyMenu(void)
{
u8 taskId;
@ -472,8 +536,8 @@ static void CB2_InitBuyMenu(void)
BuyMenuAddScrollIndicatorArrows();
taskId = CreateTask(Task_BuyMenu, 8);
gTasks[taskId].tListTaskId = ListMenuInit(&gMultiuseListMenuTemplate, 0, 0);
BlendPalettes(PALETTES_ALL, 0x10, RGB_BLACK);
BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK);
BlendPalettes(PALETTES_ALL, 16, RGB_BLACK);
BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK);
SetVBlankCallback(VBlankCB_BuyMenu);
SetMainCallback2(CB2_BuyMenu);
break;
@ -504,8 +568,8 @@ static void BuyMenuBuildListMenuTemplate(void)
gMultiuseListMenuTemplate = sShopBuyMenuListTemplate;
gMultiuseListMenuTemplate.items = sListMenuItems;
gMultiuseListMenuTemplate.totalItems = sMartInfo.itemCount + 1;
if (gMultiuseListMenuTemplate.totalItems > 8)
gMultiuseListMenuTemplate.maxShowed = 8;
if (gMultiuseListMenuTemplate.totalItems > MAX_ITEMS_SHOWN)
gMultiuseListMenuTemplate.maxShowed = MAX_ITEMS_SHOWN;
else
gMultiuseListMenuTemplate.maxShowed = gMultiuseListMenuTemplate.totalItems;
@ -532,7 +596,7 @@ static void BuyMenuPrintItemDescriptionAndShowItemIcon(s32 item, bool8 onInit, s
if (item != LIST_CANCEL)
BuyMenuAddItemIcon(item, sShopData->iconSlot);
else
BuyMenuAddItemIcon(-1, sShopData->iconSlot);
BuyMenuAddItemIcon(ITEM_LIST_END, sShopData->iconSlot);
BuyMenuRemoveItemIcon(item, sShopData->iconSlot ^ 1);
sShopData->iconSlot ^= 1;
@ -548,8 +612,8 @@ static void BuyMenuPrintItemDescriptionAndShowItemIcon(s32 item, bool8 onInit, s
description = gText_QuitShopping;
}
FillWindowPixelBuffer(2, PIXEL_FILL(0));
BuyMenuPrint(2, description, 3, 1, 0, 0);
FillWindowPixelBuffer(WIN_ITEM_DESCRIPTION, PIXEL_FILL(0));
BuyMenuPrint(WIN_ITEM_DESCRIPTION, description, 3, 1, 0, COLORID_NORMAL);
}
static void BuyMenuPrintPriceInList(u8 windowId, u32 itemId, u8 y)
@ -576,21 +640,21 @@ static void BuyMenuPrintPriceInList(u8 windowId, u32 itemId, u8 y)
}
StringExpandPlaceholders(gStringVar4, gText_PokedollarVar1);
x = GetStringRightAlignXOffset(FONT_NARROW, gStringVar4, 0x78);
AddTextPrinterParameterized4(windowId, FONT_NARROW, x, y, 0, 0, sShopBuyMenuTextColors[1], TEXT_SKIP_DRAW, gStringVar4);
x = GetStringRightAlignXOffset(FONT_NARROW, gStringVar4, 120);
AddTextPrinterParameterized4(windowId, FONT_NARROW, x, y, 0, 0, sShopBuyMenuTextColors[COLORID_ITEM_LIST], TEXT_SKIP_DRAW, gStringVar4);
}
}
static void BuyMenuAddScrollIndicatorArrows(void)
{
if (sShopData->scrollIndicatorsTaskId == TASK_NONE && sMartInfo.itemCount + 1 > 8)
if (sShopData->scrollIndicatorsTaskId == TASK_NONE && sMartInfo.itemCount + 1 > MAX_ITEMS_SHOWN)
{
sShopData->scrollIndicatorsTaskId = AddScrollIndicatorArrowPairParameterized(
SCROLL_ARROW_UP,
172,
12,
148,
sMartInfo.itemCount - 7,
sMartInfo.itemCount - (MAX_ITEMS_SHOWN - 1),
TAG_SCROLL_ARROW,
TAG_SCROLL_ARROW,
&sShopData->scrollOffset);
@ -609,7 +673,7 @@ static void BuyMenuRemoveScrollIndicatorArrows(void)
static void BuyMenuPrintCursor(u8 scrollIndicatorsTaskId, u8 colorSet)
{
u8 y = ListMenuGetYCoordForPrintingArrowCursor(scrollIndicatorsTaskId);
BuyMenuPrint(1, gText_SelectorArrow2, 0, y, 0, colorSet);
BuyMenuPrint(WIN_ITEM_LIST, gText_SelectorArrow2, 0, y, 0, colorSet);
}
static void BuyMenuAddItemIcon(u16 item, u8 iconSlot)
@ -619,7 +683,7 @@ static void BuyMenuAddItemIcon(u16 item, u8 iconSlot)
if (*spriteIdPtr != SPRITE_NONE)
return;
if (sMartInfo.martType == MART_TYPE_NORMAL || item == 0xFFFF)
if (sMartInfo.martType == MART_TYPE_NORMAL || item == ITEM_LIST_END)
{
spriteId = AddItemIconSprite(iconSlot + TAG_ITEM_ICON_BASE, iconSlot + TAG_ITEM_ICON_BASE, item);
if (spriteId != MAX_SPRITES)
@ -683,11 +747,11 @@ static void BuyMenuInitWindows(void)
{
InitWindows(sShopBuyMenuWindowTemplates);
DeactivateAllTextPrinters();
LoadUserWindowBorderGfx(0, 1, 0xD0);
LoadMessageBoxGfx(0, 0xA, 0xE0);
PutWindowTilemap(0);
PutWindowTilemap(1);
PutWindowTilemap(2);
LoadUserWindowBorderGfx(WIN_MONEY, 1, 0xD0);
LoadMessageBoxGfx(WIN_MONEY, 0xA, 0xE0);
PutWindowTilemap(WIN_MONEY);
PutWindowTilemap(WIN_ITEM_LIST);
PutWindowTilemap(WIN_ITEM_DESCRIPTION);
}
static void BuyMenuPrint(u8 windowId, const u8 *text, u8 x, u8 y, s8 speed, u8 colorSet)
@ -697,7 +761,7 @@ static void BuyMenuPrint(u8 windowId, const u8 *text, u8 x, u8 y, s8 speed, u8 c
static void BuyMenuDisplayMessage(u8 taskId, const u8 *text, TaskFunc callback)
{
DisplayMessageAndContinueTask(taskId, 5, 10, 14, FONT_NORMAL, GetPlayerTextSpeedDelay(), text, callback);
DisplayMessageAndContinueTask(taskId, WIN_MESSAGE, 10, 14, FONT_NORMAL, GetPlayerTextSpeedDelay(), text, callback);
ScheduleBgCopyTilemapToVram(0);
}
@ -706,7 +770,7 @@ static void BuyMenuDrawGraphics(void)
BuyMenuDrawMapGraphics();
BuyMenuCopyMenuBgToBg1TilemapBuffer();
AddMoneyLabelObject(19, 11);
PrintMoneyAmountInMoneyBoxWithBorder(0, 1, 13, GetMoney(&gSaveBlock1Ptr->money));
PrintMoneyAmountInMoneyBoxWithBorder(WIN_MONEY, 1, 13, GetMoney(&gSaveBlock1Ptr->money));
ScheduleBgCopyTilemapToVram(0);
ScheduleBgCopyTilemapToVram(1);
ScheduleBgCopyTilemapToVram(2);
@ -722,10 +786,8 @@ static void BuyMenuDrawMapGraphics(void)
static void BuyMenuDrawMapBg(void)
{
s16 i;
s16 j;
s16 x;
s16 y;
s16 i, j;
s16 x, y;
const struct MapLayout *mapLayout;
u16 metatile;
u8 metatileLayerType;
@ -746,16 +808,12 @@ static void BuyMenuDrawMapBg(void)
metatileLayerType = METATILE_LAYER_TYPE_COVERED;
if (metatile < NUM_METATILES_IN_PRIMARY)
{
BuyMenuDrawMapMetatile(i, j, (u16 *)mapLayout->primaryTileset->metatiles + metatile * 8, metatileLayerType);
}
else
{
BuyMenuDrawMapMetatile(i, j, (u16 *)mapLayout->secondaryTileset->metatiles + ((metatile - NUM_METATILES_IN_PRIMARY) * 8), metatileLayerType);
}
}
}
}
static void BuyMenuDrawMapMetatile(s16 x, s16 y, const u16 *src, u8 metatileLayerType)
{
@ -794,11 +852,13 @@ static void BuyMenuCollectObjectEventData(void)
s16 facingY;
u8 y;
u8 x;
u8 r8 = 0;
u8 numObjects = 0;
GetXYCoordsOneStepInFrontOfPlayer(&facingX, &facingY);
for (y = 0; y < OBJECT_EVENTS_COUNT; y++)
sShopData->viewportObjects[y][OBJ_EVENT_ID] = OBJECT_EVENTS_COUNT;
for (y = 0; y < 5; y++)
{
for (x = 0; x < 7; x++)
@ -807,28 +867,28 @@ static void BuyMenuCollectObjectEventData(void)
if (objEventId != OBJECT_EVENTS_COUNT)
{
sShopData->viewportObjects[r8][OBJ_EVENT_ID] = objEventId;
sShopData->viewportObjects[r8][X_COORD] = x;
sShopData->viewportObjects[r8][Y_COORD] = y;
sShopData->viewportObjects[r8][LAYER_TYPE] = MapGridGetMetatileLayerTypeAt(facingX - 4 + x, facingY - 2 + y);
sShopData->viewportObjects[numObjects][OBJ_EVENT_ID] = objEventId;
sShopData->viewportObjects[numObjects][X_COORD] = x;
sShopData->viewportObjects[numObjects][Y_COORD] = y;
sShopData->viewportObjects[numObjects][LAYER_TYPE] = MapGridGetMetatileLayerTypeAt(facingX - 4 + x, facingY - 2 + y);
switch (gObjectEvents[objEventId].facingDirection)
{
case DIR_SOUTH:
sShopData->viewportObjects[r8][ANIM_NUM] = 0;
sShopData->viewportObjects[numObjects][ANIM_NUM] = ANIM_STD_FACE_SOUTH;
break;
case DIR_NORTH:
sShopData->viewportObjects[r8][ANIM_NUM] = 1;
sShopData->viewportObjects[numObjects][ANIM_NUM] = ANIM_STD_FACE_NORTH;
break;
case DIR_WEST:
sShopData->viewportObjects[r8][ANIM_NUM] = 2;
sShopData->viewportObjects[numObjects][ANIM_NUM] = ANIM_STD_FACE_WEST;
break;
case DIR_EAST:
default:
sShopData->viewportObjects[r8][ANIM_NUM] = 3;
sShopData->viewportObjects[numObjects][ANIM_NUM] = ANIM_STD_FACE_EAST;
break;
}
r8++;
numObjects++;
}
}
}
@ -867,14 +927,10 @@ static void BuyMenuDrawObjectEvents(void)
static bool8 BuyMenuCheckIfObjectEventOverlapsMenuBg(s16 *object)
{
if (!BuyMenuCheckForOverlapWithMenuBg(object[X_COORD], object[Y_COORD] + 2) && object[LAYER_TYPE] != METATILE_LAYER_TYPE_COVERED)
{
return TRUE;
}
else
{
return FALSE;
}
}
static void BuyMenuCopyMenuBgToBg1TilemapBuffer(void)
{
@ -885,11 +941,9 @@ static void BuyMenuCopyMenuBgToBg1TilemapBuffer(void)
for (i = 0; i < 1024; i++)
{
if (src[i] != 0)
{
dest[i] = src[i] + 0xC3E3;
}
}
}
static bool8 BuyMenuCheckForOverlapWithMenuBg(int x, int y)
{
@ -901,9 +955,7 @@ static bool8 BuyMenuCheckForOverlapWithMenuBg(int x, int y)
metatile[offset2 + offset1 + 32] == 0 &&
metatile[offset2 + offset1 + 1] == 0 &&
metatile[offset2 + offset1 + 33] == 0)
{
return TRUE;
}
return FALSE;
}
@ -928,18 +980,14 @@ static void Task_BuyMenu(u8 taskId)
default:
PlaySE(SE_SELECT);
tItemId = itemId;
ClearWindowTilemap(2);
ClearWindowTilemap(WIN_ITEM_DESCRIPTION);
BuyMenuRemoveScrollIndicatorArrows();
BuyMenuPrintCursor(tListTaskId, 2);
BuyMenuPrintCursor(tListTaskId, COLORID_GRAY_CURSOR);
if (sMartInfo.martType == MART_TYPE_NORMAL)
{
sShopData->totalCost = (ItemId_GetPrice(itemId) >> IsPokeNewsActive(POKENEWS_SLATEPORT));
}
else
{
sShopData->totalCost = gDecorations[itemId].price;
}
if (!IsEnoughMoney(&gSaveBlock1Ptr->money, sShopData->totalCost))
{
@ -985,25 +1033,21 @@ static void Task_BuyHowManyDialogueInit(u8 taskId)
u16 quantityInBag = CountTotalItemQuantityInBag(tItemId);
u16 maxQuantity;
DrawStdFrameWithCustomTileAndPalette(3, FALSE, 1, 13);
DrawStdFrameWithCustomTileAndPalette(WIN_QUANTITY_IN_BAG, FALSE, 1, 13);
ConvertIntToDecimalStringN(gStringVar1, quantityInBag, STR_CONV_MODE_RIGHT_ALIGN, MAX_ITEM_DIGITS + 1);
StringExpandPlaceholders(gStringVar4, gText_InBagVar1);
BuyMenuPrint(3, gStringVar4, 0, 1, 0, 0);
BuyMenuPrint(WIN_QUANTITY_IN_BAG, gStringVar4, 0, 1, 0, COLORID_NORMAL);
tItemCount = 1;
DrawStdFrameWithCustomTileAndPalette(4, FALSE, 1, 13);
DrawStdFrameWithCustomTileAndPalette(WIN_QUANTITY_PRICE, FALSE, 1, 13);
BuyMenuPrintItemQuantityAndPrice(taskId);
ScheduleBgCopyTilemapToVram(0);
maxQuantity = GetMoney(&gSaveBlock1Ptr->money) / sShopData->totalCost;
if (maxQuantity > MAX_BAG_ITEM_CAPACITY)
{
sShopData->maxQuantity = MAX_BAG_ITEM_CAPACITY;
}
else
{
sShopData->maxQuantity = maxQuantity;
}
gTasks[taskId].func = Task_BuyHowManyDialogueHandleInput;
}
@ -1022,11 +1066,11 @@ static void Task_BuyHowManyDialogueHandleInput(u8 taskId)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
ClearStdWindowAndFrameToTransparent(4, FALSE);
ClearStdWindowAndFrameToTransparent(3, FALSE);
ClearWindowTilemap(4);
ClearWindowTilemap(3);
PutWindowTilemap(1);
ClearStdWindowAndFrameToTransparent(WIN_QUANTITY_PRICE, FALSE);
ClearStdWindowAndFrameToTransparent(WIN_QUANTITY_IN_BAG, FALSE);
ClearWindowTilemap(WIN_QUANTITY_PRICE);
ClearWindowTilemap(WIN_QUANTITY_IN_BAG);
PutWindowTilemap(WIN_ITEM_LIST);
CopyItemName(tItemId, gStringVar1);
ConvertIntToDecimalStringN(gStringVar2, tItemCount, STR_CONV_MODE_LEFT_ALIGN, BAG_ITEM_CAPACITY_DIGITS);
ConvertIntToDecimalStringN(gStringVar3, sShopData->totalCost, STR_CONV_MODE_LEFT_ALIGN, 6);
@ -1035,10 +1079,10 @@ static void Task_BuyHowManyDialogueHandleInput(u8 taskId)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
ClearStdWindowAndFrameToTransparent(4, FALSE);
ClearStdWindowAndFrameToTransparent(3, FALSE);
ClearWindowTilemap(4);
ClearWindowTilemap(3);
ClearStdWindowAndFrameToTransparent(WIN_QUANTITY_PRICE, FALSE);
ClearStdWindowAndFrameToTransparent(WIN_QUANTITY_IN_BAG, FALSE);
ClearWindowTilemap(WIN_QUANTITY_PRICE);
ClearWindowTilemap(WIN_QUANTITY_IN_BAG);
BuyMenuReturnToItemList(taskId);
}
}
@ -1053,7 +1097,7 @@ static void BuyMenuTryMakePurchase(u8 taskId)
{
s16 *data = gTasks[taskId].data;
PutWindowTilemap(1);
PutWindowTilemap(WIN_ITEM_LIST);
if (sMartInfo.martType == MART_TYPE_NORMAL)
{
@ -1088,17 +1132,13 @@ static void BuyMenuSubtractMoney(u8 taskId)
IncrementGameStat(GAME_STAT_SHOPPED);
RemoveMoney(&gSaveBlock1Ptr->money, sShopData->totalCost);
PlaySE(SE_SHOP);
PrintMoneyAmountInMoneyBox(0, GetMoney(&gSaveBlock1Ptr->money), 0);
PrintMoneyAmountInMoneyBox(WIN_MONEY, GetMoney(&gSaveBlock1Ptr->money), 0);
if (sMartInfo.martType == MART_TYPE_NORMAL)
{
gTasks[taskId].func = Task_ReturnToItemListAfterItemPurchase;
}
else
{
gTasks[taskId].func = Task_ReturnToItemListAfterDecorationPurchase;
}
}
static void Task_ReturnToItemListAfterItemPurchase(u8 taskId)
{
@ -1107,16 +1147,14 @@ static void Task_ReturnToItemListAfterItemPurchase(u8 taskId)
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
PlaySE(SE_SELECT);
if (tItemId == ITEM_POKE_BALL && tItemCount > 9 && AddBagItem(ITEM_PREMIER_BALL, 1) == TRUE)
{
// Purchasing 10+ Poke Balls gets the player a Premier Ball
if (tItemId == ITEM_POKE_BALL && tItemCount >= 10 && AddBagItem(ITEM_PREMIER_BALL, 1) == TRUE)
BuyMenuDisplayMessage(taskId, gText_ThrowInPremierBall, BuyMenuReturnToItemList);
}
else
{
BuyMenuReturnToItemList(taskId);
}
}
}
static void Task_ReturnToItemListAfterDecorationPurchase(u8 taskId)
{
@ -1131,10 +1169,10 @@ static void BuyMenuReturnToItemList(u8 taskId)
{
s16 *data = gTasks[taskId].data;
ClearDialogWindowAndFrameToTransparent(5, FALSE);
BuyMenuPrintCursor(tListTaskId, 1);
PutWindowTilemap(1);
PutWindowTilemap(2);
ClearDialogWindowAndFrameToTransparent(WIN_MESSAGE, FALSE);
BuyMenuPrintCursor(tListTaskId, COLORID_ITEM_LIST);
PutWindowTilemap(WIN_ITEM_LIST);
PutWindowTilemap(WIN_ITEM_DESCRIPTION);
ScheduleBgCopyTilemapToVram(0);
BuyMenuAddScrollIndicatorArrows();
gTasks[taskId].func = Task_BuyMenu;
@ -1144,11 +1182,11 @@ static void BuyMenuPrintItemQuantityAndPrice(u8 taskId)
{
s16 *data = gTasks[taskId].data;
FillWindowPixelBuffer(4, PIXEL_FILL(1));
PrintMoneyAmount(4, 38, 1, sShopData->totalCost, TEXT_SKIP_DRAW);
FillWindowPixelBuffer(WIN_QUANTITY_PRICE, PIXEL_FILL(1));
PrintMoneyAmount(WIN_QUANTITY_PRICE, 38, 1, sShopData->totalCost, TEXT_SKIP_DRAW);
ConvertIntToDecimalStringN(gStringVar1, tItemCount, STR_CONV_MODE_LEADING_ZEROS, BAG_ITEM_CAPACITY_DIGITS);
StringExpandPlaceholders(gStringVar4, gText_xVar1);
BuyMenuPrint(4, gStringVar4, 0, 1, 0, 0);
BuyMenuPrint(WIN_QUANTITY_PRICE, gStringVar4, 0, 1, 0, COLORID_NORMAL);
}
static void ExitBuyMenu(u8 taskId)
@ -1204,6 +1242,8 @@ static void RecordItemPurchase(u8 taskId)
#undef tItemCount
#undef tItemId
#undef tListTaskId
#undef tCallbackHi
#undef tCallbackLo
void CreatePokemartMenu(const u16 *itemsForSale)
{

View File

@ -6433,6 +6433,20 @@ static const struct SpriteTemplate sSpriteTemplate_PikaPowerBolt =
.callback = SpriteCB_PikaPowerBolt
};
/*
[0 ][1 ]
[ ][ ]
[ ][ ]
[ ][ ]
[ ][ ]
[______________][______________] 128x128
[ ]+ <- Origin ]
[ ][ ]
[ ][ ]
[ ][ ]
[ ][ ]
[2 ][3 ]
*/
static const struct Subsprite sSubsprites_ReelBackground[] =
{
{
@ -6474,6 +6488,11 @@ static const struct SubspriteTable sSubspriteTable_ReelBackground[] =
ARRAY_COUNT(sSubsprites_ReelBackground), sSubsprites_ReelBackground
};
/* v-- Origin on 3
[0_____][1_____]
[2_____][3_____] 64x24
[4 ][5 ]
*/
static const struct Subsprite sSubsprites_ReelTimeMachineAntennae[] =
{
{
@ -6531,6 +6550,13 @@ static const struct SubspriteTable sSubspriteTable_ReelTimeMachineAntennae[] =
ARRAY_COUNT(sSubsprites_ReelTimeMachineAntennae), sSubsprites_ReelTimeMachineAntennae
};
/*
[0 ]
[ ]
[ + Origin]
[______________] 64x40
[1 ][2 ]
*/
static const struct Subsprite sSubsprites_ReelTimeMachine[] =
{
{
@ -6564,6 +6590,14 @@ static const struct SubspriteTable sSubspriteTable_ReelTimeMachine[] =
ARRAY_COUNT(sSubsprites_ReelTimeMachine), sSubsprites_ReelTimeMachine
};
/*
[0 ]
[ ]
[ + Origin]
[______________] 64x48
[1 ][2 ]
[3 ][4 ]
*/
static const struct Subsprite sSubsprites_BrokenReelTimeMachine[] =
{
{
@ -6613,6 +6647,10 @@ static const struct SubspriteTable sSubspriteTable_BrokenReelTimeMachine[] =
ARRAY_COUNT(sSubsprites_BrokenReelTimeMachine), sSubsprites_BrokenReelTimeMachine
};
/* v-- Origin on 3
[0_____][1_____]
[2 ][3 ] 64x16
*/
static const struct Subsprite sSubsprites_ReelTimeShadow[] =
{
{
@ -6654,6 +6692,11 @@ static const struct SubspriteTable sSubspriteTable_ReelTimeShadow[] =
ARRAY_COUNT(sSubsprites_ReelTimeShadow), sSubsprites_ReelTimeShadow
};
/*
[0_] 16x24
[1+] <--Origin
[2_]
*/
static const struct Subsprite sSubsprites_ReelTimeNumberGap[] =
{
{
@ -6687,6 +6730,14 @@ static const struct SubspriteTable sSubspriteTable_ReelTimeNumberGap[] =
ARRAY_COUNT(sSubsprites_ReelTimeNumberGap), sSubsprites_ReelTimeNumberGap
};
/*
[0 ]
[ ]
[ + Origin]
[______________] 64x48
[1 ][2 ]
[3 ][4 ]
*/
static const struct Subsprite sSubsprites_DigitalDisplay_Reel[] =
{
{
@ -6736,6 +6787,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_Reel[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_Reel), sSubsprites_DigitalDisplay_Reel
};
/* v-- Origin on 3
[0_____][1_____]
[2 ][3 ] 64x16
*/
static const struct Subsprite sSubsprites_DigitalDisplay_Time[] =
{
{
@ -6777,6 +6832,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_Time[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_Time), sSubsprites_DigitalDisplay_Time
};
/* v-- Origin on 3
[0_____][1_____]
[2 ][3 ] 64x16
*/
static const struct Subsprite sSubsprites_DigitalDisplay_Insert[] =
{
{
@ -6818,6 +6877,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_Insert[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_Insert), sSubsprites_DigitalDisplay_Insert
};
/* v-- Origin on 3
[0_____][1_____]
[2 ][3 ] 64x16
*/
static const struct Subsprite sSubsprites_DigitalDisplay_Unused1[] =
{
{
@ -6859,6 +6922,11 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_Unused1[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_Unused1), sSubsprites_DigitalDisplay_Unused1
};
/* v-- Origin on 3
[0_____][1_____]
[2_____][3_____]
[4 ][5 ] 64x24
*/
static const struct Subsprite sSubsprites_DigitalDisplay_Win[] =
{
{
@ -6950,6 +7018,14 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_Unused2[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_Unused2), sSubsprites_DigitalDisplay_Unused2
};
/*
[0_____][1_]
[2_____][3_]
[4_____][5_]
[6_____][7+] <-- Origin
[8_____][9_]
[10____][11]
*/
static const struct Subsprite sSubsprites_DigitalDisplay_Pokeball[] =
{
{
@ -6962,7 +7038,7 @@ static const struct Subsprite sSubsprites_DigitalDisplay_Pokeball[] =
},
{
.x = 8,
-24,
.y = -24,
.shape = SPRITE_SHAPE(16x8),
.size = SPRITE_SIZE(16x8),
.tileOffset = 4,
@ -7055,6 +7131,11 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_Pokeball[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_Pokeball), sSubsprites_DigitalDisplay_Pokeball
};
/*
[0 ] 32x24
[ + ] <- Origin
[1 ][2 ]
*/
static const struct Subsprite sSubsprites_DigitalDisplay_DPad[] =
{
{
@ -7088,6 +7169,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_DPad[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_DPad), sSubsprites_DigitalDisplay_DPad
};
/*
[0 ] 16x16
[1+] <- Origin
*/
static const struct Subsprite sSubsprites_DigitalDisplay_StopS[] =
{
{
@ -7113,6 +7198,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_StopS[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_StopS), sSubsprites_DigitalDisplay_StopS
};
/*
[0 ] 16x16
[1+] <- Origin
*/
static const struct Subsprite sSubsprites_DigitalDisplay_StopT[] =
{
{
@ -7138,6 +7227,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_StopT[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_StopT), sSubsprites_DigitalDisplay_StopT
};
/*
[0 ] 16x16
[1+] <- Origin
*/
static const struct Subsprite sSubsprites_DigitalDisplay_StopO[] =
{
{
@ -7163,6 +7256,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_StopO[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_StopO), sSubsprites_DigitalDisplay_StopO
};
/*
[0 ] 16x16
[1+] <- Origin
*/
static const struct Subsprite sSubsprites_DigitalDisplay_StopP[] =
{
{
@ -7188,6 +7285,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_StopP[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_StopP), sSubsprites_DigitalDisplay_StopP
};
/*
[0 ] 16x16
[1+] <- Origin
*/
static const struct Subsprite sSubsprites_DigitalDisplay_BonusB[] =
{
{
@ -7213,6 +7314,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_BonusB[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_BonusB), sSubsprites_DigitalDisplay_BonusB
};
/*
[]<-0 16x16
[]<-1 <- Origin
*/
static const struct Subsprite sSubsprites_DigitalDisplay_BonusO[] =
{
{
@ -7238,6 +7343,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_BonusO[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_BonusO), sSubsprites_DigitalDisplay_BonusO
};
/*
[0 ] 16x16
[1+] <- Origin
*/
static const struct Subsprite sSubsprites_DigitalDisplay_BonusN[] =
{
{
@ -7263,6 +7372,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_BonusN[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_BonusN), sSubsprites_DigitalDisplay_BonusN
};
/*
[]<-0 16x16
[]<-1 <- Origin
*/
static const struct Subsprite sSubsprites_DigitalDisplay_BonusU[] =
{
{
@ -7288,6 +7401,10 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_BonusU[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_BonusU), sSubsprites_DigitalDisplay_BonusU
};
/*
[0 ] 16x16
[1+] <- Origin
*/
static const struct Subsprite sSubsprites_DigitalDisplay_BonusS[] =
{
{
@ -7313,6 +7430,12 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_BonusS[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_BonusS), sSubsprites_DigitalDisplay_BonusS
};
/*
[0_][] <-1
[2_][] <-3
[4_][] <-5
^-- Origin on 3
*/
static const struct Subsprite sSubsprites_DigitalDisplay_BigB[] =
{
{
@ -7370,6 +7493,11 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_BigB[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_BigB), sSubsprites_DigitalDisplay_BigB
};
/*
[0_] 16x24
[1+] <--Origin
[2_]
*/
static const struct Subsprite sSubsprites_DigitalDisplay_BigI[] =
{
{
@ -7403,6 +7531,12 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_BigI[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_BigI), sSubsprites_DigitalDisplay_BigI
};
/*
[0_][] <-1
[2_][] <-3
[4_][] <-5
^-- Origin on 3
*/
static const struct Subsprite sSubsprites_DigitalDisplay_BigG[] =
{
{
@ -7460,6 +7594,12 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_BigG[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_BigG), sSubsprites_DigitalDisplay_BigG
};
/*
[0_][] <-1
[2_][] <-3
[4_][] <-5
^-- Origin on 3
*/
static const struct Subsprite sSubsprites_DigitalDisplay_RegR[] =
{
{
@ -7517,6 +7657,11 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_RegR[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_RegR), sSubsprites_DigitalDisplay_RegR
};
/*
[0_] 16x24
[1+] <--Origin
[2_]
*/
static const struct Subsprite sSubsprites_DigitalDisplay_RegE[] =
{
{
@ -7550,6 +7695,12 @@ static const struct SubspriteTable sSubspriteTable_DigitalDisplay_RegE[] =
ARRAY_COUNT(sSubsprites_DigitalDisplay_RegE), sSubsprites_DigitalDisplay_RegE
};
/*
[0_][] <-1
[2_][] <-3
[4_][] <-5
^-- Origin on 3
*/
static const struct Subsprite sSubsprites_DigitalDisplay_RegG[] =
{
{

View File

@ -244,6 +244,7 @@ const u8 gText_BootedUpHM[] = _("Booted up an HM.");
const u8 gText_TMHMContainedVar1[] = _("It contained\n{STR_VAR_1}.\pTeach {STR_VAR_1}\nto a POKéMON?");
const u8 gText_PlayerUsedVar2[] = _("{PLAYER} used the\n{STR_VAR_2}.{PAUSE_UNTIL_PRESS}");
const u8 gText_RepelEffectsLingered[] = _("But the effects of a REPEL\nlingered from earlier.{PAUSE_UNTIL_PRESS}");
const u8 gText_LureEffectsLingered[] = _("But the effects of a Lure\nlingered from earlier.{PAUSE_UNTIL_PRESS}");
const u8 gText_UsedVar2WildLured[] = _("{PLAYER} used the\n{STR_VAR_2}.\pWild POKéMON will be lured.{PAUSE_UNTIL_PRESS}");
const u8 gText_UsedVar2WildRepelled[] = _("{PLAYER} used the\n{STR_VAR_2}.\pWild POKéMON will be repelled.{PAUSE_UNTIL_PRESS}");
const u8 gText_BoxFull[] = _("The BOX is full.{PAUSE_UNTIL_PRESS}");

View File

@ -351,7 +351,7 @@ static void InitTradeMenu(void)
FillWindowPixelBuffer(i, PIXEL_FILL(0));
}
FillBgTilemapBufferRect(0, 0, 0, 0, 30, 20, 15);
FillBgTilemapBufferRect(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT, 15);
LoadUserWindowBorderGfx_(0, 20, 0xC0);
LoadUserWindowBorderGfx(2, 1, 0xE0);
LoadMonIconPalettes();
@ -2064,13 +2064,13 @@ static void RedrawTradeMenuParty(u8 whichParty)
static void Task_DrawSelectionSummary(u8 taskId)
{
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(0);
}
static void Task_DrawSelectionTrade(u8 taskId)
{
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 30, 20);
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT);
CopyBgTilemapBufferToVram(0);
}

View File

@ -3680,8 +3680,8 @@ static s32 ListMenuHandler_AllItemsAvailable(u8 *state, u8 *windowId, u8 *listMe
if (winTemplateCopy.width > maxWidth)
winTemplateCopy.width = maxWidth;
if (winTemplateCopy.tilemapLeft + winTemplateCopy.width > 29)
winTemplateCopy.tilemapLeft = max(29 - winTemplateCopy.width, 0);
if (winTemplateCopy.tilemapLeft + winTemplateCopy.width >= DISPLAY_TILE_WIDTH)
winTemplateCopy.tilemapLeft = max(DISPLAY_TILE_WIDTH - 1 - winTemplateCopy.width, 0);
*windowId = AddWindow(&winTemplateCopy);
DrawStdWindowFrame(*windowId, FALSE);

View File

@ -129,7 +129,7 @@ void CB2_UnionRoomBattle(void)
ClearWindowTilemap(0);
FillWindowPixelBuffer(0, PIXEL_FILL(0));
FillWindowPixelBuffer(0, PIXEL_FILL(1));
FillBgTilemapBufferRect(0, 0, 0, 0, 30, 20, 0xF);
FillBgTilemapBufferRect(0, 0, 0, 0, DISPLAY_TILE_WIDTH, DISPLAY_TILE_HEIGHT, 0xF);
LoadUserWindowBorderGfx(0, 1, 0xD0);
LoadUserWindowBorderGfx_(0, 1, 0xD0);
Menu_LoadStdPal();

View File

@ -20,11 +20,13 @@
#include "constants/abilities.h"
#include "constants/battle_config.h"
#include "constants/game_stat.h"
#include "constants/item.h"
#include "constants/items.h"
#include "constants/layouts.h"
#include "constants/weather.h"
extern const u8 EventScript_RepelWoreOff[];
extern const u8 EventScript_LureWoreOff[];
#define MAX_ENCOUNTER_RATE 2880
@ -54,6 +56,7 @@ static void FeebasSeedRng(u16 seed);
static bool8 IsWildLevelAllowedByRepel(u8 level);
static void ApplyFluteEncounterRateMod(u32 *encRate);
static void ApplyCleanseTagEncounterRateMod(u32 *encRate);
static u8 GetMaxLevelOfSpeciesInWildTable(const struct WildPokemon *wildMon, u16 species, u8 area);
static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildMon, u8 type, u16 ability, u8 *monIndex);
static bool8 IsAbilityAllowingEncounter(u8 level);
@ -181,58 +184,82 @@ static void FeebasSeedRng(u16 seed)
// LAND_WILD_COUNT
static u8 ChooseWildMonIndex_Land(void)
{
u8 wildMonIndex = 0;
bool8 swap = FALSE;
u8 rand = Random() % ENCOUNTER_CHANCE_LAND_MONS_TOTAL;
if (rand < ENCOUNTER_CHANCE_LAND_MONS_SLOT_0)
return 0;
wildMonIndex = 0;
else if (rand >= ENCOUNTER_CHANCE_LAND_MONS_SLOT_0 && rand < ENCOUNTER_CHANCE_LAND_MONS_SLOT_1)
return 1;
wildMonIndex = 1;
else if (rand >= ENCOUNTER_CHANCE_LAND_MONS_SLOT_1 && rand < ENCOUNTER_CHANCE_LAND_MONS_SLOT_2)
return 2;
wildMonIndex = 2;
else if (rand >= ENCOUNTER_CHANCE_LAND_MONS_SLOT_2 && rand < ENCOUNTER_CHANCE_LAND_MONS_SLOT_3)
return 3;
wildMonIndex = 3;
else if (rand >= ENCOUNTER_CHANCE_LAND_MONS_SLOT_3 && rand < ENCOUNTER_CHANCE_LAND_MONS_SLOT_4)
return 4;
wildMonIndex = 4;
else if (rand >= ENCOUNTER_CHANCE_LAND_MONS_SLOT_4 && rand < ENCOUNTER_CHANCE_LAND_MONS_SLOT_5)
return 5;
wildMonIndex = 5;
else if (rand >= ENCOUNTER_CHANCE_LAND_MONS_SLOT_5 && rand < ENCOUNTER_CHANCE_LAND_MONS_SLOT_6)
return 6;
wildMonIndex = 6;
else if (rand >= ENCOUNTER_CHANCE_LAND_MONS_SLOT_6 && rand < ENCOUNTER_CHANCE_LAND_MONS_SLOT_7)
return 7;
wildMonIndex = 7;
else if (rand >= ENCOUNTER_CHANCE_LAND_MONS_SLOT_7 && rand < ENCOUNTER_CHANCE_LAND_MONS_SLOT_8)
return 8;
wildMonIndex = 8;
else if (rand >= ENCOUNTER_CHANCE_LAND_MONS_SLOT_8 && rand < ENCOUNTER_CHANCE_LAND_MONS_SLOT_9)
return 9;
wildMonIndex = 9;
else if (rand >= ENCOUNTER_CHANCE_LAND_MONS_SLOT_9 && rand < ENCOUNTER_CHANCE_LAND_MONS_SLOT_10)
return 10;
wildMonIndex = 10;
else
return 11;
wildMonIndex = 11;
if (LURE_STEP_COUNT != 0 && (Random() % 10 < 2))
swap = TRUE;
if (swap)
wildMonIndex = 11 - wildMonIndex;
return wildMonIndex;
}
// ROCK_WILD_COUNT / WATER_WILD_COUNT
static u8 ChooseWildMonIndex_WaterRock(void)
{
u8 wildMonIndex = 0;
bool8 swap = FALSE;
u8 rand = Random() % ENCOUNTER_CHANCE_WATER_MONS_TOTAL;
if (rand < ENCOUNTER_CHANCE_WATER_MONS_SLOT_0)
return 0;
wildMonIndex = 0;
else if (rand >= ENCOUNTER_CHANCE_WATER_MONS_SLOT_0 && rand < ENCOUNTER_CHANCE_WATER_MONS_SLOT_1)
return 1;
wildMonIndex = 1;
else if (rand >= ENCOUNTER_CHANCE_WATER_MONS_SLOT_1 && rand < ENCOUNTER_CHANCE_WATER_MONS_SLOT_2)
return 2;
wildMonIndex = 2;
else if (rand >= ENCOUNTER_CHANCE_WATER_MONS_SLOT_2 && rand < ENCOUNTER_CHANCE_WATER_MONS_SLOT_3)
return 3;
wildMonIndex = 3;
else
return 4;
wildMonIndex = 4;
if (LURE_STEP_COUNT != 0 && (Random() % 10 < 2))
swap = TRUE;
if (swap)
wildMonIndex = 4 - wildMonIndex;
return wildMonIndex;
}
// FISH_WILD_COUNT
static u8 ChooseWildMonIndex_Fishing(u8 rod)
{
u8 wildMonIndex = 0;
bool8 swap = FALSE;
u8 rand = Random() % max(max(ENCOUNTER_CHANCE_FISHING_MONS_OLD_ROD_TOTAL, ENCOUNTER_CHANCE_FISHING_MONS_GOOD_ROD_TOTAL),
ENCOUNTER_CHANCE_FISHING_MONS_SUPER_ROD_TOTAL);
if (LURE_STEP_COUNT != 0 && (Random() % 10 < 2))
swap = TRUE;
switch (rod)
{
case OLD_ROD:
@ -240,6 +267,9 @@ static u8 ChooseWildMonIndex_Fishing(u8 rod)
wildMonIndex = 0;
else
wildMonIndex = 1;
if (swap)
wildMonIndex = 1 - wildMonIndex;
break;
case GOOD_ROD:
if (rand < ENCOUNTER_CHANCE_FISHING_MONS_GOOD_ROD_SLOT_2)
@ -248,6 +278,9 @@ static u8 ChooseWildMonIndex_Fishing(u8 rod)
wildMonIndex = 3;
if (rand >= ENCOUNTER_CHANCE_FISHING_MONS_GOOD_ROD_SLOT_3 && rand < ENCOUNTER_CHANCE_FISHING_MONS_GOOD_ROD_SLOT_4)
wildMonIndex = 4;
if (swap)
wildMonIndex = 6 - wildMonIndex;
break;
case SUPER_ROD:
if (rand < ENCOUNTER_CHANCE_FISHING_MONS_SUPER_ROD_SLOT_5)
@ -260,28 +293,33 @@ static u8 ChooseWildMonIndex_Fishing(u8 rod)
wildMonIndex = 8;
if (rand >= ENCOUNTER_CHANCE_FISHING_MONS_SUPER_ROD_SLOT_8 && rand < ENCOUNTER_CHANCE_FISHING_MONS_SUPER_ROD_SLOT_9)
wildMonIndex = 9;
if (swap)
wildMonIndex = 14 - wildMonIndex;
break;
}
return wildMonIndex;
}
static u8 ChooseWildMonLevel(const struct WildPokemon *wildPokemon)
static u8 ChooseWildMonLevel(const struct WildPokemon *wildPokemon, u8 wildMonIndex, u8 area)
{
u8 min;
u8 max;
u8 range;
u8 rand;
// Make sure minimum level is less than maximum level
if (wildPokemon->maxLevel >= wildPokemon->minLevel)
if (LURE_STEP_COUNT == 0)
{
min = wildPokemon->minLevel;
max = wildPokemon->maxLevel;
// Make sure minimum level is less than maximum level
if (wildPokemon[wildMonIndex].maxLevel >= wildPokemon[wildMonIndex].minLevel)
{
min = wildPokemon[wildMonIndex].minLevel;
max = wildPokemon[wildMonIndex].maxLevel;
}
else
{
min = wildPokemon->maxLevel;
max = wildPokemon->minLevel;
min = wildPokemon[wildMonIndex].maxLevel;
max = wildPokemon[wildMonIndex].minLevel;
}
range = max - min + 1;
rand = Random() % range;
@ -301,6 +339,16 @@ static u8 ChooseWildMonLevel(const struct WildPokemon *wildPokemon)
}
return min + rand;
}
else
{
// Looks for the max level of all slots that share the same species as the selected slot.
max = GetMaxLevelOfSpeciesInWildTable(wildPokemon, wildPokemon[wildMonIndex].species, area);
if (max > 0)
return max + 1;
else // Failsafe
return wildPokemon[wildMonIndex].maxLevel + 1;
}
}
static u16 GetCurrentMapWildMonHeaderId(void)
{
@ -461,7 +509,7 @@ static bool8 TryGenerateWildMon(const struct WildPokemonInfo *wildMonInfo, u8 ar
break;
}
level = ChooseWildMonLevel(&wildMonInfo->wildPokemon[wildMonIndex]);
level = ChooseWildMonLevel(wildMonInfo->wildPokemon, wildMonIndex, area);
if (flags & WILD_CHECK_REPEL && !IsWildLevelAllowedByRepel(level))
return FALSE;
if (gMapHeader.mapLayoutId != LAYOUT_BATTLE_FRONTIER_BATTLE_PIKE_ROOM_WILD_MONS && flags & WILD_CHECK_KEEN_EYE && !IsAbilityAllowingEncounter(level))
@ -474,7 +522,7 @@ static bool8 TryGenerateWildMon(const struct WildPokemonInfo *wildMonInfo, u8 ar
static u16 GenerateFishingWildMon(const struct WildPokemonInfo *wildMonInfo, u8 rod)
{
u8 wildMonIndex = ChooseWildMonIndex_Fishing(rod);
u8 level = ChooseWildMonLevel(&wildMonInfo->wildPokemon[wildMonIndex]);
u8 level = ChooseWildMonLevel(wildMonInfo->wildPokemon, wildMonIndex, WILD_AREA_FISHING);
CreateWildMon(wildMonInfo->wildPokemon[wildMonIndex].species, level);
return wildMonInfo->wildPokemon[wildMonIndex].species;
@ -521,6 +569,8 @@ static bool8 DoWildEncounterRateTest(u32 encounterRate, bool8 ignoreAbility)
encounterRate = encounterRate * 80 / 100;
ApplyFluteEncounterRateMod(&encounterRate);
ApplyCleanseTagEncounterRateMod(&encounterRate);
if (LURE_STEP_COUNT != 0)
encounterRate *= 2;
if (!ignoreAbility && !GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG))
{
u32 ability = GetMonAbility(&gPlayerParty[0]);
@ -825,7 +875,7 @@ void FishingWildEncounter(u8 rod)
if (CheckFeebas() == TRUE)
{
u8 level = ChooseWildMonLevel(&sWildFeebas);
u8 level = ChooseWildMonLevel(&sWildFeebas, 0, WILD_AREA_FISHING);
species = sWildFeebas.species;
CreateWildMon(species, level);
@ -892,18 +942,20 @@ u16 GetLocalWaterMon(void)
bool8 UpdateRepelCounter(void)
{
u16 steps;
u16 repelLureVar = VarGet(VAR_REPEL_STEP_COUNT);
u16 steps = REPEL_LURE_STEPS(repelLureVar);
bool32 isLure = IS_LAST_USED_LURE(repelLureVar);
if (InBattlePike() || InBattlePyramid())
return FALSE;
if (InUnionRoom() == TRUE)
return FALSE;
steps = VarGet(VAR_REPEL_STEP_COUNT);
if (steps != 0)
{
steps--;
if (!isLure)
{
VarSet(VAR_REPEL_STEP_COUNT, steps);
if (steps == 0)
{
@ -911,6 +963,17 @@ bool8 UpdateRepelCounter(void)
return TRUE;
}
}
else
{
VarSet(VAR_REPEL_STEP_COUNT, steps | REPEL_LURE_MASK);
if (steps == 0)
{
ScriptContext_SetupScript(EventScript_LureWoreOff);
return TRUE;
}
}
}
return FALSE;
}
@ -918,7 +981,7 @@ static bool8 IsWildLevelAllowedByRepel(u8 wildLevel)
{
u8 i;
if (!VarGet(VAR_REPEL_STEP_COUNT))
if (!REPEL_STEP_COUNT)
return TRUE;
for (i = 0; i < PARTY_SIZE; i++)
@ -976,6 +1039,34 @@ static bool8 TryGetRandomWildMonIndexByType(const struct WildPokemon *wildMon, u
return TRUE;
}
#include "data.h"
static u8 GetMaxLevelOfSpeciesInWildTable(const struct WildPokemon *wildMon, u16 species, u8 area)
{
u8 i, maxLevel = 0, numMon = 0;
switch (area)
{
case WILD_AREA_LAND:
numMon = LAND_WILD_COUNT;
break;
case WILD_AREA_WATER:
numMon = WATER_WILD_COUNT;
break;
case WILD_AREA_ROCKS:
numMon = ROCK_WILD_COUNT;
break;
}
for (i = 0; i < numMon; i++)
{
if (wildMon[i].species == species && wildMon[i].maxLevel > maxLevel)
maxLevel = wildMon[i].maxLevel;
}
return maxLevel;
}
static bool8 TryGetAbilityInfluencedWildMonIndex(const struct WildPokemon *wildMon, u8 type, u16 ability, u8 *monIndex)
{
if (GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG))