mission_game 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6693b3fd864c6076f5501acbe1a51636ec8bda88482df2767607d93c4c545ed7
4
- data.tar.gz: 2e98d4176368889e203b0733b3920f9d5444e08cb8055d9ab22a77c92cf97b60
3
+ metadata.gz: d66722df3461198bda49db54f496e0437ec18a3c3e1a05c21e31ef0eca35f40f
4
+ data.tar.gz: bd28000d24248ce9081869a824cae1bffe7299338db144c31c6efda2230a7080
5
5
  SHA512:
6
- metadata.gz: 0dc12cd940de6d344a95a222a04643e51cad6807aae8872e79491d265e77696e9f088ee1dada232d8d3893d93981bb86315afd29b71cdf5db905c038f21f5190
7
- data.tar.gz: ec80d6c0b6281bccf392fa9c52ed9cca05638e1c9e3d87588aa20add9520bd243e277acc269843989547001ed6cddd3af5d28432a7bdf64ec2bca1e7b176199d
6
+ metadata.gz: 06473f5cf90a8de3cad9f83c6b6149074c8588deed51f6df57fcb0eaf9b9c76ebb05de03f7ff93eef7e9ee1a994a61f06f212667bfc4c325efd4474f659635b2
7
+ data.tar.gz: e93986a7c2eb38dd12fe6e81f751de0da6c071f75ad6688355850f2bf2d21af747288e313a20777c0385c1930db813442423a7394ab2a48ba535c140d80a6605
data/lib/enemy.rb CHANGED
@@ -5,18 +5,18 @@
5
5
 
6
6
  module MISSIONGAME
7
7
  ENEMY_CATALOG = [
8
- [name: 'Lucien Castle', lives: 3, bonus: 0, str: 3, points: 1],
9
- [name: 'Klaus Mikaelson', lives: 8, bonus: 8, str: 4, points: 10],
10
- [name: 'Damon Salvatore', lives: 5, bonus: 0, str: 4, points: 7],
11
- [name: 'Mikael', lives: 3, bonus: 2, str: 4, points: 6],
12
- [name: 'Taylor Lockwood', lives: 4, bonus: 0, str: 4, points: 2],
13
- [name: 'Marcel Gerard', lives: 7, bonus: 3, str: 5, points: 5],
14
- [name: 'Dahlia', lives: 2, bonus: 6, str: 1, points: 2],
15
- [name: 'The Hollow', lives: 5, bonus: 0, str: 4, points: 3],
16
- [name: 'Celeste Dubois', lives: 3, bonus: 10, str: 2, points: 5]
8
+ [name: "Lucien Castle", lives: 3, bonus: 0, str: 3, points: 1],
9
+ [name: "Klaus Mikaelson", lives: 8, bonus: 8, str: 4, points: 10],
10
+ [name: "Damon Salvatore", lives: 5, bonus: 0, str: 4, points: 7],
11
+ [name: "Mikael", lives: 3, bonus: 2, str: 4, points: 6],
12
+ [name: "Taylor Lockwood", lives: 4, bonus: 0, str: 4, points: 2],
13
+ [name: "Marcel Gerard", lives: 7, bonus: 3, str: 5, points: 5],
14
+ [name: "Dahlia", lives: 2, bonus: 6, str: 1, points: 2],
15
+ [name: "The Hollow", lives: 5, bonus: 0, str: 4, points: 3],
16
+ [name: "Celeste Dubois", lives: 3, bonus: 10, str: 2, points: 5]
17
17
  ]
18
18
 
19
- PLAYER_DEAD = 'PLAYER_DEAD'
19
+ PLAYER_DEAD = "PLAYER_DEAD"
20
20
 
21
21
  class Enemy
22
22
  attr_accessor :name
@@ -46,11 +46,11 @@ module MISSIONGAME
46
46
  str_diff = (enemy.str - player.str) * 2
47
47
  hit_chance = rand(1...100) + str_diff
48
48
 
49
- if (hit_chance > 30)
49
+ if hit_chance > 30
50
50
  # Determine value of the attack
51
51
  attack_value = rand(1...player.str)
52
- print enemy.name.light_red + ' hits you for ' +
53
- attack_value.to_s.light_yellow + " damage(s)!\n"
52
+ print enemy.name.light_red + " hits you for " +
53
+ attack_value.to_s.light_yellow + " damage(s)!\n"
54
54
  if attack_value > player.lives
55
55
  return PLAYER_DEAD
56
56
  else
@@ -59,7 +59,7 @@ module MISSIONGAME
59
59
  else
