Class: Game_BaseItem

Inherits:
Object
  • Object
show all
Defined in:
Game_BaseItem.rb

Overview

** Game_BaseItem


This class uniformly handles skills, items, weapons, and armor. References

to the database object itself are not retained to enable inclusion in save data.

Instance Method Summary (collapse)

Constructor Details

- (Game_BaseItem) initialize


  • Object Initialization




13
14
15
16
# File 'Game_BaseItem.rb', line 13

def initialize
  @class = nil
  @item_id = 0
end

Instance Method Details

- (Boolean) is_armor?

Returns:

  • (Boolean)


23
# File 'Game_BaseItem.rb', line 23

def is_armor?;   @class == RPG::Armor;   end

- (Boolean) is_item?

Returns:

  • (Boolean)


21
# File 'Game_BaseItem.rb', line 21

def is_item?;    @class == RPG::Item;    end

- (Boolean) is_nil?

Returns:

  • (Boolean)


24
# File 'Game_BaseItem.rb', line 24

def is_nil?;     @class == nil;          end

- (Boolean) is_skill?


  • Determine Class


Returns:

  • (Boolean)


20
# File 'Game_BaseItem.rb', line 20

def is_skill?;   @class == RPG::Skill;   end

- (Boolean) is_weapon?

Returns:

  • (Boolean)


22
# File 'Game_BaseItem.rb', line 22

def is_weapon?;  @class == RPG::Weapon;  end

- (Object) object


  • Get Item Object




28
29
30
31
32
33
34
# File 'Game_BaseItem.rb', line 28

def object
  return $data_skills[@item_id]  if is_skill?
  return $data_items[@item_id]   if is_item?
  return $data_weapons[@item_id] if is_weapon?
  return $data_armors[@item_id]  if is_armor?
  return nil
end

- (Object) object=(item)


  • Set Item Object




38
39
40
41
# File 'Game_BaseItem.rb', line 38

def object=(item)
  @class = item ? item.class : nil
  @item_id = item ? item.id : 0
end

- (Object) set_equip(is_weapon, item_id)


  • Set Equipment with ID

    is_weapon:  Whether it is a weapon
    item_id: Weapon/armor ID



47
48
49
50
# File 'Game_BaseItem.rb', line 47

def set_equip(is_weapon, item_id)
  @class = is_weapon ? RPG::Weapon : RPG::Armor
  @item_id = item_id
end