Class: PFM::ItemDescriptor::Wrapper
- Defined in:
- scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb
Overview
Wrapper to make the item description more usefull
Instance Attribute Summary collapse
-
#action_to_push
writeonly
Register the action_to_push block.
-
#chen ⇒ Boolean
Get if the item should not be used there.
-
#item ⇒ Studio::Item
Get the item bound to this wrapper.
-
#no_effect ⇒ Boolean
Get if the item has no effect.
-
#on_creature_choice(creature, scene) ⇒ Boolean
Call the on_creature_choice block.
-
#on_creature_use(creature, scene)
Call the on_creature_use block.
-
#on_skill_choice(skill, scene) ⇒ Boolean
Call the on_creature_choice block.
-
#on_skill_use(creature, skill, scene)
Call the on_skill_use block.
-
#on_use(scene)
Call the on_use block.
-
#open_party ⇒ Boolean
Get if the item should open the party menu.
-
#open_skill ⇒ Boolean
Get if the item should open the skill menu.
-
#open_skill_learn ⇒ Integer?
Get the ID of the move that should be learnt if it should be learnt.
-
#skill ⇒ PFM::Skill
readonly
Get the skill bound to the wrapper.
-
#skill_message_id ⇒ Integer?
Get the ID of the message that should be shown in the Summary UI.
-
#stone_evolve ⇒ Boolean
Get if the item is making a Pokemon evolve.
-
#use_before_telling ⇒ Boolean
Get if the item should be used before the usage message.
Instance Method Summary collapse
-
#bind(scene, creature, skill = nil)
Bind the wrapper to a scene, creature & skill.
-
#execute_battle_action
Call the action_to_push block.
-
#on_creature_choice? ⇒ Boolean
Tell if the wrapper has a Pokemon choice.
-
#void_non_battle_block
Void all regular block for battle usage.
Instance Attribute Details
#action_to_push=(value) (writeonly)
Register the action_to_push block
224 225 226 |
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 224 def action_to_push=(value) @action_to_push = value end |
#chen ⇒ Boolean
Get if the item should not be used there
188 189 190 |
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 188 def chen @chen end |
#item ⇒ Studio::Item
Get the item bound to this wrapper
206 207 208 |
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 206 def item @item end |
#no_effect ⇒ Boolean
Get if the item has no effect
185 186 187 |
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 185 def no_effect @no_effect end |
#on_creature_choice(creature, scene) ⇒ Boolean
Call the on_creature_choice block
241 242 243 244 245 246 |
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 241 def on_creature_choice(creature, scene) return false unless @on_creature_choice.respond_to?(:call) return false if $game_temp.in_battle && creature.effects.has?(:embargo) return @on_creature_choice.call(@item, creature, scene) end |
#on_creature_use(creature, scene)
Call the on_creature_use block
251 252 253 |
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 251 def on_creature_use(creature, scene) @on_creature_use&.call(@item, creature, scene) end |
#on_skill_choice(skill, scene) ⇒ Boolean
Call the on_creature_choice block
259 260 261 262 263 |
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 259 def on_skill_choice(skill, scene) return false unless @on_skill_choice.respond_to?(:call) return @on_skill_choice.call(@item, skill, scene) end |
#on_skill_use(creature, skill, scene)
Call the on_skill_use block
269 270 271 |
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 269 def on_skill_use(creature, skill, scene) @on_skill_use&.call(@item, creature, skill, scene) end |
#on_use(scene)
Call the on_use block
275 276 277 |
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 275 def on_use(scene) @on_use&.call(@item, scene) end |
#open_party ⇒ Boolean
Get if the item should open the party menu
191 192 193 |
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 191 def open_party @open_party end |
#open_skill ⇒ Boolean
Get if the item should open the skill menu
194 195 196 |
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 194 def open_skill @open_skill end |
#open_skill_learn ⇒ Integer?
Get the ID of the move that should be learnt if it should be learnt
197 198 199 |
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 197 def open_skill_learn @open_skill_learn end |
#skill ⇒ PFM::Skill (readonly)
Get the skill bound to the wrapper
209 210 211 |
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 209 def skill @skill end |
#skill_message_id ⇒ Integer?
Get the ID of the message that should be shown in the Summary UI
212 213 214 |
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 212 def @skill_message_id end |
#stone_evolve ⇒ Boolean
Get if the item is making a Pokemon evolve
200 201 202 |
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 200 def stone_evolve @stone_evolve end |
#use_before_telling ⇒ Boolean
Get if the item should be used before the usage message
203 204 205 |
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 203 def use_before_telling @use_before_telling end |
Instance Method Details
#bind(scene, creature, skill = nil)
Bind the wrapper to a scene, creature & skill
294 295 296 297 298 |
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 294 def bind(scene, creature, skill = nil) @scene = scene @creature = creature @skill = skill end |
#execute_battle_action
Call the action_to_push block
280 281 282 283 284 285 286 287 288 |
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 280 def execute_battle_action raise 'You forgot to bind this wrapper!' unless @scene if @skill @action_to_push&.call(@item, @creature, @skill, @scene) else @action_to_push&.call(@item, @creature, @scene) end end |
#on_creature_choice? ⇒ Boolean
Tell if the wrapper has a Pokemon choice
233 234 235 |
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 233 def on_creature_choice? !!@on_creature_choice end |
#void_non_battle_block
Void all regular block for battle usage
226 227 228 229 |
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 226 def void_non_battle_block @on_creature_use = nil @on_skill_use = nil end |