From 0836769fcab613875ff9a8de5289921af823da3a Mon Sep 17 00:00:00 2001
From: Mathew <mathewvq@gmail.com>
Date: Fri, 27 Nov 2015 02:19:31 -0500
Subject: [PATCH] Puzzle code for demo, etc

---
 scripts/Data_Item.rb     |  7 +++++--
 scripts/Game_Oneshot.rb  |  6 ++++--
 scripts/Interpreter 3.rb |  6 +++---
 scripts/Script.rb        | 22 ++++++++++++++++++++++
 4 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/scripts/Data_Item.rb b/scripts/Data_Item.rb
index 465999c..a582c10 100644
--- a/scripts/Data_Item.rb
+++ b/scripts/Data_Item.rb
@@ -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)
diff --git a/scripts/Game_Oneshot.rb b/scripts/Game_Oneshot.rb
index fd43444..fe55d7b 100644
--- a/scripts/Game_Oneshot.rb
+++ b/scripts/Game_Oneshot.rb
@@ -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
diff --git a/scripts/Interpreter 3.rb b/scripts/Interpreter 3.rb
index ff47804..49b33a5 100644
--- a/scripts/Interpreter 3.rb	
+++ b/scripts/Interpreter 3.rb	
@@ -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
diff --git a/scripts/Script.rb b/scripts/Script.rb
index 2468932..9f248d0 100644
--- a/scripts/Script.rb
+++ b/scripts/Script.rb
@@ -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