60
60
  print enemy.name.light_red + " sees you as an easy prey!\n"
61
61
  end
62
- return true
62
+ true
63
63
  end
64
64
  end
65
65
  end
data/lib/main.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Written by Webster AVosa
4
4
 
5
- MISSIONGAME_VERSION = '1.00'
5
+ MISSIONGAME_VERSION = "1.00"
6
6
 
7
7
  # Create a new UI and New Orleans
8
8
  ui = MISSIONGAME::UI.new
@@ -13,15 +13,17 @@ ui.clear
13
13
  ui.welcome
14
14
 
15
15
  # Ask name
16
- name = ui.ask('What is your name?', /\w/)
16
+ name = ui.ask("What is your name?", /\w/)
17
17
 
18
18
  # Create a new player
19
- player = MISSIONGAME::Player.new({ name: name, neworleans: neworleans })
19
+ player = MISSIONGAME::Player.new({name: name, neworleans: neworleans})
20
20
 
21
21
  # Show intro story
22
22
  ui.new_line
23
23
  story = MISSIONGAME::Story.new
24
- ui.draw_frame({ text: story.intro })
24
+ ui.draw_frame({text: story.intro})
25
+ map = neworleans.get_map({player: player})
26
+ ui.draw_frame({text: map})
25
27
 
26
28
  # MAIN INPUT LOOP
27
29
  running = 1
@@ -31,64 +33,56 @@ while running
31
33
  # Get command from user
32
34
  cmd = ui.get_cmd
33
35
  case cmd
34
- when '~'
36
+ when "~"
35
37
  binding.pry
36
- when 'map', 'm'
37
- map = neworleans.get_map({ player: player })
38
- ui.draw_frame({ text: map })
39
- when 'version', 'ver'
38
+ when "map", "m"
39
+ map = neworleans.get_map({player: player})
40
+ ui.draw_frame({text: map})
41
+ when "version", "ver"
40
42
  ui.display_version
41
- when 'clear', 'cls'
43
+ when "clear", "cls", "c"
42
44
  ui.clear
43
- when 'name', 'whoami'
44
- ui.display_name({ player: player })
45
- when 'location', 'loc', 'where', 'whereami'
46
- ui.show_location({ player: player })
47
- when 'look', 'what', 'around'
48
- neworleans.check_area({ player: player, ui: ui, story: story })
49
- when 'forward', 'f'
50
- unless player.in_combat
51
- if !player.move(
52
- { direction: :up, neworleans: neworleans, ui: ui, story: story }
53
- )
54
- player.in_combat = 1
55
- end
56
- else
45
+ when "name", "whoami"
46
+ ui.display_name({player: player})
47
+ when "location", "loc", "where", "whereami"
48
+ ui.show_location({player: player})
49
+ when "look", "what", "around"
50
+ neworleans.check_area({player: player, ui: ui, story: story})
51
+ when "forward", "f"
52
+ if player.in_combat
57
53
  ui.cannot_travel_combat
54
+ elsif !player.move(
55
+ {direction: :up, neworleans: neworleans, ui: ui, story: story}
56
+ )
57
+ player.in_combat = 1
58
58
  end
59
- when 'backward', 'b'
60
- unless player.in_combat
61
- if !player.move(
62
- { direction: :down, neworleans: neworleans, ui: ui, story: story }
63
- )
64
- player.in_combat = 1
65
- end
66
- else
59
+ when "backward", "b"
60
+ if player.in_combat
67
61
  ui.cannot_travel_combat
62
+ elsif !player.move(
63
+ {direction: :down, neworleans: neworleans, ui: ui, story: story}
64
+ )
65
+ player.in_combat = 1
68
66
  end
69
- when 'left', 'l'
70
- unless player.in_combat
71
- if !player.move(
72
- { direction: :left, neworleans: neworleans, ui: ui, story: story }
73
- )
74
- player.in_combat = 1
75
- end
76
- else
67
+ when "left", "l"
68
+ if player.in_combat
77
69
  ui.cannot_travel_combat
70
+ elsif !player.move(
71
+ {direction: :left, neworleans: neworleans, ui: ui, story: story}
72
+ )
73
+ player.in_combat = 1
78
74
  end
79
- when 'right', 'r'
80
- unless player.in_combat
81
- if !player.move(
82
- { direction: :right, neworleans: neworleans, ui: ui, story: story }
83
- )
84
- player.in_combat = 1
85
- end
86
- else
75
+ when "right", "r"
76
+ if player.in_combat
87
77
  ui.cannot_travel_combat
