Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Module RPG::BaseItem [RMXP]
- # ■ Author: Bigace360
- # ■ Date: May 2, 2012
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # This script was designed to act as a parent class for Skills, Item, Weapon,
- # and Armor classes. This superclass is based off RMVX version of RPG::BaseItem
- # class. This is a script for developers, not non-scripters.
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Module RPG::BaseItem (Superclass of Skill, Item, Weapon, and Armor.)
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- module RPG
- class BaseItem
- attr_accessor :id, :name, :icon_name, :description
- def initialize
- @id = 0
- @name = ""
- @icon_name = ""
- @description = ""
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # ■ Module RPG::UsableItem (Superclass of Skill and Item.)
- # ■ Methods
- # ● for_opponent?
- # Determines whether or not the area of effect is enemies. Returns true if
- # the value of scope is 1 or 2.
- # ● for_friend?
- # Determines whether or not the area of effect is allies. Returns true if
- # the value of scope is 3, 4, 5, 6, or 7.
- # ● for_dead_friend?
- # Determines whether or not the area of effect is downed allies. Returns
- # true if the value of scope is 5 or 6.
- # ● for_user?
- # Determines whether or not the area of effect is the user. Returns true if
- # the value of scope is 7.
- # ● for_one?
- # Determines whether or not the area of effect is one character. Returns
- # true if the value of scope is 1, 3, 5, or 7.
- # ● for_all?
- # Determines whether or not the area of effect is everyone. Returns true if
- # the value of scope is 2, 4, or 6.
- # ● battle_ok?
- # Determines if it may be used on the battle screen. Returns true if the
- # value of occasion is 0 or 1.
- # ● menu_ok?
- # Determines if it may be used on the menu screen. Returns true if the value
- # of occasion is 0 or 2.
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- class UsableItem < BaseItem
- attr_accessor :scope, :occasion, :animation1_id, :animation2_id, :menu_se
- attr_accessor :common_event_id, :hit, :pdef_f, :mdef_f, :variance
- attr_accessor :element_set, :plus_state_set, :minus_state_set
- def initialize
- super
- @scope = 0
- @occasion = 0
- @animation1_id = 0
- @animation2_id = 0
- @menu_se = RPG::AudioFile.new("", 80)
- @common_event_id = 0
- @hit = 100
- @pdef_f = 0
- @mdef_f = 0
- @variance = 0
- @element_set = []
- @plus_state_set = []
- @minus_state_set = []
- end
- # Scope
- # 0: none
- # 1: one enemy
- # 2: all enemies
- # 3: one ally
- # 4: all allies
- # 5: 1 ally--HP 0
- # 6: all allies--HP 0
- # 7: the user
- def for_opponent?; return [1,2].include?(@scope); end
- def for_friend?; return [3,4,5,6,7].include?(@scope); end
- def for_dead_friend?; return [5,6].include?(@scope); end
- def for_user?; return [7].include?(@scope); end
- def for_one?; return [1,3,5,7].include?(@scope); end
- def for_all?; return [2,4,6].include?(@scope); end
- # occasion
- # 0: always
- # 1: only in battle
- # 2: only from the menu
- # 3: never
- def battle_ok?; return [0,1].include?(@occasion); end
- def menu_ok?; return [0,2].include?(@occasion); end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # ■ RPG::Item (Data class for items.)
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- class Item < UsableItem
- attr_accessor :price, :consumable, :recover_hp_rate, :recover_hp
- attr_accessor :recover_sp_rate, :recover_sp, :parameter_type, :parameter_points
- def initialize
- super
- @price = 0
- @consumable = true
- @recover_hp_rate = 0
- @recover_hp = 0
- @recover_sp_rate = 0
- @recover_sp = 0
- @parameter_type = 0
- @parameter_points = 0
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # ■ RPG::Skill (Data class for skills.)
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- class Skill < UsableItem
- attr_accessor :sp_cost, :power, :atk_f, :eva_f, :str_f, :dex_f, :agi_f, :int_f
- def initialize
- super
- @sp_cost = 0
- @power = 0
- @atk_f = 0
- @eva_f = 0
- @str_f = 0
- @dex_f = 0
- @agi_f = 0
- @int_f = 100
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- # ■ Module RPG::EquippableItem (Superclass of Weapon and Armor.)
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
- class EquippableItem < BaseItem
- attr_accessor :price, :pdef, :mdef, :str_plus, :dex_plus, :agi_plus, :int_plus
- def initialize
- super
- @price = 0
- @pdef = 0
- @mdef = 0
- @str_plus = 0
- @dex_plus = 0
- @agi_plus = 0
- @int_plus = 0
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # ■ RPG::Weapon (Data class for weapons.)
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- class Weapon < EquippableItem
- attr_accessor :animation1_id, :animation2_id, :price, :atk, :element_set
- attr_accessor :plus_state_set, :minus_state_set
- def initialize
- super
- @animation1_id = 0
- @animation2_id = 0
- @atk = 0
- @element_set = []
- @plus_state_set = []
- @minus_state_set = []
- end
- end
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- # ■ RPG::Armor (Data class for armor.)
- #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
- class Armor < BaseItem
- attr_accessor :kind, :auto_state_id, :eva, :guard_element_set, :guard_state_set
- def initialize
- super
- # kind
- # 0: shield
- # 1: helmet
- # 2: body armor
- # 3: accessory
- @kind = 0
- @auto_state_id = 0
- @eva = 0
- @guard_element_set = []
- @guard_state_set = []
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment