Puzzle code for demo, etc

This commit is contained in:
Mathew 2015-11-27 02:19:31 -05:00 committed by Mathew Velasquez
parent 917d320342
commit 0836769fca
4 changed files with 34 additions and 7 deletions

View File

@ -1,7 +1,10 @@
module Item
COMBINATIONS = {
[3, 4] => 5,
[25, 26] => 30,
[3, 4] => 5, # alcohol + dry branch => wet branch
[25, 26] => 30, # feather + ink bottle => pen
[32, 36] => 33, # button + magnets => magnetized button
[37, 38] => 32, # tin + scissors => button
[36, 37] => 100, # tin + magnets => can't combine
}
def self.combine(item_a, item_b)

View File

@ -3,6 +3,7 @@ class Game_Oneshot
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :player_name # map music (for battle memory)
attr_accessor :plight_timer # start of plight's plight
def initialize
user_name = Oneshot::USER_NAME.split(/\s+/)
@ -13,6 +14,7 @@ class Game_Oneshot
end
@lights = {}
self.lang = Oneshot::LANG
@plight_timer = nil
end
# lang
@ -29,9 +31,9 @@ class Game_Oneshot
# MARSHAL
def marshal_dump
[@player_name, @lang]
[@player_name, @lang, @plight_timer]
end
def marshal_load(array)
@player_name, self.lang = array
@player_name, self.lang, @plight_timer = array
end
end

View File

@ -18,12 +18,12 @@ class Interpreter
# Create full text string
choices = false
text = @list[@index].parameters[0].strip
text = @list[@index].parameters[0].rstrip
loop do
# 401: another line of text
if @list[@index+1].code == 401
@index += 1
text << " " << @list[@index].parameters[0]
text << " " << @list[@index].parameters[0].rstrip
else
# 102: show choices
if @list[@index+1].code == 102
@ -41,7 +41,7 @@ class Interpreter
break
end
end
text.gsub!(/\s+\\n\s+/, '\\n')
text.gsub!(/\s*\\n\s*/, '\\n')
text.strip!
# Translate text

View File

@ -112,3 +112,25 @@ end
def green_ambient
ambient -50, -50, -50
end
# Misc
def watcher_tell_time
hour = Time.now.hour
if hour >= 6 && hour < 12
Script.tmp_v1 = 0
elsif hour >= 12 && hour < 17
Script.tmp_v1 = 1
elsif hour >= 17
Script.tmp_v1 = 2
else
Script.tmp_v1 = 3
end
end
def plight_start_timer
$game_oneshot.plight_timer = Time.now
end
def plight_update_timer
Script.tmp_v1 = ((Time.now - $game_oneshot.plight_timer) / 60).to_i
end