78
+ elsif !player.move(
79
+ {direction: :right, neworleans: neworleans, ui: ui, story: story}
80
+ )
81
+ player.in_combat = 1
88
82
  end
89
- when 'attack', 'a'
83
+ when "attack", "a"
90
84
  if player.in_combat
91
- retval = player.attack({ enemy: player.current_enemy, ui: ui })
85
+ retval = player.attack({enemy: player.current_enemy, ui: ui})
92
86
  if retval == MISSIONGAME::ENEMY_KILLED
93
87
  player.points += player.current_enemy.points
94
88
 
@@ -102,24 +96,24 @@ while running
102
96
  end
103
97
  if retval.is_a? Numeric
104
98
  player.current_enemy.lives -= retval
105
- retval = player.current_enemy.attack({ player: player })
99
+ retval = player.current_enemy.attack({player: player})
106
100
  player.lives -= retval if retval.is_a? Numeric
107
101
  player.dead = 1 if retval == MISSIONGAME::PLAYER_DEAD
108
102
  end
109
103
  else
110
104
  ui.not_in_combat
111
105
  end
112
- when 'player', 'me', 'info', 'status', 'i'
113
- ui.player_info({ player: player })
114
- when 'enemy'
115
- player.in_combat ? ui.enemy_info({ player: player }) : ui.not_in_combat
116
- when 'points', 'score'
117
- ui.points({ player: player })
118
- when 'suicide'
106
+ when "player", "me", "info", "status", "i"
107
+ ui.player_info({player: player})
108
+ when "enemy"
109
+ player.in_combat ? ui.enemy_info({player: player}) : ui.not_in_combat
110
+ when "points", "score"
111
+ ui.points({player: player})
112
+ when "suicide"
119
113
  player.dead = 1
120
- when 'help', 'h', '?'
114
+ when "help", "h", "?"
121
115
  ui.help
122
- when 'quit', 'q', 'exit'
116
+ when "quit", "q", "exit"
123
117
  ui.quit
124
118
  running = nil
125
119
  else
@@ -130,18 +124,18 @@ while running
130
124
  if player.in_combat && !player.current_enemy
131
125
  enemy = MISSIONGAME::Enemy.new
132
126
  player.current_enemy = enemy
133
- ui.enemy_greet({ enemy: enemy })
127
+ ui.enemy_greet({enemy: enemy})
134
128
  end
135
129
 
136
130
  # Player is dead!
137
131
  if player.dead == 1
138
- ui.player_dead({ story: story })
132
+ ui.player_dead({story: story})
139
133
  exit
140
134
  end
141
135
 
142
136
  # If player has reached the Witch
143
137
  if player.x == MISSIONGAME::MAP_WIDTH && player.y == 1
144
- ui.draw_frame({ text: story.ending })
138
+ ui.draw_frame({text: story.ending})
145
139
  ui.new_line
146
140
  running = false
147
141
  end
data/lib/neworleans.rb CHANGED
@@ -52,23 +52,23 @@ module MISSIONGAME
52
52
  # Return map data in a display format
53
53
  def get_map(args)
54
54
  player = args[:player]
55
- buffer = Array.new
55
+ buffer = []
56
56
  x = 1
57
57
  y = 1
58
58
  @the_map.each do |row|
59
- tmp_row = Array.new
59
+ tmp_row = []
60
60
  x = 1
61
61
  row.each do |col|
62
62
  placed = 0
63
63
 
64
64
  # Place WITCH
65
- if x == MAP_WITCH_X and y == MAP_WITCH_Y
65
+ if x == MAP_WITCH_X && y == MAP_WITCH_Y
66
66
  tmp_row << MAP_KEY_WITCH.colorize(color: :white, background: :red)
67
67
  placed = 1
68
68
  end
69
69
 
70
70
  # If player is here, display them
71
- if x == player.x and y == player.y
71
+ if x == player.x && y == player.y
72
72
  tmp_row << MAP_KEY_PLAYER.colorize(color: :red, background: :white)
73
73
  placed = 1
74
74
  end
@@ -94,7 +94,7 @@ module MISSIONGAME
94
94
  y += 1
95
95
  end
96
96
 
97
- return buffer
97
+ buffer
98
98
  end
99
99
 
100
100
  # Check the current area on the map and describe it
@@ -107,16 +107,16 @@ module MISSIONGAME
107
107
  current_area = @the_map[y - 1][x - 1]
108
108
  case current_area
109
109
  when MAP_KEY_TREE
110
- ui.draw_frame({ text: story.area_tree })
110
+ ui.draw_frame({text: story.area_tree})
111
111
  when MAP_KEY_WATER
