Puzzle code for demo, etc
This commit is contained in:
		
							parent
							
								
									917d320342
								
							
						
					
					
						commit
						0836769fca
					
				
					 4 changed files with 34 additions and 7 deletions
				
			
		| 
						 | 
					@ -1,7 +1,10 @@
 | 
				
			||||||
module Item
 | 
					module Item
 | 
				
			||||||
  COMBINATIONS = {
 | 
					  COMBINATIONS = {
 | 
				
			||||||
    [3, 4] => 5,
 | 
					    [3, 4] => 5, # alcohol + dry branch => wet branch
 | 
				
			||||||
    [25, 26] => 30,
 | 
					    [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)
 | 
					  def self.combine(item_a, item_b)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,6 +3,7 @@ class Game_Oneshot
 | 
				
			||||||
  # * Public Instance Variables
 | 
					  # * Public Instance Variables
 | 
				
			||||||
  #--------------------------------------------------------------------------
 | 
					  #--------------------------------------------------------------------------
 | 
				
			||||||
  attr_accessor :player_name              # map music (for battle memory)
 | 
					  attr_accessor :player_name              # map music (for battle memory)
 | 
				
			||||||
 | 
					  attr_accessor :plight_timer             # start of plight's plight
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def initialize
 | 
					  def initialize
 | 
				
			||||||
    user_name = Oneshot::USER_NAME.split(/\s+/)
 | 
					    user_name = Oneshot::USER_NAME.split(/\s+/)
 | 
				
			||||||
| 
						 | 
					@ -13,6 +14,7 @@ class Game_Oneshot
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    @lights = {}
 | 
					    @lights = {}
 | 
				
			||||||
    self.lang = Oneshot::LANG
 | 
					    self.lang = Oneshot::LANG
 | 
				
			||||||
 | 
					    @plight_timer = nil
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # lang
 | 
					  # lang
 | 
				
			||||||
| 
						 | 
					@ -29,9 +31,9 @@ class Game_Oneshot
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # MARSHAL
 | 
					  # MARSHAL
 | 
				
			||||||
  def marshal_dump
 | 
					  def marshal_dump
 | 
				
			||||||
    [@player_name, @lang]
 | 
					    [@player_name, @lang, @plight_timer]
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
  def marshal_load(array)
 | 
					  def marshal_load(array)
 | 
				
			||||||
    @player_name, self.lang = array
 | 
					    @player_name, self.lang, @plight_timer = array
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,12 +18,12 @@ class Interpreter
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Create full text string
 | 
					    # Create full text string
 | 
				
			||||||
    choices = false
 | 
					    choices = false
 | 
				
			||||||
    text = @list[@index].parameters[0].strip
 | 
					    text = @list[@index].parameters[0].rstrip
 | 
				
			||||||
    loop do
 | 
					    loop do
 | 
				
			||||||
      # 401: another line of text
 | 
					      # 401: another line of text
 | 
				
			||||||
      if @list[@index+1].code == 401
 | 
					      if @list[@index+1].code == 401
 | 
				
			||||||
        @index += 1
 | 
					        @index += 1
 | 
				
			||||||
        text << " " << @list[@index].parameters[0]
 | 
					        text << " " << @list[@index].parameters[0].rstrip
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
        # 102: show choices
 | 
					        # 102: show choices
 | 
				
			||||||
        if @list[@index+1].code == 102
 | 
					        if @list[@index+1].code == 102
 | 
				
			||||||
| 
						 | 
					@ -41,7 +41,7 @@ class Interpreter
 | 
				
			||||||
        break
 | 
					        break
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    text.gsub!(/\s+\\n\s+/, '\\n')
 | 
					    text.gsub!(/\s*\\n\s*/, '\\n')
 | 
				
			||||||
    text.strip!
 | 
					    text.strip!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Translate text
 | 
					    # Translate text
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -112,3 +112,25 @@ end
 | 
				
			||||||
def green_ambient
 | 
					def green_ambient
 | 
				
			||||||
  ambient -50, -50, -50
 | 
					  ambient -50, -50, -50
 | 
				
			||||||
end
 | 
					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
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue