Safari Game battle type & bug fix

This adds the restoration of the Safari Zone from Pokemon October. There isn't a proper place for this yet, but there will be soon!

It seems to have issues with tiles, which I am assuming to either be the tilemap clearing or something relating to Zeta's custom ball palettes, since I had to add the Safari Ball. Can you get to that, @ZetaNull?

2ff835730b

also fixed the unnumbered route errors.
This commit is contained in:
Llinos Evans 2024-07-21 23:36:56 +01:00
parent 74506bd7b0
commit d3fbd1f846
13 changed files with 197 additions and 44 deletions

View file

@ -93,7 +93,7 @@ Additionally, there have been many wild encounter tweaks. View this document for
- Rezzo (GSC-specific advice)
- Old Dance Jacket (GSC-specific advice)
- Minamitoku (SW97 demo translation commentary [here](https://www.youtube.com/watch?v=Pe1vsKRl7_M&ab_channel=Minamitoku))
- ZoomTen - Honey Pot & Honey Grandma features from Pokemon October, commits [here](https://github.com/pokeachromicdevs/pokeoctober/commit/d00cd6fafdbe5069d2cc452a154942f82f7fceb6), [here](https://github.com/pokeachromicdevs/pokeoctober/commit/1a6f3e4f0307656018f02d4981c973efa814a248), and [here](https://github.com/pokeachromicdevs/pokeoctober/commit/8114fead91828dd6d986fe120d6c5cd5e3c6cbf6).
- ZoomTen - Honey Pot & Honey Grandma features from Pokemon October, commits [here](https://github.com/pokeachromicdevs/pokeoctober/commit/d00cd6fafdbe5069d2cc452a154942f82f7fceb6), [here](https://github.com/pokeachromicdevs/pokeoctober/commit/1a6f3e4f0307656018f02d4981c973efa814a248), and [here](https://github.com/pokeachromicdevs/pokeoctober/commit/8114fead91828dd6d986fe120d6c5cd5e3c6cbf6). Safari Game restoration [here](https://github.com/pokeachromicdevs/pokeoctober/commit/2ff835730b2a61a757ad67f13e50480c965d2a0c}.
- ausma (KEP Developer, legacy)
# Sprite Credits

View file

@ -85,7 +85,7 @@ DEF SPDSPCDV_SHINY EQU $AA
const_def
const BATTLETYPE_NORMAL
const BATTLETYPE_CANLOSE
const BATTLETYPE_DEBUG
const BATTLETYPE_SAFARI
const BATTLETYPE_TUTORIAL
const BATTLETYPE_FISH
const BATTLETYPE_ROAMING

View file

@ -50,7 +50,7 @@
const SUPER_REPEL ; 2a
const MAX_REPEL ; 2b
const DIRE_HIT ; 2c
const ITEM_2D ; 2d
const SAFARI_BALL ; 2d
const FRESH_WATER ; 2e
const SODA_POP ; 2f
const LEMONADE ; 30
@ -314,6 +314,5 @@ DEF USE_SCRIPT_VAR EQU $00
DEF ITEM_FROM_MEM EQU $ff
; leftovers from red
DEF SAFARI_BALL EQU $08 ; MOON_STONE
DEF MOON_STONE_RED EQU $0a ; BURN_HEAL
DEF FULL_HEAL_RED EQU $34 ; X_SPEED

View file

@ -96,8 +96,8 @@ ItemAttributes:
item_attribute 700, HELD_NONE, 0, CANT_SELECT, ITEM, ITEMMENU_CURRENT, ITEMMENU_NOUSE
; DIRE_HIT
item_attribute 650, HELD_NONE, 0, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_CLOSE
; ITEM_2D
item_attribute $9999, HELD_NONE, 0, NO_LIMITS, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE
; SAFARI_BALL, was ITEM_2D
item_attribute 0, HELD_NONE, 0, CANT_SELECT, BALL, ITEMMENU_NOUSE, ITEMMENU_CLOSE
; FRESH_WATER
item_attribute 200, HELD_NONE, 50, CANT_SELECT, ITEM, ITEMMENU_PARTY, ITEMMENU_PARTY
; SODA_POP

View file

@ -979,3 +979,7 @@ ClubFossilDesc:
HoneyPotDesc:
db "A pot for storing"
next "SWEET HONEY.@"
SafariBallDesc:
db "An ULTRA BALL"
next "painted green.@"

View file

@ -44,7 +44,7 @@ ItemNames::
li "SUPER REPEL"
li "MAX REPEL"
li "DIRE HIT"
li "TERU-SAMA"
li "SAFARI BALL"
li "FRESH WATER"
li "SODA POP"
li "LEMONADE"

View file

@ -377,7 +377,7 @@ ENDM
map_attributes SilentHills, SILENT_HILLS, $05, EAST | WEST ; Add Prince connections later
connection west, Route49, ROUTE_49, 0
connection east, UnnumberedRoute, UNNUMBERED_ROUTE, 0
connection east, Route66, ROUTE_66, 0
map_attributes Route49, ROUTE_49, $05, EAST | WEST
connection east, SilentHills, SILENT_HILLS, $00, 0

View file

@ -1,5 +1,15 @@
BattleText:: ; used only for BANK(BattleText)
BattleText_ThrewRock:
text "<PLAYER> threw a"
line "rock."
prompt
BattleText_ThrewBait:
text "<PLAYER> threw"
line "some bait."
prompt
BattleText_PlayerPickedUpPayDayMoney:
text "<PLAYER> picked up"
line "¥@"

View file

@ -53,8 +53,8 @@ DoBattle:
jp z, LostBattle
call SafeLoadTempTilemapToTilemap
ld a, [wBattleType]
cp BATTLETYPE_DEBUG
jp z, .tutorial_debug
cp BATTLETYPE_SAFARI
jp z, SafariBattle
cp BATTLETYPE_TUTORIAL
jp z, .tutorial_debug
xor a
@ -115,6 +115,23 @@ DoBattle:
.tutorial_debug
jp BattleMenu
SafariBattle:
.loop
call CheckSafariBattleOver
ret c
call BattleMenu
ret c
ld a, [wBattleEnded]
and a
ret nz
call HandleSafariAngerEatingStatus
call CheckSafariMonRan
ret c
ld a, [wBattleEnded]
and a
ret nz
jr .loop
WildFled_EnemyFled_LinkBattleCanceled:
call SafeLoadTempTilemapToTilemap
ld a, [wBattleResult]
@ -559,6 +576,21 @@ DetermineMoveOrder:
and a
ret
CheckSafariBattleOver:
IF DEF(_DEBUG) ; Use to test the Safari Game in the Debug Room.
ld a, 20
ld [wSafariBallsRemaining], a
ENDC
ld a, [wSafariBallsRemaining]
and a
ret nz
ld a, [wBattleResult]
and $c0
add $2
ld [wBattleResult], a
scf
ret
CheckContestBattleOver:
ld a, [wBattleType]
cp BATTLETYPE_CONTEST
@ -3654,7 +3686,7 @@ CheckIfCurPartyMonIsFitToFight:
TryToRunAwayFromBattle:
; Run away from battle, with or without item
ld a, [wBattleType]
cp BATTLETYPE_DEBUG
cp BATTLETYPE_SAFARI
jp z, .can_escape
cp BATTLETYPE_CONTEST
jp z, .can_escape
@ -4858,7 +4890,7 @@ BattleMenu:
call LoadTempTilemapToTilemap
ld a, [wBattleType]
cp BATTLETYPE_DEBUG
cp BATTLETYPE_SAFARI
jr z, .ok
cp BATTLETYPE_TUTORIAL
jr z, .ok
@ -4870,10 +4902,15 @@ BattleMenu:
.loop
ld a, [wBattleType]
cp BATTLETYPE_SAFARI
jr z, .safari_game
cp BATTLETYPE_CONTEST
jr nz, .not_contest
farcall ContestBattleMenu
jr .next
.safari_game
farcall SafariBattleMenu
jr .next
.not_contest
; Auto input: choose "ITEM"
@ -4899,7 +4936,87 @@ BattleMenu:
jp z, BattleMenu_Run
jr .loop
BattleMenu_Bait:
ld hl, BattleText_ThrewBait
call StdBattleTextbox
ld hl, wEnemyMonCatchRate
srl [hl] ; halve catch rate
ld hl, wSafariMonEating
ld de, wSafariMonAngerCount
jr BattleMenu_BaitRock_Common
BattleMenu_Rock:
ld hl, BattleText_ThrewRock
call StdBattleTextbox
ld hl, wEnemyMonCatchRate
ld a, [hl]
add a ; double catch rate
jr nc, .noCarry
ld a, $ff
.noCarry
ld [hl], a
ld hl, wSafariMonAngerCount
ld de, wSafariMonEating
BattleMenu_BaitRock_Common:
xor a
ld [de], a ; zero the Eating counter (rock) or the Anger counter (bait)
.randomLoop ; loop until a number less than 5 is generated
call BattleRandom
and 7
cp 5
jr nc, .randomLoop
inc a ; increment the random number, giving a range from 1 to 5 inclusive
ld b, a
ld a, [hl]
add b ; increase Eating or Anger counter appropriately
jr nc, .noCarry
ld a, $ff
.noCarry
ld [hl], a
and a
ret
CheckSafariMonRan:
; Wildmon always runs when you are out of Safari Balls
ld a, [wSafariBallsRemaining]
and a
jp z, WildFled_EnemyFled_LinkBattleCanceled
; otherwise, check its speed, bait, and rock factors
; this probably could stand to be cleaned up or rewritten later
; it is basically taken directly from Gen 1
ld a, [wEnemyMonSpeed + 1]
add a
ld b, a ; init b (which is later compared with random value) to (enemy speed % 256) * 2
jp c, WildFled_EnemyFled_LinkBattleCanceled ; if (enemy speed % 256) > 127, the enemy runs
ld a, [wSafariMonEating]
and a ; is bait factor 0?
jr z, .checkEscapeFactor
; bait factor is not 0
; divide b by 4 (making the mon less likely to run)
srl b
srl b
.checkEscapeFactor
ld a, [wSafariMonAngerCount]
and a ; is escape factor 0?
jr z, .compareWithRandomValue
; escape factor is not 0
; multiply b by 2 (making the mon more likely to run)
sla b
jr nc, .compareWithRandomValue
; cap b at 255
ld b, $ff
.compareWithRandomValue
call BattleRandom
cp b
ret nc
jp WildFled_EnemyFled_LinkBattleCanceled ; if b was greater than the random value, the enemy runs
BattleMenu_Fight:
; replace Fight with Safari Ball
ld a, [wBattleType]
cp BATTLETYPE_SAFARI
jr z, BattleMenu_SafariBall
xor a
ld [wNumFleeAttempts], a
call SafeLoadTempTilemapToTilemap
@ -4932,10 +5049,14 @@ LoadBattleMenu2:
ret
BattleMenu_Pack:
; replace Pack with Rock
ld a, [wBattleType]
cp BATTLETYPE_SAFARI
jp z, BattleMenu_Rock
ld a, [wLinkMode]
and a
jp nz, .ItemsCantBeUsed
jp nz, BattleMenu_SafariBall.ItemsCantBeUsed
BattleMenu_SafariBall:
ld a, [wInBattleTowerBattle]
and a
jp nz, .ItemsCantBeUsed
@ -4947,6 +5068,8 @@ BattleMenu_Pack:
jr z, .tutorial
cp BATTLETYPE_CONTEST
jr z, .contest
cp BATTLETYPE_SAFARI
jr z, .safari
farcall BattlePack
ld a, [wBattlePlayerAction]
@ -4961,6 +5084,12 @@ BattleMenu_Pack:
call DoItemEffect
jr .got_item
.safari
ld a, SAFARI_BALL
ld [wCurItem], a
call DoItemEffect
jr .UseItem
.contest
ld a, PARK_BALL
ld [wCurItem], a
@ -4996,6 +5125,7 @@ BattleMenu_Pack:
cp BALL
jr z, .ball
call ClearBGPalettes
call ClearTilemap
.ball
xor a
@ -5005,14 +5135,17 @@ BattleMenu_Pack:
ld a, [wBattleType]
cp BATTLETYPE_TUTORIAL
jr z, .tutorial2
call GetBattleMonBackpic
cp BATTLETYPE_SAFARI
call nz, GetMonBackpic
.tutorial2
call GetEnemyMonFrontpic
ld a, $1
ld [wMenuCursorY], a
call ExitMenu
call UpdateBattleHUDs
ld a, [wBattleType]
cp BATTLETYPE_SAFARI
call nz, UpdateBattleHUDs
call WaitBGMap
call LoadTilemapToTempTilemap
call ClearWindowData
@ -5032,6 +5165,10 @@ BattleMenu_Pack:
ret
BattleMenu_PKMN:
; replace Pkmn with Bait
ld a, [wBattleType]
cp BATTLETYPE_SAFARI
jp z, BattleMenu_Bait
call LoadStandardMenuHeader
BattleMenuPKMN_ReturnFromStats:
call ExitMenu
@ -7740,15 +7877,11 @@ GoodComeBackText:
text_far _GoodComeBackText
text_end
TextJump_ComeBack: ; unreferenced
ld hl, ComeBackText
ret
ComeBackText:
text_far _ComeBackText
text_end
HandleSafariAngerEatingStatus: ; unreferenced
HandleSafariAngerEatingStatus:
ld hl, wSafariMonEating
ld a, [hl]
and a

View file

@ -9,8 +9,8 @@ LoadBattleMenu:
call ExitMenu
ret
SafariBattleMenu: ; unreferenced
ld hl, SafariBattleMenuHeader
SafariBattleMenu:
ld hl, SafariBattleMenuDataHeader
call LoadMenuHeader
jr CommonBattleMenu
@ -47,7 +47,7 @@ BattleMenuHeader:
db "PACK@"
db "RUN@"
SafariBattleMenuHeader:
SafariBattleMenuDataHeader:
db MENU_BACKUP_TILES ; flags
menu_coords 0, 12, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1
dw .MenuData
@ -61,13 +61,13 @@ SafariBattleMenuHeader:
dba .PrintSafariBallsRemaining
.Text:
db "サファりボール×  @" ; "SAFARI BALL× @"
db "エサをなげる@" ; "THROW BAIT"
db "いしをなげる@" ; "THROW ROCK"
db "にげる@" ; "RUN"
db "BALL×  @" ; "SAFARI BALL× @"
db "BAIT@" ; "THROW BAIT"
db "ROCK@" ; "THROW ROCK"
db "RUN@" ; "RUN"
.PrintSafariBallsRemaining:
hlcoord 17, 13
hlcoord 7, 14
ld de, wSafariBallsRemaining
lb bc, PRINTNUM_LEADINGZEROS | 1, 2
call PrintNum

View file

@ -58,7 +58,7 @@ ItemEffects:
dw SuperRepelEffect ; SUPER_REPEL
dw MaxRepelEffect ; MAX_REPEL
dw DireHitEffect ; DIRE_HIT
dw NoEffect ; ITEM_2D
dw PokeBallEffect ; SAFARI_BALL, was ITEM_2D
dw RestoreHPEffect ; FRESH_WATER
dw RestoreHPEffect ; SODA_POP
dw RestoreHPEffect ; LEMONADE
@ -240,6 +240,8 @@ PokeBallEffect:
ld a, [wBattleType]
cp BATTLETYPE_CONTEST ; Fixes the Park Ball corrupting graphics when used outside of a Contest
call nz, ReturnToBattle_UseBall
cp BATTLETYPE_SAFARI
call nz, ReturnToBattle_UseBall
ld hl, wOptions
res NO_TEXT_SCROLL, [hl]
@ -691,8 +693,8 @@ PokeBallEffect:
ld a, [wBattleType]
cp BATTLETYPE_TUTORIAL
ret z
cp BATTLETYPE_DEBUG
ret z
cp BATTLETYPE_SAFARI
jr z, .used_safari_ball
cp BATTLETYPE_CONTEST
jr z, .used_park_ball
@ -714,6 +716,11 @@ PokeBallEffect:
dec [hl]
ret
.used_safari_ball
ld hl, wSafariBallsRemaining
dec [hl]
ret
BallMultiplierFunctionTable:
; table of routines that increase or decrease the catch rate based on
; which ball is used in a certain situation.

View file

@ -60,7 +60,7 @@ DebugPokemon4Script:
cry NIDORAN_M
pause 15
closetext
loadvar VAR_BATTLETYPE, BATTLETYPE_NORMAL
loadvar VAR_BATTLETYPE, BATTLETYPE_SAFARI
loadwildmon BIPULLA, 60
startbattle
reloadmapafterbattle

View file

@ -1,15 +1,15 @@
object_const_def
UnnumberedRoute_MapScripts:
Route66_MapScripts:
def_scene_scripts
def_callbacks
UnnumberedRouteSign1Script:
jumptext UnnumberedRouteSign1Text
Route66Sign1Script:
jumptext Route66Sign1Text
UnnumberedRouteSign1Text:
text "Route XX"
Route66Sign1Text:
text "ROUTE 66"
line "WEST: SILENT"
cont "HILLS"
@ -17,10 +17,10 @@ UnnumberedRouteSign1Text:
line "PATH"
done
UnnumberedRouteSign2Script:
jumptext UnnumberedRouteSign2Text
Route66Sign2Script:
jumptext Route66Sign2Text
UnnumberedRouteSign2Text:
Route66Sign2Text:
text "TRAINER TIPS"
para "If you use DEF-"
@ -119,7 +119,7 @@ FisherBranAfterBattleText:
line "incredible?"
done
UnnumberedRoute_MapEvents:
Route66_MapEvents:
db 0, 0 ; filler
def_warp_events
@ -128,8 +128,8 @@ UnnumberedRoute_MapEvents:
def_coord_events
def_bg_events
bg_event 2, 4, BGEVENT_READ, UnnumberedRouteSign1Script
bg_event 30, 6, BGEVENT_READ, UnnumberedRouteSign2Script
bg_event 2, 4, BGEVENT_READ, Route66Sign1Script
bg_event 30, 6, BGEVENT_READ, Route66Sign2Script
def_object_events
object_event 47, 4, SPRITE_YOUNGSTER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, 0, OBJECTTYPE_TRAINER, 1, TrainerPainterDali, -1