112
- ui.draw_frame({ text: story.area_water })
112
+ ui.draw_frame({text: story.area_water})
113
113
  when MAP_KEY_MOUNTAIN
114
- ui.draw_frame({ text: story.area_mountain })
114
+ ui.draw_frame({text: story.area_mountain})
115
115
  when MAP_KEY_ENEMY
116
- ui.draw_frame({ text: story.area_enemy })
116
+ ui.draw_frame({text: story.area_enemy})
117
117
  return false
118
118
  end
119
- return true
119
+ true
120
120
  end
121
121
 
122
122
  private
@@ -127,11 +127,11 @@ module MISSIONGAME
127
127
 
128
128
  # Create a random new orleans map
129
129
  def generate_map
130
- tmp_map = Array.new
130
+ tmp_map = []
131
131
 
132
132
  # Step through MAX_HEIGHT times
133
133
  MAP_HEIGHT.times do
134
- tmp_row = Array.new
134
+ tmp_row = []
135
135
  MAP_WIDTH.times { tmp_row << MAP_POSSIBLE_KEYS.sample }
136
136
 
137
137
  # Add our assembled row to the map
data/lib/player.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  # Written by Webster Avosa
4
4
 
5
5
  module MISSIONGAME
6
- ENEMY_KILLED = 'KILLED'
6
+ ENEMY_KILLED = "KILLED"
7
7
 
8
8
  HIT_CHANCE_MODIFIER = 5
9
9
  ATTACK_VALUE_MODIFIER = 1
@@ -37,7 +37,7 @@ module MISSIONGAME
37
37
  @current_enemy = nil
38
38
  @points = 0
39
39
  @dead = 0
40
- return "Welcome %{name}! Let's play!"
40
+ "Welcome %{name}! Let's play!"
41
41
  end
42
42
 
43
43
  # Player attacks enemy
@@ -49,32 +49,32 @@ module MISSIONGAME
49
49
  # Does the player even hit the enemy?
50
50
  # We could use a hit chance stat here, but since we don't have one,
51
51
  # we'll just base it off the player/enemy stength discrepency.
52
- ui.enemy_info({ player: player })
53
- ui.player_info({ player: player })
52
+ ui.enemy_info({player: player})
53
+ ui.player_info({player: player})
54
54
  str_diff = (player.str - enemy.str) * 2
55
55
  hit_chance = rand(1...100) + str_diff + HIT_CHANCE_MODIFIER
56
56
 
57
- if (hit_chance > 50)
57
+ if hit_chance > 50
58
58
  # Determine value of the attack
59
59
  attack_value = rand(1...player.str) + ATTACK_VALUE_MODIFIER
60
60
  if attack_value > enemy.lives
61
- print 'You fought for your life and ' + 'hit'.light_yellow + ' ' +
62
- enemy.name.light_red + ' for ' +
63
- attack_value.to_s.light_white + " damages, killing him!\n"
64
- print 'You gain ' + enemy.points.to_s.light_white + " points.\n"
65
- return ENEMY_KILLED
61
+ print "You fought for your life and " + "hit".light_yellow + " " +
62
+ enemy.name.light_red + " for " +
63
+ attack_value.to_s.light_white + " damages, killing him!\n"
64
+ print "You gain " + enemy.points.to_s.light_white + " points.\n"
65
+ ENEMY_KILLED
66
66
  else
67
- print 'You fought for your life and ' + 'hit'.light_yellow + ' ' +
68
- enemy.name.light_red + ' for ' +
69
- attack_value.to_s.light_white + " damages, killing him!\n"
70
- return attack_value
67
+ print "You fought for your life and " + "hit".light_yellow + " " +
68
+ enemy.name.light_red + " for " +
69
+ attack_value.to_s.light_white + " damages, killing him!\n"
70
+ attack_value
71
71
  end
72
72
  else
73
- print 'You fought for your life and ' + 'missed'.light_red + ' ' +
74
- enemy.name + "!\n"
75
- return 0
73
+ print "You fought for your life and " + "missed".light_red + " " +
74
+ enemy.name + "!\n"
75
+ 0
76
76
  end
77
- return true
77
+ true
78
78
  end
79
79
 
80
80
  def move(args)
@@ -112,10 +112,10 @@ module MISSIONGAME
112
112
  return false
113
113
  end
114
114
  end
115
- unless neworleans.check_area({ player: self, ui: ui, story: story })
116
- return false
115
+ if neworleans.check_area({player: self, ui: ui, story: story})
116
+ true
117
117
  else
118
- return true
118
+ false
119
119
  end
