gemwarrior 0.7.9 → 0.8.0

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
  SHA1:
3
- metadata.gz: 12fc722dae2f01988303b53b5e3a1c27f0a22487
4
- data.tar.gz: 502c5204a3625853f80b74f6e1951c767cda4c62
3
+ metadata.gz: 7a5c0f4d674fbc3b60e83d6e035c80c9830642b4
4
+ data.tar.gz: 83c0913aba4c0c8cb1449f1b0407fc2073866202
5
5
  SHA512:
6
- metadata.gz: f412d1d8c8e8ce60b653e35a858f12b177f756b4aac6cade2c9364b125b2745907118dd0264844166350132782ab75b24125283d1a94050e6e9e73e7ade17338
7
- data.tar.gz: 9cb728e2d038b00a55162fba7eb1689e5bad4e63dccd9a6fe8f33576e0588449e863d565e2a9fe15bec48e7fba104eb3e950ff8b9203b4b65360b8489b15968e
6
+ metadata.gz: 6df3ec5a685a5101167ed050417d5cc49da501740ef97f6ac644431e5f84d969b013cbd5eabd49bf3e1aff0f2ec1dd438a08523eb9d04be51a7f352d3c0792a1
7
+ data.tar.gz: 6fb339430b354569b3aca5cf2079a801eafd5a8ca588370a529bc76123bf9ec6d738e200457fe26d517a675e5b440353cb234ab56a14f113ef6cdd23131aa9a9
data/bin/gemwarrior CHANGED
File without changes
@@ -0,0 +1,76 @@
1
+ # lib/gemwarrior/arena.rb
2
+ # Arena series of battles
3
+
4
+ require_relative 'misc/player_levels'
5
+ require_relative 'battle'
6
+
7
+ module Gemwarrior
8
+ class Arena
9
+ attr_accessor :world, :player
10
+
11
+ def initialize(options)
12
+ self.world = options.fetch(:world)
13
+ self.player = options.fetch(:player)
14
+ end
15
+
16
+ def start
17
+ print_arena_intro
18
+
19
+ monsters_vanquished = 0
20
+
21
+ loop do
22
+ monster = generate_monster
23
+ battle = Battle.new({:world => self.world, :player => self.player, :monster => monster})
24
+ battle.start(is_arena = true)
25
+
26
+ monsters_vanquished += 1
27
+
28
+ puts 'Do you wish to continue fighting in the Arena? (Y/N)'
29
+ answer = gets.chomp.downcase
30
+
31
+ case answer
32
+ when 'yes', 'y'
33
+ next
34
+ else
35
+ bonus_rox = monsters_vanquished * 25
36
+ bonus_xp = monsters_vanquished * 10
37
+ player.rox = player.rox + bonus_rox
38
+ player.xp = player.xp + bonus_xp
39
+ puts 'You decided you\'ve had enough of the exhausting Arena for one day and exit the main stage.'
40
+ puts "You have gained #{bonus_rox} rox and #{bonus_xp} XP!"
41
+ return
42
+ end
43
+ end
44
+
45
+ print_arena_outro
46
+ end
47
+
48
+ private
49
+
50
+ def generate_monster
51
+ random_monster = nil
52
+
53
+ loop do
54
+ random_monster = world.monsters[rand(0..world.monsters.length-1)]
55
+
56
+ unless random_monster.is_boss
57
+ break
58
+ end
59
+ end
60
+
61
+ return random_monster.clone
62
+ end
63
+
64
+ def print_arena_intro
65
+ puts '**************************'.colorize(:red)
66
+ puts '* YOU ENTER THE ARENA!!! *'.colorize(:red)
67
+ puts '**************************'.colorize(:red)
68
+ end
69
+
70
+ def print_arena_outro
71
+ puts '**************************'.colorize(:red)
72
+ puts '* YOU LEAVE THE ARENA!!! *'.colorize(:red)
73
+ puts '**************************'.colorize(:red)
74
+ end
75
+ end
76
+ end
@@ -23,15 +23,26 @@ module Gemwarrior
23
23
  self.monster = options.fetch(:monster)
24
24
  end
25
25
 
26
- def start
26
+ def start(is_arena = nil, is_event = nil)
27
27
  print_battle_line
