RPG::UsableItem

The Superclass of Skill and Item.

Superclass

Attributes

scope

The scope of effects.

occasion

When the item/skill may be used.

speed

The speed correction.

success_rate

The success rate.

repeats

The number of repeats.

tp_gain

The number of TP gained.

hit_type

The type of hit.

animation_id

The animation ID.

damage

Damage (RPG::UsableItem::Damage).

effects

A list of use effects. An RPG::UsableItem::Effect array.

Methods

for_opponent?

Determines whether the area of effect is enemies. Returns true if the value of scope is 1, 2, 3, 4, 5, or 6.

for_friend?

Determines whether the area of effect is allies. Returns true if the value of scope is 7, 8, 9, 10, or 11.

for_dead_friend?

Determines whether the area of effect is downed allies. Returns true if the value of scope is 9 or 10.

for_user?

Determines whether the area of effect is the user. Returns true if the value of scope is 11.

for_one?

Determines whether the area of effect is one character. Returns true if the value of scope is 1, 3, 7, 9, or 11.

for_random?

Determines whether the area of effect is random. Returns true if the value of scope is 3, 4, 5, or 6.

number_of_targets

The number of targets if the area of effect is random.

for_all?

Determines whether the area of effect is everyone. Returns true if the value of scope is 2, 9, or 10.

need_selection?

Determines whether selection of the target is required. Returns true if the value of scope is 1, 7, or 9.

battle_ok?

Determines whether it may be used on the battle screen. Returns true if the value of occasion is 0 or 1.

menu_ok?

Determines whether it may be used on the menu screen. Returns true if the value of occasion is 0 or 2.

certain?

Determines whether the hit type is a certain hit. Returns true if the value of hit_type is 0.

physical?

Determines whether the hit type is a physical attack. Returns true if the value of hit_type is 1.

magical?

Determines whether the hit type is a magical attack. Returns true if the value of hit_type is 2.

Inner Class

Definition

class RPG::UsableItem < RPG::BaseItem
  def initialize
    super
    @scope = 0
    @occasion = 0
    @speed = 0
    @success_rate = 100
    @repeats = 1
    @tp_gain = 0
    @hit_type = 0
    @animation_id = 0
    @damage = RPG::UsableItem::Damage.new
    @effects = []
  end
  def for_opponent?
    [1, 2, 3, 4, 5, 6].include?(@scope)
  end
  def for_friend?
    [7, 8, 9, 10, 11].include?(@scope)
  end
  def for_dead_friend?
    [9, 10].include?(@scope)
  end
  def for_user?
    @scope == 11
  end
  def for_one?
    [1, 3, 7, 9, 11].include?(@scope)
  end
  def for_random?
    [3, 4, 5, 6].include?(@scope)
  end
  def number_of_targets
    for_random? ? @scope - 2 : 0
  end
  def for_all?
    [2, 8, 10].include?(@scope)
  end
  def need_selection?
    [1, 7, 9].include?(@scope)
  end
  def battle_ok?
    [0, 1].include?(@occasion)
  end
  def menu_ok?
    [0, 2].include?(@occasion)
  end
  def certain?
    @hit_type == 0
  end
  def physical?
    @hit_type == 1
  end
  def magical?
    @hit_type == 2
  end
  attr_accessor :scope
  attr_accessor :occasion
  attr_accessor :speed
  attr_accessor :animation_id
  attr_accessor :success_rate
  attr_accessor :repeats
  attr_accessor :tp_gain
  attr_accessor :hit_type
  attr_accessor :damage
  attr_accessor :effects
end