Class: Studio::Group::CustomCondition
- Defined in:
- scripts/00800 Studio/00001 Data/00011 Group.rb
Overview
Data class describing a custom group condition
Instance Attribute Summary collapse
-
#relation_with_previous_condition ⇒ Symbol
readonly
Relation of the condition (:AND, :OR).
-
#type ⇒ Symbol
readonly
Type of the custom condition (:enabled_switch or :map_id).
-
#value ⇒ Integer
readonly
Value of the condition.
Instance Method Summary collapse
-
#evaluate
Evaluate the condition.
-
#reduce_evaluate(previous) ⇒ Boolean
Evaluate the condition in a reduce context.
Instance Attribute Details
#relation_with_previous_condition ⇒ Symbol (readonly)
Relation of the condition (:AND, :OR)
52 53 54 |
# File 'scripts/00800 Studio/00001 Data/00011 Group.rb', line 52 def relation_with_previous_condition @relation_with_previous_condition end |
#type ⇒ Symbol (readonly)
Type of the custom condition (:enabled_switch or :map_id)
44 45 46 |
# File 'scripts/00800 Studio/00001 Data/00011 Group.rb', line 44 def type @type end |
#value ⇒ Integer (readonly)
Value of the condition
48 49 50 |
# File 'scripts/00800 Studio/00001 Data/00011 Group.rb', line 48 def value @value end |
Instance Method Details
#evaluate
Evaluate the condition
65 66 67 68 69 70 71 72 73 74 |
# File 'scripts/00800 Studio/00001 Data/00011 Group.rb', line 65 def evaluate case @type when :enabled_switch return PFM.game_state.game_switches[@value] when :map_id return PFM.game_state.game_map.map_id == @value else return false end end |
#reduce_evaluate(previous) ⇒ Boolean
Evaluate the condition in a reduce context
57 58 59 60 61 62 |
# File 'scripts/00800 Studio/00001 Data/00011 Group.rb', line 57 def reduce_evaluate(previous) return false if @relation_with_previous_condition == :AND && !previous return true if @relation_with_previous_condition == :OR && previous return evaluate end |