Class: PFM::ItemDescriptor::Wrapper

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#chenBoolean

Get if the item should not be used there

Returns:

  • (Boolean)


188
189
190
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 188

def chen
  @chen
end

#itemStudio::Item

Get the item bound to this wrapper

Returns:



206
207
208
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 206

def item
  @item
end

#no_effectBoolean

Get if the item has no effect

Returns:

  • (Boolean)


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

Parameters:

Returns:

  • (Boolean)


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

Parameters:



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

Parameters:

Returns:

  • (Boolean)


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

Parameters:



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

Parameters:



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_partyBoolean

Get if the item should open the party menu

Returns:

  • (Boolean)


191
192
193
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 191

def open_party
  @open_party
end

#open_skillBoolean

Get if the item should open the skill menu

Returns:

  • (Boolean)


194
195
196
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 194

def open_skill
  @open_skill
end

#open_skill_learnInteger?

Get the ID of the move that should be learnt if it should be learnt

Returns:



197
198
199
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 197

def open_skill_learn
  @open_skill_learn
end

#skillPFM::Skill (readonly)

Get the skill bound to the wrapper

Returns:



209
210
211
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 209

def skill
  @skill
end

#skill_message_idInteger?

Get the ID of the message that should be shown in the Summary UI

Returns:



212
213
214
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 212

def skill_message_id
  @skill_message_id
end

#stone_evolveBoolean

Get if the item is making a Pokemon evolve

Returns:

  • (Boolean)


200
201
202
# File 'scripts/00800 Studio/00001 Data/00002 Item/00000 ItemDescriptor.rb', line 200

def stone_evolve
  @stone_evolve
end

#use_before_tellingBoolean

Get if the item should be used before the usage message

Returns:

  • (Boolean)


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

Parameters:



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

Returns:

  • (Boolean)


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