120
120
  end
121
121
  end
data/lib/story.rb CHANGED
@@ -5,77 +5,77 @@
5
5
 
6
6
  module MISSIONGAME
7
7
  STORY_INTRO = [
8
- 'This is a game based on the movie series,' + 'The Originals'.light_green +
8
+ "This is a game based on the movie series," + "The Originals".light_green +
9
9
  ", that has it's setting in New Orleans, Louisiana, United States.",
10
- 'Your mission is to meet ' + 'Davina Clare'.light_white +
11
- ' a very powerful witch of New Orleans, and free her.',
12
- 'She is currently hostaged by the vampirers under the reign of Klaus Mikaelson.',
10
+ "Your mission is to meet " + "Davina Clare".light_white +
11
+ " a very powerful witch of New Orleans, and free her.",
12
+ "She is currently hostaged by the vampirers under the reign of Klaus Mikaelson.",
13
13
  "She will provide you answers of all the questions you've always wanted to know.",
14
- '',
15
- 'To get stated you will find a ' + 'map'.light_white +
16
- ' in the Mystic Falls of Virginia.',
17
- 'Understanding the map will be key to reaching the destination'
14
+ "",
15
+ "To get stated you will find a " + "map".light_white +
16
+ " in the Mystic Falls of Virginia.",
17
+ "Understanding the map will be key to reaching the destination"
18
18
  ]
19
19
 
20
20
  STORY_AREA_TREE = [
21
- 'Take a selfie of you before encountering a bloody scene lol.'
21
+ "Take a selfie of you before encountering a bloody scene lol."
22
22
  ]
23
23
 
24
- STORY_AREA_WATER = ['You just got close to Mississippi River.']
24
+ STORY_AREA_WATER = ["You just got close to Mississippi River."]
25
25
 
26
26
  STORY_AREA_MOUNTAIN = [
27
- 'A cool place to get yourself a beer before continuing with your mission.'
27
+ "A cool place to get yourself a beer before continuing with your mission."
28
28
  ]
29
29
 
30
- STORY_AREA_VILLAINE = ['You encountered a hungry vampire!']
30
+ STORY_AREA_VILLAINE = ["You encountered a hungry vampire!"]
31
31
 
32
32
  STORY_PLAYER_DEAD = [
33
- 'You have been fed on.',
34
- '',
35
- 'You failed to reach the witch. Please try again.'
33
+ "You have been fed on.",
34
+ "",
35
+ "You failed to reach the witch. Please try again."
36
36
  ]
37
37
 
38
38
  STORY_END = [
39
39
  "You've reached Davina Clare, the powerful witch!".light_white,
40
- '',
41
- 'She stares at you and utters',
42
- '',
40
+ "",
41
+ "She stares at you and utters",
42
+ "",
43
43
  "I can't imagine the time has finally come".light_yellow,
44
- 'This is going to be the end of dominance by vampires becuase this is your kingdom'
44
+ "This is going to be the end of dominance by vampires becuase this is your kingdom"
45
45
  .light_yellow,
46
- 'you are special and powerful.'.light_yellow,
47
- '',
48
- 'THANK YOU FOR PLAYING!'.light_red,
49
- ''
46
+ "you are special and powerful.".light_yellow,
47
+ "",
48
+ "THANK YOU FOR PLAYING!".light_red,
49
+ ""
50
50
  ]
51
51
 
52
52
  class Story
53
53
  def intro
54
- return STORY_INTRO
54
+ STORY_INTRO
55
55
  end
56
56
 
57
57
  def ending
58
- return STORY_END
58
+ STORY_END
59
59
  end
60
60
 
61
61
  def area_tree
62
- return STORY_AREA_TREE
62
+ STORY_AREA_TREE
63
63
  end
64
64
 
65
65
  def area_water
66
- return STORY_AREA_WATER
66
+ STORY_AREA_WATER
67
67
  end
68
68
 
69
69
  def area_mountain
70
- return STORY_AREA_MOUNTAIN
70
+ STORY_AREA_MOUNTAIN
71
71
  end
72
72
 
73
73
  def area_enemy
74
- return STORY_AREA_VILLAINE
74
+ STORY_AREA_VILLAINE
75
75
  end
76
76
 
77
77
  def player_dead
78
- return STORY_PLAYER_DEAD
78
+ STORY_PLAYER_DEAD
79
79
  end
80
80
  end
81
81
  end
data/lib/ui.rb CHANGED
@@ -24,70 +24,70 @@ module MISSIONGAME
24
24
  def display_map(args)
25
25
  map = args[:map]
