Class: PfrpgUtility::Prerequisite::MiscPrereq

Inherits:
PfrpgUtility::Prerequisite show all
Defined in:
lib/pfrpg_utility/prerequisite/misc_prereq.rb

Instance Method Summary collapse

Methods inherited from PfrpgUtility::Prerequisite

#initialize, load, parse_prereq

Constructor Details

This class inherits a constructor from PfrpgUtility::Prerequisite

Instance Method Details

#match(character) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/pfrpg_utility/prerequisite/misc_prereq.rb', line 2

def match(character)
  begin
    case @attribute
    when "caster level"
      return character.get_caster_level >= @value.to_i
    when "total_level"
      return character.get_total_level >= @value.to_i
    when "caster"
      return character.can_arcane?
    when "divine"
      return character.can_divine?
    when "size"
      return character.race.size.upcase == @value.upcase
    end
  rescue Exception => e
    #ap "Exception: "
    #ap e
    #ap "Self:"
    #ap self
    return false
  end
end