gemwarrior 0.12.7 → 0.12.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f8cb18496411a23c6f5cf358966ee637a54cf5af
4
- data.tar.gz: 36a10e8a5e4169918459421761eaf6531c25e152
3
+ metadata.gz: 87721fdd2ec0064a907a6178832b27955eecc508
4
+ data.tar.gz: 66045234ba9735ce29539b85bb0fa38392099151
5
5
  SHA512:
6
- metadata.gz: f431f5650418746bdad6a52e5cb12e2a9b37480fd79a21dca9866eaea193faeafbe766898973ea1770c0c7e9fc607659d7d1b3c9227e8d784b32c5106b692482
7
- data.tar.gz: fa4f06e96071517d917bc055e9471dd10720f37191921d96a068bd07c7c2ceb58c7fc0fd383d4721ff3e49eb6b4ad5acb63c5d51d2b5f4ce72178880dbef8e0a
6
+ metadata.gz: 8df7613868ebb152e5e2ddb9f8136840d67df56ce3bf50e0f9c91d0b1125aaef9bc0d760ad2bab386407f0168a9d10e65a82d3d280a6ba64cb41806d23487321
7
+ data.tar.gz: 18377d6edc2b4c575c70a13d4d7bda1f9d4babfd9879042d96e84a587de29adc4f986af0b5ecc069722f3b8342126afd56d07b4eea586052ce677bfc984bf94c
@@ -30,9 +30,8 @@ module Gemwarrior
30
30
  end
31
31
 
32
32
  def start(is_arena = false, is_event = false)
33
- Audio.play_synth(:battle_start)
34
-
35
33
  # begin battle!
34
+ Audio.play_synth(:battle_start)
36
35
  print_battle_header unless is_arena
37
36
 
38
37
  # print opponent announcement, depending on reason for battle
@@ -89,6 +88,7 @@ module Gemwarrior
89
88
  loop do
90
89
  skip_next_monster_attack = false
91
90
 
91
+ # 1. check for death to end battle
92
92
  if monster_dead?
93
93
  result = monster_death
94
94
  return result
@@ -97,35 +97,16 @@ module Gemwarrior
97
97
  return 'death'
98
98
  end
99
99
 
100
- # check for near death
101
- puts " You are almost dead!\n".colorize(:yellow) if player_near_death?
102
- puts " #{monster.name} is almost dead!\n".colorize(:yellow) if monster_near_death?
103
-
104
- puts
105
-
106
- # print health info
107
- print " #{player.name.upcase.ljust(12).colorize(:green)} :: #{player.hp_cur.to_s.rjust(3)} HP"
108
- print " (LVL: #{player.level})" if GameOptions.data['debug_mode']
109
- print "\n"
110
-
111
- print " #{monster.name.upcase.ljust(12).colorize(:red)} :: "
112
- if GameOptions.data['debug_mode'] || player.special_abilities.include?(:rocking_vision)
113
- print "#{monster.hp_cur.to_s.rjust(3)}"
114
- else
115
- print '???'
116
- end
117
- print ' HP'
118
- print " (LVL: #{monster.level})" if GameOptions.data['debug_mode']
119
- print "\n"
120
- puts
100
+ # 2. print general info and display options prompt
101
+ print_near_death_info
102
+ print_combatants_health_info
103
+ print_battle_options_prompt
121
104
 
105
+ # 3. get player action
122
106
  self.player_is_defending = false
123
-
124
- # battle options prompt
125
- print_battle_options
126
107
  player_action = STDIN.gets.chomp.downcase
127
108
 
128
- # player action
109
+ # 4. parse player action
129
110
  case player_action
130
111
  when 'fight', 'f', 'attack', 'a'
131
112
  can_attack = true
@@ -232,7 +213,7 @@ module Gemwarrior
232
213
  next
233
214
  end
234
215
 
235
- # monster action
216
+ # 5. parse monster action
236
217
  monster_attacks_player unless skip_next_monster_attack
237
218
  end
238
219
  end
@@ -581,6 +562,29 @@ module Gemwarrior
581
562
  end
582
563
 
583
564
  # STATUS TEXT
565
+ def print_near_death_info
566
+ puts " You are almost dead!\n".colorize(:yellow) if player_near_death?
567
+ puts " #{monster.name} is almost dead!\n".colorize(:yellow) if monster_near_death?
568
+ puts
569
+ end
570
+
571
+ def print_combatants_health_info
572
+ print " #{player.name.upcase.ljust(12).colorize(:green)} :: #{player.hp_cur.to_s.rjust(3)} HP"
573
+ print " (LVL: #{player.level})" if GameOptions.data['debug_mode']
574
+ print "\n"
575
+
576
+ print " #{monster.name.upcase.ljust(12).colorize(:red)} :: "
577
+ if GameOptions.data['debug_mode'] || player.special_abilities.include?(:rocking_vision)
578
+ print "#{monster.hp_cur.to_s.rjust(3)}"
579
+ else
580
+ print '???'
581
+ end
582
+ print ' HP'
583
+ print " (LVL: #{monster.level})" if GameOptions.data['debug_mode']
584
+ print "\n"
585
+ puts
586
+ end
587
+
584
588
  def print_escape_text
585
589
  print ' '
586
590
  Animation.run(phrase: ESCAPE_TEXT, oneline: false)
@@ -591,7 +595,7 @@ module Gemwarrior
591
595
  print "\n"
592
596
  end
593
597
 
594
- def print_battle_options
598
+ def print_battle_options_prompt
595
599
  puts ' What do you do?'
596
600
  print ' '
597
601
  print "#{'['.colorize(:yellow)}"
@@ -2,5 +2,5 @@
2
2
  # Version of Gem Warrior
3
3
 
4
4
  module Gemwarrior
5
- VERSION = '0.12.7'
5
+ VERSION = '0.12.8'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemwarrior
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.7
4
+ version: 0.12.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Chadwick