Class: Studio::Group::Encounter::LevelSetup
- Defined in:
- scripts/00800 Studio/00001 Data/00011 Group.rb
Overview
Data class helping to know the level setup of a creature while picking its level from group
Instance Attribute Summary collapse
-
#range ⇒ Range
readonly
Get the level range (to give to a rand function) to get the final level of the creature.
Instance Method Summary collapse
-
#initialize(hash) ⇒ LevelSetup
constructor
Create a new level setup.
-
#repel_rejected(actor_level) ⇒ Boolean
Tell if that level setup makes the encounter rejected by repel.
-
#strong_selected(actor_level) ⇒ Boolean
Tell if that level setup makes the encounter being selected because actor is weaker.
Constructor Details
#initialize(hash) ⇒ LevelSetup
Create a new level setup
146 147 148 149 150 151 |
# File 'scripts/00800 Studio/00001 Data/00011 Group.rb', line 146 def initialize(hash) @kind = hash['kind'].to_sym min_level = @kind == :fixed ? hash['level'].to_i : hash['level']['minimumLevel'].to_i max_level = @kind == :fixed ? hash['level'].to_i : hash['level']['maximumLevel'].to_i @range = min_level..max_level end |
Instance Attribute Details
#range ⇒ Range (readonly)
Get the level range (to give to a rand function) to get the final level of the creature
142 143 144 |
# File 'scripts/00800 Studio/00001 Data/00011 Group.rb', line 142 def range @range end |
Instance Method Details
#repel_rejected(actor_level) ⇒ Boolean
Tell if that level setup makes the encounter rejected by repel
156 157 158 |
# File 'scripts/00800 Studio/00001 Data/00011 Group.rb', line 156 def repel_rejected(actor_level) return @range.end < actor_level end |
#strong_selected(actor_level) ⇒ Boolean
Tell if that level setup makes the encounter being selected because actor is weaker
163 164 165 |
# File 'scripts/00800 Studio/00001 Data/00011 Group.rb', line 163 def strong_selected(actor_level) return @range.end + 5 >= actor_level end |