26
26
  new_line
27
- draw_frame({ text: map })
27
+ draw_frame({text: map})
28
28
  new_line
29
29
  end
30
30
 
31
31
  def help
32
32
  new_line
33
- print 'Valid Commands'.light_green
33
+ print "Valid Commands".light_green
34
34
  new_line(2)
35
- print UI_ARROW.light_yellow + ' ' + 'right, r, '.light_white +
36
- ++' - Move right/east'
35
+ print UI_ARROW.light_yellow + " " + "right, r, ".light_white +
36
+ ++" - Move right/east"
37
37
  new_line
38
- print UI_ARROW.light_yellow + ' ' + 'backward, b, '.light_white +
39
- ++' - Move backward/south'
38
+ print UI_ARROW.light_yellow + " " + "backward, b, ".light_white +
39
+ ++" - Move backward/south"
40
40
  new_line
41
- print UI_ARROW.light_yellow + ' ' + 'left, l, '.light_white +
42
- ++' - Move left/west'
41
+ print UI_ARROW.light_yellow + " " + "left, l, ".light_white +
42
+ ++" - Move left/west"
43
43
  new_line
44
- print UI_ARROW.light_yellow + ' ' + 'forward, f, '.light_white +
45
- ++' - Move forward/north'
44
+ print UI_ARROW.light_yellow + " " + "forward, f, ".light_white +
45
+ ++" - Move forward/north"
46
46
  new_line
47
- print UI_ARROW.light_yellow + ' ' + 'map, m'.light_white + ' - Display map'
47
+ print UI_ARROW.light_yellow + " " + "map, m".light_white + " - Display map"
48
48
  new_line
49
- print UI_ARROW.light_yellow + ' ' + 'where'.light_white +
50
- ' - Describe current surroundings'
49
+ print UI_ARROW.light_yellow + " " + "where".light_white +
50
+ " - Describe current surroundings"
51
51
  new_line
52
- print UI_ARROW.light_yellow + ' ' + 'name'.light_white +
53
- ' - Reminds player their name'
52
+ print UI_ARROW.light_yellow + " " + "name".light_white +
53
+ " - Reminds player their name"
54
54
  new_line
55
- print UI_ARROW.light_yellow + ' ' + 'a, attack'.light_white +
56
- ' - Attack (only in combat)'
55
+ print UI_ARROW.light_yellow + " " + "a, attack".light_white +
56
+ " - Attack (only in combat)"
57
57
  new_line
58
- print UI_ARROW.light_yellow + ' ' + 'enemy'.light_white +
59
- ' - Display information about your enemy'
58
+ print UI_ARROW.light_yellow + " " + "enemy".light_white +
59
+ " - Display information about your enemy"
60
60
  new_line
61
- print UI_ARROW.light_yellow + ' ' +
62
- 'points, score, status, info'.light_white +
63
- ' - Display points (score)'
61
+ print UI_ARROW.light_yellow + " " +
62
+ "points, score, status, info".light_white +
63
+ " - Display points (score)"
64
64
  new_line
65
- print UI_ARROW.light_yellow + ' ' + 'clear, cls'.light_white +
66
- ' - Clears the screen'
65
+ print UI_ARROW.light_yellow + " " + "clear, cls".light_white +
66
+ " - Clears the screen"
67
67
  new_line
68
- print UI_ARROW.light_yellow + ' ' + 'q, quit, exit'.light_white +
69
- ' - Quits the MISSIONGAME'
68
+ print UI_ARROW.light_yellow + " " + "q, quit, exit".light_white +
69
+ " - Quits the MISSIONGAME"
70
70
  new_line
71
71
  end
72
72
 
73
73
  def points(args)
74
74
  player = args[:player]
75
- print 'You currently have ' + player.points.to_s.light_white + ' points.'
75
+ print "You currently have " + player.points.to_s.light_white + " points."
76
76
  new_line
77
77
  end
78
78
 
79
79
  def enemy_info(args)
80
80
  player = args[:player]
81
81
  enemy = player.current_enemy
82
- print enemy.name.light_red + ' has ' + enemy.str.to_s.light_white +
83
- ' strength and ' + enemy.lives.to_s.light_white + ' lives.'
82
+ print enemy.name.light_red + " has " + enemy.str.to_s.light_white +
83
+ " strength and " + enemy.lives.to_s.light_white + " lives."
84
84
  new_line
85
85
  end
86
86
 
87
87
  def player_info(args)
88
88
  player = args[:player]
