mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-11-03 08:15:47 +00:00
Release 6.9.0
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
class Trainer
|
||||
attr_accessor :safari_record
|
||||
end
|
||||
|
||||
class Game_Temp
|
||||
attr_accessor :last_safari_stats
|
||||
end
|
||||
|
||||
class SafariState
|
||||
attr_accessor :ballcount
|
||||
attr_accessor :decision
|
||||
@@ -9,6 +17,7 @@ class SafariState
|
||||
@inProgress = false
|
||||
@steps = 0
|
||||
@decision = 0
|
||||
@caught_pokemon = []
|
||||
end
|
||||
|
||||
def pbReceptionMap
|
||||
@@ -19,38 +28,119 @@ class SafariState
|
||||
return @inProgress
|
||||
end
|
||||
|
||||
def recordLastSafari
|
||||
$game_temp.last_safari_stats = [@caught_pokemon, @steps]
|
||||
end
|
||||
|
||||
def pbGoToStart
|
||||
start_map = Settings::KANTO ? 472 : MAP_SAFARI_ENTRANCE
|
||||
start_x = Settings::KANTO ? 28 : 8
|
||||
start_y = Settings::KANTO ? 11 : 7
|
||||
start_direction = Settings::KANTO ? DIRECTION_DOWN : DIRECTION_LEFT
|
||||
|
||||
|
||||
if $scene.is_a?(Scene_Map)
|
||||
pbFadeOutIn {
|
||||
$game_temp.player_transferring = true
|
||||
$game_temp.transition_processing = true
|
||||
$game_temp.player_new_map_id = 472 #@start[0]
|
||||
$game_temp.player_new_x = 28#@start[1]
|
||||
$game_temp.player_new_y = 11#@start[2]
|
||||
$game_temp.player_new_direction = 2
|
||||
$game_temp.player_new_map_id = start_map #@start[0]
|
||||
$game_temp.player_new_x = start_x#@start[1]
|
||||
$game_temp.player_new_y = start_y#@start[2]
|
||||
$game_temp.player_new_direction = start_direction
|
||||
$scene.transfer_player
|
||||
}
|
||||
end
|
||||
pbSafariState.pbEnd
|
||||
end
|
||||
|
||||
def pbStart(ballcount)
|
||||
@start = [$game_map.map_id,$game_player.x,$game_player.y,$game_player.direction]
|
||||
@ballcount = ballcount
|
||||
@inProgress = true
|
||||
@steps = Settings::SAFARI_STEPS
|
||||
@steps = Settings::SAFARI_STEPS
|
||||
end
|
||||
|
||||
def pbEnd
|
||||
recordLastSafari
|
||||
$PokemonGlobal.encounter_version = 0
|
||||
@start = nil
|
||||
@ballcount = 0
|
||||
@inProgress = false
|
||||
@steps = 0
|
||||
@decision = 0
|
||||
$game_map.need_refresh = true
|
||||
clear_all_images
|
||||
pbSafariState.caught_pokemon=nil
|
||||
disposeBallDisplay
|
||||
end
|
||||
end
|
||||
|
||||
BALL_ICON_SIZE = 28
|
||||
BALL_MARGIN = 8
|
||||
def updateBallDisplay
|
||||
return if !@inProgress
|
||||
createBallDisplay if !@ball_sprite || @ball_sprite.disposed?
|
||||
bmp = @ball_sprite.bitmap
|
||||
bmp.clear
|
||||
|
||||
icon = RPG::Cache.picture("Safari/safariball_ui")
|
||||
bmp.blt(0, 0, icon, Rect.new(0, 0, icon.width, icon.height))
|
||||
baseColor = pbColor(:LIGHT_TEXT_MAIN_COLOR)
|
||||
shadowColor = pbColor(:LIGHT_TEXT_SHADOW_COLOR)
|
||||
pbSetSystemFont(bmp)
|
||||
text_x = BALL_ICON_SIZE + 4
|
||||
pbDrawShadowText(bmp, text_x, 0, -1, -1, "x #{@ballcount}", baseColor, shadowColor)
|
||||
end
|
||||
|
||||
def createBallDisplay
|
||||
disposeBallDisplay
|
||||
@ball_viewport = Viewport.new(0, 0, Graphics.width, Graphics.height)
|
||||
@ball_viewport.z = 99999
|
||||
@ball_sprite = Sprite.new(@ball_viewport)
|
||||
@ball_sprite.bitmap = Bitmap.new(120, BALL_ICON_SIZE)
|
||||
@ball_sprite.x = BALL_MARGIN
|
||||
@ball_sprite.y = BALL_MARGIN
|
||||
end
|
||||
|
||||
def disposeBallDisplay
|
||||
if @ball_sprite
|
||||
@ball_sprite.bitmap.dispose if @ball_sprite.bitmap && !@ball_sprite.bitmap.disposed?
|
||||
@ball_sprite.dispose if !@ball_sprite.disposed?
|
||||
@ball_sprite = nil
|
||||
end
|
||||
if @ball_viewport
|
||||
@ball_viewport.dispose if !@ball_viewport.disposed?
|
||||
@ball_viewport = nil
|
||||
end
|
||||
end
|
||||
def has_caught_some_pokemon?
|
||||
return false unless $game_temp.last_safari_stats
|
||||
return false unless $game_temp.last_safari_stats.size >= 2
|
||||
return false unless $game_temp.last_safari_stats[0]
|
||||
return false unless $game_temp.last_safari_stats[1]
|
||||
return true
|
||||
end
|
||||
def tellLatestSafariStats(talking_event_id)
|
||||
pbCallBub(2, talking_event_id)
|
||||
pbMessage(_INTL("Welcome back! How was your Safari adventure?"))
|
||||
|
||||
return unless has_caught_some_pokemon?
|
||||
|
||||
nb_caught = $game_temp.last_safari_stats[0].size
|
||||
nb_steps = $game_temp.last_safari_stats[1].abs
|
||||
|
||||
pbCallBub(2, talking_event_id)
|
||||
pbMessage(_INTL("You took \\C[1]{1}\\C[0] steps and caught \\C[1]{2}\\C[0] Pokémon!",nb_steps,nb_caught))
|
||||
$Trainer.safari_record = 0 unless $Trainer.safari_record
|
||||
if nb_caught > $Trainer.safari_record
|
||||
pbCallBub(2, talking_event_id)
|
||||
pbMessage(_INTL("Wow! That's a new personal record. Congratulations!"))
|
||||
$Trainer.safari_record = nb_caught
|
||||
else
|
||||
pbCallBub(2, talking_event_id)
|
||||
pbMessage(_INTL("I hope you had a lot of fun!"))
|
||||
end
|
||||
end
|
||||
|
||||
Events.onMapChange += proc { |_sender,*args|
|
||||
pbSafariState.pbEnd if !pbInSafari?
|
||||
@@ -69,7 +159,8 @@ def pbInSafari?
|
||||
end
|
||||
|
||||
def is_hardcoded_safari_map(map_id)
|
||||
safari_maps = [445,74,484,75,485,82,486,107,487,715,718,488,717]
|
||||
safari_maps = [445,74,484,75,485,82,486,107,487,715,718,488,717] if Settings::KANTO
|
||||
safari_maps = HOENN_SAFARI_MAPS if Settings::HOENN
|
||||
return safari_maps.include?(map_id)
|
||||
end
|
||||
|
||||
@@ -82,9 +173,9 @@ end
|
||||
Events.onStepTakenTransferPossible += proc { |_sender,e|
|
||||
handled = e[0]
|
||||
next if handled[0]
|
||||
if pbInSafari? && pbSafariState.decision==0 && Settings::SAFARI_STEPS > 0
|
||||
if pbInSafari? && pbSafariState.decision==0
|
||||
pbSafariState.steps -= 1
|
||||
if pbSafariState.steps<=0
|
||||
if pbSafariState.steps==0
|
||||
pbMessage(_INTL("PA: Ding-dong!\1"))
|
||||
pbMessage(_INTL("PA: Your safari game is over!"))
|
||||
pbSafariState.decision = 1
|
||||
|
||||
Reference in New Issue
Block a user