class Scene_Fishing
def main
@spriteset = Spriteset_Map.new
s1 = "Worm"
s2 = "Cheese"
s3 = "Bread"
s4 = "Salt Pork"
@command_window = Window_Command2.new(160, [s1, s2, s3, s4])
@command_window.y = 64
@command_window.opacity = 160
if $game_party.item_number(161) == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(0)
end
if $game_party.item_number(162) == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(1)
end
if $game_party.item_number(163) == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(2)
end
if $game_party.item_number(164) == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(3)
end
@help_window = Window_Help.new
@help_window.set_text("Choose your bait.", 1)
@help_window.opacity = 160
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@spriteset.dispose
@command_window.dispose
@help_window.dispose
end
def update
@spriteset.update
@command_window.update
@help_window.update
update_command
end
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0 # bait 1
if $game_party.item_number(161) == 0
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
else
@help_window.set_text("Fishing...", 1)
@command_window.visible = false
@command_window.active = false
$game_party.lose_item(161, 1)
update_fish
end
when 1 # bait 2
if $game_party.item_number(162) == 0
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
else
@help_window.set_text("Fishing...", 1)
@command_window.visible = false
@command_window.active = false
$game_party.lose_item(162, 1)
update_fish
end
when 2 # bait 3
if $game_party.item_number(163) == 0
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
else
@help_window.set_text("Fishing...", 1)
@command_window.visible = false
@command_window.active = false
$game_party.lose_item(163, 1)
update_fish
end
when 3 # bait 4
if $game_party.item_number(164) == 0
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
else
@help_window.set_text("Fishing...", 1)
@command_window.active = false
@command_window.visible = false
$game_party.lose_item(164, 1)
update_fish
end
end
return
end
end
end
def update_fish
# If B button was pressed
@help_window.set_text("Oh a bite!", 1)
if Input.trigger?(Input::C)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
gain_random_fish
return
end
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
end
def gain_random_fish
case $game_player.direction
when 2
lookingx = $game_player.x
lookingy = $game_player.y + 1
when 4
lookingx = $game_player.x - 1
lookingy = $game_player.y
when 6
lookingx = $game_player.x + 1
lookingy = $game_player.y
when 8
lookingx = $game_player.x
lookingy = $game_player.y - 1
end
case $game_map.terrain_tag(lookingx,lookingy)
when 6
$FISH = [153, 154, 155, 156, 157, 158, 159]
when 7
$FISH = [142, 143, 144, 145, 146, 147, 148, 149, 150, 151]
end
fish2 = rand($FISH.size)
$game_party.gain_item($FISH[fish2], 1)
@help_window.set_text("You caught a " + $data_items[$FISH[fish2]].name + "!", 1)
$game_variables[1] += 1
if Input.trigger?(Input::C)
$scene = Scene_Map.new
return
end
end