89
- print 'You have ' + player.lives.to_s.light_white + ' lives and have ' +
90
- player.points.to_s.light_white + ' points.'
89
+ print "You have " + player.lives.to_s.light_white + " lives and have " +
90
+ player.points.to_s.light_white + " points."
91
91
  new_line
92
92
  end
93
93
 
@@ -97,40 +97,40 @@ module MISSIONGAME
97
97
  match = false
98
98
  answer = nil
99
99
  while match == false
100
- print UI_ARROW.red + question.light_white + ' '
100
+ print UI_ARROW.red + question.light_white + " "
101
101
  answer = gets.chomp
102
102
  if answer.match(filter)
103
103
  return answer
104
104
  else
105
- print 'Sorry, please try again.'.red
105
+ print "Sorry, please try again.".red
106
106
  new_line
107
107
  new_line
108
108
  end
109
109
  end
110
110
  else
111
- print "\u2712 ".red + question.light_white + ' '
112
- input = gets.chomp
113
- return input
111
+ print "\u2712 ".red + question.light_white + " "
112
+ gets.chomp
113
+
114
114
  end
115
115
  end
116
116
 
117
117
  # Display welcome
118
118
  def welcome
119
- text = Array.new
119
+ text = []
120
120
  text <<
121
- 'This is a text adventure game inspired by the movie series '.white +
122
- 'The Originals'.light_green
121
+ "This is a text adventure game inspired by the movie series ".white +
122
+ "The Originals".light_green
123
123
  text <<
124
- 'Written by: '.white +
125
- 'Webster Avosa'.light_green
124
+ "Written by: ".white +
125
+ "Webster Avosa".light_green
126
126
  text <<
127
- 'Copyright ' + UI_COPYRIGHT +
128
- ' Webster Avosa, All Rights Reserved.'.white
129
- text << 'Licensed under MIT.'.white
127
+ "Copyright " + UI_COPYRIGHT +
128
+ " Webster Avosa, All Rights Reserved.".white
129
+ text << "Licensed under MIT.".white
130
130
  text <<
131
- 'Contact me '.white + UI_EMAIL.light_white +
132
- ' websterb17@gmail.com'.white
133
- draw_frame({ text: text })
131
+ "Contact me ".white + UI_EMAIL.light_white +
132
+ " websterb17@gmail.com".white
133
+ draw_frame({text: text})
134
134
  new_line
135
135
  end
136
136
 
@@ -148,12 +148,12 @@ module MISSIONGAME
148
148
  text.each do |t|
149
149
  t_size = get_real_size(t)
150
150
  draw_vert_frame_begin
151
- if t.kind_of?(Array)
151
+ if t.is_a?(Array)
152
152
  t.each { |s| print s }
153
153
  else
154
154
  print t
155
155
  end
156
- (width - (t_size + 4)).times { print ' ' }
156
+ (width - (t_size + 4)).times { print " " }
157
157
  draw_vert_frame_end
158
158
  new_line
159
159
  end
@@ -161,22 +161,22 @@ module MISSIONGAME
161
161
  end
162
162
 
163
163
  def display_version
164
- puts ' Version ' + MISSIONMISSIONGAME_VERSION.light_white
164
+ puts " Version " + MISSIONMISSIONGAME_VERSION.light_white
165
165
  new_line
166
166
  end
167
167
 
168
168
  def not_found
169
- print 'Command not understood. Use the ' + 'help or h'.red +
170
- ' to see available commands.'.light_white
169
+ print "Command not understood. Use the " + "help or h".red +
170
+ " to see available commands.".light_white
171
171
  new_line
172
172
  end
173
173
 
174
174
  def show_location(args)
175
175
  player = args[:player]
176
- print 'You are currently on row ' + player.y.to_s.light_white +
177
- ', column ' + player.x.to_s.light_white
176
+ print "You are currently on row " + player.y.to_s.light_white +
177
+ ", column " + player.x.to_s.light_white
178
178
  new_line
179
- print 'Use the ' + 'map'.light_white + ' command to see the map.'
179
+ print "Use the " + "map".light_white + " command to see the map."
180
180
  new_line
181
181
  end
182
182
 
@@ -185,31 +185,31 @@ module MISSIONGAME
185
185
  end
186
186
 
187
187
  def not_in_combat
188
- puts 'No vampire has attacked you just yet.'
188
+ puts "No vampire has attacked you just yet."
189
189
  end
190
190
 
191
191
  def quit
192
192
  new_line
193
- print 'You abandoned your journey to getting answers to all of your many unaswered questions.'
194
- .red
193
+ print "You abandoned your journey to getting answers to all of your many unaswered questions."
194
+ .red
195
195
  new_line(2)