28
- puts "You decide to attack the #{monster.name}!"
28
+ binding.pry
29
+ if is_arena
30
+ print 'Your opponent is now...'
31
+ Animation::run({:phrase => "#{monster.name.upcase}!", :speed => :slow})
32
+ elsif is_event
33
+ puts "You are attacked by #{monster.name}!"
34
+ else
35
+ puts "You decide to attack #{monster.name}!"
36
+ end
37
+
29
38
  puts "#{monster.name} cries out: \"#{monster.battlecry}\"".colorize(:yellow)
30
39
 
31
40
  # first strike!
32
- if monster_strikes_first?
33
- puts "#{monster.name} strikes first!".colorize(:yellow)
34
- monster_attacks_player
41
+ unless is_arena
42
+ if monster_strikes_first?(is_event)
43
+ puts "#{monster.name} strikes first!".colorize(:yellow)
44
+ monster_attacks_player
45
+ end
35
46
  end
36
47
 
37
48
  # main battle loop
@@ -156,8 +167,8 @@ module Gemwarrior
156
167
  end
157
168
 
158
169
  # MONSTER
159
- def monster_strikes_first?
160
- if (monster.dexterity > player.dexterity)
170
+ def monster_strikes_first?(is_event = nil)
171
+ if (monster.dexterity > player.dexterity) || is_event
161
172
  return true
162
173
  else
163
174
  dex_diff = player.dexterity - monster.dexterity
@@ -35,7 +35,6 @@ module Gemwarrior
35
35
  return {:type => 'arena', :data => nil}
36
36
  else
37
37
  puts 'She gives you a dirty look, as you have obviously wasted her time. You are told not to mess around with her anymore, and she turns away from you.'
38
- puts
39
38
  return {:type => nil, :data => nil}
40
39
  end
41
40
  else
@@ -93,7 +93,7 @@ module Gemwarrior
93
93
 
94
94
  if chance_of_ambush < 25
95
95
  battle = Battle.new({:world => world, :player => self, :monster => cur_loc.monsters_abounding[rand(0..cur_loc.monsters_abounding.length-1)]})
96
- return battle.start
96
+ return battle.start(is_arena = false, is_event = true)
97
97
  end
98
98
  end
99
99
 
@@ -3,6 +3,8 @@
3
3
 
4
4
  require 'pry'
5
5
 
6
+ require_relative 'arena'
7
+
6
8
  module Gemwarrior
7
9
  class Evaluator
8
10
  # CONSTANTS
@@ -309,7 +311,9 @@ module Gemwarrior
309
311
  world.player.rest(world)
310
312
  end
311
313
  when 'arena'
312
- return 'You enter the arena and fight some battles. It was cool, but not as cool as if it were actually implemented.'
314
+ arena = Arena.new({:world => world, :player => world.player})
315
+ arena.start
316
+ #return 'You enter the arena and fight some battles. It was cool, but not as cool as if it were actually implemented.'
313
317
  else
314
318
  return
315
319
  end
@@ -46,7 +46,7 @@ module Gemwarrior
46
46
  :defense => start_stats[:defense],
47
47
  :dexterity => start_stats[:dexterity],
48
48
  :inventory => PLAYER_INVENTORY_DEFAULT,
49
- :rox => PLAYER_ROX_DEFAULT,
49
+ :rox => world.debug_mode ? 300 : PLAYER_ROX_DEFAULT,
50
50
  :cur_coords => world.location_coords_by_name('Home'),
51
51
 
52
52
  :god_mode => options.fetch(:god_mode),
@@ -2,5 +2,5 @@
2
2
  # Version of Gem Warrior
3
3
 
4
4
  module Gemwarrior
5
- VERSION = "0.7.9"
5
+ VERSION = "0.8.0"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gemwarrior
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.9
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Chadwick
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-24 00:00:00.000000000 Z
11
+ date: 2015-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: os
@@ -173,6 +173,7 @@ files:
173
173
  - bin/gemwarrior
174
174
  - data/locations.yml
175
175
  - gemwarrior.gemspec
176
+ - lib/gemwarrior/arena.rb
176
177
  - lib/gemwarrior/battle.rb
177
178
  - lib/gemwarrior/entities/boss.rb
178
179
  - lib/gemwarrior/entities/creature.rb
@@ -250,8 +251,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
250
251
  version: '0'
251
252
  requirements: []
252
253
  rubyforge_project:
253
- rubygems_version: 2.4.6
254
+ rubygems_version: 2.4.8
254
255
  signing_key:
255
256
  specification_version: 4
256
257
  summary: RPG as RubyGem
257
- test_files: []
258
+ test_files:
259
+ - spec/rubywarrior_spec.rb
260
+ - spec/spec_helper.rb