Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion game.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,15 @@ def do_move

def parse
# TODO: replace with a menu
description = 'Choose an option: '
description = 'M = Monster
H = Hospital
R = Room
X = Where you are
S = Shop
V = Vault
W = Win

Choose an option: '
directions = {
'up' => 'or w to go up',
'down' => 'or s to go down',
Expand Down
19 changes: 11 additions & 8 deletions map/random_creator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,17 @@ def self.consumable(difficulty = 0)
end

def self.consumable_stats(difficulty = 0)
Stats.new(consumable_stats_hash(difficulty))
Stats.new(stats_consumable(difficulty))
end

def self.consumable_stats_hash(difficulty = 0)
{ attack: (rand(-1..2) * difficulty_multiplier(difficulty)).to_i,
defence: (rand(-1..2) * difficulty_multiplier(difficulty)).to_i,
def self.stats_consumable(difficulty = 0)
attack = (rand(-1..2) * difficulty_multiplier(difficulty)).to_i
defence = (rand(-1..2) * difficulty_multiplier(difficulty)).to_i
hp = ( ( (attack == -1 || defence == -1) ? rand(1..5) : rand(-1..5) ) * difficulty_multiplier(difficulty)).to_i
{ attack: attack,
defence: defence,
coins: (rand(10..30) * difficulty_multiplier(difficulty)).to_i,
hp: (rand(-1..5) * difficulty_multiplier(difficulty)).to_i }
hp: hp }
end

def self.head(difficulty = 0)
Expand All @@ -94,8 +97,8 @@ def self.weapon(difficulty = 0)
end

def self.stats_equipment(difficulty = 0)
Stats.new(attack: (rand(0..5) * difficulty_multiplier(difficulty)).to_i,
defence: (rand(0..5) * difficulty_multiplier(difficulty)).to_i,
Stats.new(attack: (rand(1..5) * difficulty_multiplier(difficulty)).to_i,
defence: (rand(1..5) * difficulty_multiplier(difficulty)).to_i,
coins: (rand(10..30) * difficulty_multiplier(difficulty)).to_i)
end

Expand Down Expand Up @@ -149,6 +152,6 @@ def self.vault(difficulty = 0)
Vault.new(true, items)
end

# private :spawn_victory_room, :consumable_stats, :consumable_stats_hash
# private :spawn_victory_room, :consumable_stats, :stats_consumable
# private :stats_monster, :stats_equipment, :monster_name
end