196
196
  end
197
197
 
198
198
  def get_cmd
199
- print 'Type '.white + 'help'.light_white + " for possible commands.\n"
200
- print "\u2712 ".red + 'Your command? '.light_white
201
- return gets.chomp.downcase
199
+ print "Type ".white + "help".light_white + " for possible commands.\n"
200
+ print "\u2712 ".red + "Your command? ".light_white
201
+ gets.chomp.downcase
202
202
  end
203
203
 
204
204
  def out_of_bounds
205
- print 'x'.red + ' Requested move out of bounds.'
205
+ print "x".red + " Requested move out of bounds."
206
206
  new_line
207
207
  end
208
208
 
209
209
  def display_name(args)
210
210
  player = args[:player]
211
- print 'You are ' + player.name.light_white +
212
- '. Have you forgotten your own name?'
211
+ print "You are " + player.name.light_white +
212
+ ". Have you forgotten your own name?"
213
213
  new_line
214
214
  end
215
215
 
@@ -223,18 +223,18 @@ module MISSIONGAME
223
223
 
224
224
  def enemy_greet(args)
225
225
  enemy = args[:enemy]
226
- print enemy.name.light_white + ' attacks!'
226
+ print enemy.name.light_white + " attacks!"
227
227
  new_line
228
228
  end
229
229
 
230
230
  private
231
231
 
232
232
  def draw_vert_frame_begin
233
- print UI_FRAME_VERTICAL.yellow + ' '
233
+ print UI_FRAME_VERTICAL.yellow + " "
234
234
  end
235
235
 
236
236
  def draw_vert_frame_end
237
- print ' ' + UI_FRAME_VERTICAL.yellow
237
+ print " " + UI_FRAME_VERTICAL.yellow
238
238
  end
239
239
 
240
240
  def draw_top_frame(width)
@@ -253,7 +253,7 @@ module MISSIONGAME
253
253
 
254
254
  # Returns actual length of text accounting for UTF-8 and ANSI
255
255
  def get_real_size(text)
256
- text.kind_of?(Array) ? text.size : text.uncolorize.size
256
+ text.is_a?(Array) ? text.size : text.uncolorize.size
257
257
  end
258
258
 
259
259
  # Returns size of longest string in array
data/mission_game.rb CHANGED
@@ -2,40 +2,40 @@
2
2
  #
3
3
  # Written by Webster Avosa
4
4
 
5
- GAME_VERSION = '1.00'
5
+ GAME_VERSION = "1.00"
6
6
 
7
7
  begin
8
- require 'colorize'
9
- require 'pry'
8
+ require "colorize"
9
+ require "pry"
10
10
  rescue LoadError
11
11
  puts
12
12
  puts "This game requires the 'colorize' and 'pry' gem to run."
13
13
  puts
14
- puts 'Installation Instructions'
15
- puts '-------------------------'
14
+ puts "Installation Instructions"
15
+ puts "-------------------------"
16
16
  puts
17
- puts 'Debian/Ubuntu Linux:'
18
- puts ' sudo apt install ruby-colorize && sudo apt install pry'
17
+ puts "Debian/Ubuntu Linux:"
18
+ puts " sudo apt install ruby-colorize && sudo apt install pry"
19
19
  puts
20
- puts 'Other Linux Distros:'
21
- puts ' gem install colorize && gem install pry'
20
+ puts "Other Linux Distros:"
21
+ puts " gem install colorize && gem install pry"
22
22
  puts
23
- puts 'Windows:'
24
- puts ' gem install colorize && gem install pry'
23
+ puts "Windows:"
24
+ puts " gem install colorize && gem install pry"
25
25
  puts
26
- puts 'macOS:'
27
- puts ' gem install colorize && gem install pry'
26
+ puts "macOS:"
27
+ puts " gem install colorize && gem install pry"
28
28
  puts
29
29
  puts
30
30
  exit
31
31
  end
32
32
 
33
33
  # Require libraries
34
- load 'lib/ui.rb'
35
- load 'lib/neworleans.rb'
36
- load 'lib/player.rb'
37
- load 'lib/story.rb'
38
- load 'lib/enemy.rb'
34
+ load "lib/ui.rb"
35
+ load "lib/neworleans.rb"
36
+ load "lib/player.rb"
37
+ load "lib/story.rb"
38
+ load "lib/enemy.rb"
39
39
 
40
40
  # Start
41
- load 'lib/main.rb'
41
+ load "lib/main.rb"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mission_game
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Webster Avosa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-12 00:00:00.000000000 Z
11
+ date: 2022-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize