gemwarrior 0.12.7 → 0.12.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gemwarrior/battle.rb +33 -29
- data/lib/gemwarrior/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87721fdd2ec0064a907a6178832b27955eecc508
|
4
|
+
data.tar.gz: 66045234ba9735ce29539b85bb0fa38392099151
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8df7613868ebb152e5e2ddb9f8136840d67df56ce3bf50e0f9c91d0b1125aaef9bc0d760ad2bab386407f0168a9d10e65a82d3d280a6ba64cb41806d23487321
|
7
|
+
data.tar.gz: 18377d6edc2b4c575c70a13d4d7bda1f9d4babfd9879042d96e84a587de29adc4f986af0b5ecc069722f3b8342126afd56d07b4eea586052ce677bfc984bf94c
|
data/lib/gemwarrior/battle.rb
CHANGED
@@ -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
|
-
#
|
101
|
-
|
102
|
-
|
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
|
598
|
+
def print_battle_options_prompt
|
595
599
|
puts ' What do you do?'
|
596
600
|
print ' '
|
597
601
|
print "#{'['.colorize(:yellow)}"
|
data/lib/gemwarrior/version.rb
CHANGED