Class: Scroll

Inherits:
Olib::Item show all
Defined in:
lib/Olib/objects/scroll.rb

Constant Summary collapse

@@whitelist =
[ 
  101, 102, 103, 107, 116, 120, 
  202, 211, 215, 219,
  303, 307, 310, 313, 315,
  401, 406, 414, 425, 430, 
  503, 507, 508, 509, 511, 513, 520, 
  601, 602, 606, 613, 617, 618, 625, 640, 
  712, 716,
  905, 911, 913, 920, 
  1109, 1119, 1125, 1130,
  1201, 1204,
  1601, 1603, 1606, 1610, 1611, 1612, 1616,
  1712, 1718
]

Constants inherited from Olib::Item

Olib::Item::SOLD, Olib::Item::TYPES, Olib::Item::WORTHLESS, Olib::Item::WRONG_SHOP

Instance Attribute Summary collapse

Attributes inherited from Olib::Item

#container, #props

Attributes inherited from Olib::Gameobj_Extender

#type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Olib::Item

#==, #_drag, #_inspect, #acquire_from_shop, #action, #add, #affordable?, #analyze, #buy, #buyable?, #cost, #crawl, #define, #drop, #exists?, #give, #has?, #in, #is?, #look, #missing?, #price, #pull, #pullable?, #read, #remove, #sell, #shake, #shop_sell, #stash, #tag, #tags, #take, #tap, #to_s, #turn, type_methods, #untag, #use, #wear, #worn?

Methods inherited from Olib::Gameobj_Extender

#__extend__, #at, #echo

Constructor Details

#initialize(item) ⇒ Scroll

Returns a new instance of Scroll.


30
31
32
33
34
# File 'lib/Olib/objects/scroll.rb', line 30

def initialize(item)
  super item
  @spells = []
  return self
end

Instance Attribute Details

#spellsObject

Returns the value of attribute spells


16
17
18
# File 'lib/Olib/objects/scroll.rb', line 16

def spells
  @spells
end

#whitelistObject

Returns the value of attribute whitelist


16
17
18
# File 'lib/Olib/objects/scroll.rb', line 16

def whitelist
  @whitelist
end

#worthyObject

Returns the value of attribute worthy


16
17
18
# File 'lib/Olib/objects/scroll.rb', line 16

def worthy
  @worthy
end

Class Method Details

.add_to_whitelist(*args) ⇒ Object


22
23
24
# File 'lib/Olib/objects/scroll.rb', line 22

def Scroll.add_to_whitelist(*args)
  @@whitelist + args
end

.remove_from_whitelist(*args) ⇒ Object


26
27
28
# File 'lib/Olib/objects/scroll.rb', line 26

def Scroll.remove_from_whitelist(*args)
  @@whitelist = @@whitelist - args
end

.whitelistObject


18
19
20
# File 'lib/Olib/objects/scroll.rb', line 18

def Scroll.whitelist
  @@whitelist
end

Instance Method Details

#worthy?Boolean

Returns:

  • (Boolean)

36
37
38
39
40
41
# File 'lib/Olib/objects/scroll.rb', line 36

def worthy?
  @worthy = false
  read unless @spells.length > 0
  @spells.each do |spell| @worthy = true if Scroll.whitelist.include? spell[:n] end
  @worthy
end