Class: Gemwarrior::Emerald

Inherits:
Monster show all
Defined in:
lib/gemwarrior/entities/monsters/bosses/emerald.rb

Constant Summary collapse

MOVE_TEXT =

CONSTANTS

'** WHOOOOOOSH **'

Constants inherited from Monster

Monster::ITEM_POOL

Instance Attribute Summary

Attributes inherited from Monster

#battlecry, #is_boss, #is_dead

Attributes inherited from Creature

#atk_hi, #atk_lo, #defense, #dexterity, #face, #hands, #hp_cur, #hp_max, #inventory, #level, #mood, #rox, #speak, #use, #xp

Attributes inherited from Entity

#consumable, #describe, #describe_detailed, #description, #display_shopping_cart, #equippable, #equipped, #name, #name_display, #number_of_uses, #takeable, #talkable, #useable, #useable_battle, #used, #used_again

Instance Method Summary collapse

Methods inherited from Monster

#describe_detailed

Methods inherited from Creature

#describe, #describe_detailed

Methods inherited from Entity

#puts, #use

Constructor Details

#initializeEmerald

Returns a new instance of Emerald.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/gemwarrior/entities/monsters/bosses/emerald.rb', line 12

def initialize
  super

  self.name           = 'emerald'
  self.name_display   = 'Emerald'
  self.description    = 'A wily, beefy, tower of a man, Emerald looks to be a champion of both wisdom, from what you\'ve heard, AND strength, from what you plainly see. He sports a constant glint in his eyes as he faces you, dead-on.'
  self.battlecry      = 'You\'ve come for the SparklyThing(tm), I see. Well, you cannot have it, because it is mine, and I will wield it to my own desire! Oh, you think you are good and I am evil? To that I say: Ha ha ha ha ha! Prepare yourself fool: today your whole life crumbles!'
  self.face           = 'gleaming'
  self.hands          = 'tantalizing'
  self.mood           = 'enraged'

  self.level          = 15
  self.hp_cur         = rand((level * 8)..(level * 9))
  self.hp_max         = hp_cur
  self.atk_lo         = rand((level * 2)..(level * 2.5).floor)
  self.atk_hi         = rand((level * 2.5).floor..(level * 3).floor)
  self.defense        = rand(10..12)
  self.dexterity      = rand(12..14)

  self.inventory      = Inventory.new(items = [SparklyThing.new])
  self.rox            = rand((level * 9)..(level * 11))
  self.xp             = rand((level * 13)..(level * 15))

  self.is_boss        = true
end

Instance Method Details

#initiate_ending(world) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/gemwarrior/entities/monsters/bosses/emerald.rb', line 38

def initiate_ending(world)
  # fanfare!
  Audio.play_synth(:win_game)

  # get reference to throne room, emerald monster, and throne item
  throne_room = world.location_by_coords(world.location_coords_by_name('Sky Tower (Throne Room)'))
  emerald = throne_room.bosses_abounding[0]
  throne = throne_room.items.each { |i| i.name == 'throne' }[0]

  # emerald is dead, so room and items change
  emerald.is_dead                 = true
  emerald.face                    = 'sullen'
  emerald.hands                   = 'limp'
  emerald.mood                    = 'blank'
  emerald.hp_cur                  = 0
  emerald.rox                     = 0
  emerald.description             = 'Emerald slumps over in his chair, completely lifeless. The color has drained from his eyes and a pallor has been cast over his face. His reign is no more.'
  throne_room.description         = 'Emerald\'s throne room feels much less imposing now that you have defeated him in mortal combat. Who knew?'
  throne_room.danger_level        = :none
  throne_room.monster_level_range = nil
  throne_room.monsters_abounding  = []
  throne.description              = 'The grim spectacle of Emerald\'s dead body drooping blankly in his chosen seat really brings down the market value of it, you guess.'
  
  # world knows you beat emerald
  world.emerald_beaten            = true

  # remove sparkly_thing from emerald
  emerald.inventory.remove_item('sparkly_thing')
  # give player sparkly_thing
  world.player.inventory.items.push(SparklyThing.new)

  # ending text
  puts '<^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^>'
  puts "You beat #{name}! You win! You receive the #{"SparklyThing(tm)".colorize(:magenta)} and become the true #{"Gem Warrior".colorize(:yellow)}!"
  puts '<^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^><^>'
  STDIN.getc

  puts 'Suddenly, an icy feeling shoots up your back. You feel lighter than air. Blackness takes over.'
  STDIN.getc

  # onto the queen
  Animation.run(phrase: MOVE_TEXT)
  puts

  return { type: 'move', data: 'Queen Room'}
end