赞 | 0 |
VIP | 1 |
好人卡 | 0 |
积分 | 1 |
经验 | 3179 |
最后登录 | 2013-10-25 |
在线时间 | 140 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 66
- 在线时间
- 140 小时
- 注册时间
- 2012-2-6
- 帖子
- 384
|
6楼
楼主 |
发表于 2012-3-16 11:07:10
|
只看该作者
【3级转载】奇怪的装备升级系统
本帖最后由 杂兵天下 于 2012-3-16 15:08 编辑
来源http://cobbtocs.co.uk/wp/- =begin
- AP System Script II
- by Fomar0153
- Version 1.0
- ----------------------
- Notes
- ----------------------
- No requirements
- Implements an ap system for you to use when creating skill
- systems that utilise AP.
- ----------------------
- Instructions
- ----------------------
- Notetag <ap x> e.g. <ap 4> <ap 100>
- ----------------------
- Known bugs
- ----------------------
- None
- =end
- module Vocab
- ObtainAp = "%s AP was obtained!"
- end
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # ● New Method gain_ap
- #--------------------------------------------------------------------------
- def gain_ap(ap)
- # your code goes here
- end
- end
- module BattleManager
- #--------------------------------------------------------------------------
- # ● Rewrote self.display_exp
- #--------------------------------------------------------------------------
- def self.display_exp
- if $game_troop.exp_total > 0
- text = sprintf(Vocab::ObtainExp, $game_troop.exp_total)
- $game_message.add('\.' + text)
- end
- if $game_troop.ap_total > 0
- text = sprintf(Vocab::ObtainAp, $game_troop.ap_total)
- $game_message.add('\.' + text)
- end
- end
- #--------------------------------------------------------------------------
- # ● Rewrote self.gain_exp
- #--------------------------------------------------------------------------
- def self.gain_exp
- $game_party.all_members.each do |actor|
- actor.gain_exp($game_troop.exp_total)
- end
- wait_for_message
- $game_party.all_members.each do |actor|
- actor.gain_ap($game_troop.ap_total)
- end
- wait_for_message
- end
- end
- class Game_Troop < Game_Unit
- #--------------------------------------------------------------------------
- # ● New Method ap_total
- #--------------------------------------------------------------------------
- def ap_total
- dead_members.inject(0) {|r, enemy| r += enemy.ap }
- end
- end
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # ● New Method ap_total
- #--------------------------------------------------------------------------
- def ap
- if enemy.note =~ /<ap (.*)>/i
- return $1.to_i
- else
- return 0
- end
- end
- end
- =begin
- Individual Equipment
- by Fomar0153
- Version 1.1
- ----------------------
- Notes
- ----------------------
- This script changes the way weapons and armours are handled
- in game. This script make every weapon and armour unique.
- ----------------------
- Instructions
- ----------------------
- Plug and play.
- If you want to be able to carry more than 150 weapons and 150 armors
- edit MAX_INVENTORY_SIZE which you can find at the top of the script.
- This script is designed to be a base for other scripts.
- For example:
- Proper Weapon and Armour Customisation.
- ----------------------
- Change Log
- ----------------------
- 1.0 -> 1.1 Added a single character (@) to fix a bug where you
- created new equipment when changing equipment.
- ----------------------
- Known bugs
- ----------------------
- None
- =end
- module CustomEquip
-
- MAX_INVENTORY_SIZE = 150
-
- end
- class Game_CustomEquip < Game_BaseItem
- #--------------------------------------------------------------------------
- # ● New attr_accessor & attr_reader
- #--------------------------------------------------------------------------
- attr_accessor :pos
- attr_reader :item_id
- #--------------------------------------------------------------------------
- # ● Pos is used to identify weapons and armors
- #--------------------------------------------------------------------------
- def initialize
- super
- @pos = 0
- end
- #--------------------------------------------------------------------------
- # ● The rest of the methods allow this item to pretend to be RPG::Weapon
- # and RPG::Armor in some cases, increasing compatability, thought not
- # as much as I would like.
- #--------------------------------------------------------------------------
- def description
- return nil if is_nil?
- return object.description
- end
-
- def name
- return nil if is_nil?
- return object.name
- end
-
- def icon_index
- return nil if is_nil?
- return object.icon_index
- end
-
- def price
- return nil if is_nil?
- return object.price
- end
-
- def animation_id
- return nil if is_nil?
- return nil if is_armor? # variable only exists for RPG::Weapon
- return object.animation_id
- end
-
- def note
- return nil if is_nil?
- return object.note
- end
-
- def id
- return nil if is_nil?
- return object.id
- end
-
- def features
- return nil if is_nil?
- return object.features
- end
-
- def params
- return nil if is_nil?
- return object.params
- end
-
- def etype_id
- return nil if is_nil?
- return object.etype_id
- end
-
- def wtype_id
- return nil if is_nil?
- return nil if is_armor? # variable only exists for RPG::Weapon
- return object.wtype_id
- end
-
- def atype_id
- return nil if is_nil?
- return nil if is_weapon? # variable only exists for RPG::Armor
- return object.atype_id
- end
-
-
- # performance returns an integer calculated from the equip item's params.
- # each point in a param increasing performance by one, except
- # for attack and magic on weapon which counts double
- # for defence and magic defence on armours which counts double
- def performance
- return nil if is_nil?
- return object.performance
- end
-
- end
- class Game_Party < Game_Unit
- #--------------------------------------------------------------------------
- # ● Aliases init_all_items
- #--------------------------------------------------------------------------
- alias ie_init_all_items init_all_items
- def init_all_items
- ie_init_all_items
- @weapons = []
- @armors = []
- end
- #--------------------------------------------------------------------------
- # ● Rewrites weapons
- #--------------------------------------------------------------------------
- def weapons
- return @weapons
- end
- #--------------------------------------------------------------------------
- # ● Rewrites armors
- #--------------------------------------------------------------------------
- def armors
- return @armors
- end
- #--------------------------------------------------------------------------
- # ● Aliases item_number + Probably rewrite
- #--------------------------------------------------------------------------
- alias ie_item_number item_number
- def item_number(item)
- if item.class == RPG::Weapon or item.class == RPG::Armor
- return 1 # I haven't found this to cause unexpected behaviour
- # but I don't like it
- else
- return ie_item_number(item)
- end
- end
- #--------------------------------------------------------------------------
- # ● Aliases gain_item
- #--------------------------------------------------------------------------
- alias ie_gain_item gain_item
- def gain_item(item, amount, include_equip = false)
- if item.class == RPG::Weapon
- if amount > 0
- for i in 1..amount
- t = Game_CustomEquip.new
- t.object = item
- @weapons.push(t)
- end
- weapon_sort
- end
- elsif item.is_a?(Game_CustomEquip) && item.is_weapon?
- if amount == 1
- @weapons.push(item)
- weapon_sort
- elsif amount == -1
- # Can't sell more than 1 at a time
- # (is there any other way to remove more than 1 at a time?
- # except through events?)
- @weapons.delete_at(item.pos)
- weapon_sort
- end
- elsif item.class == RPG::Armor
- if amount > 0
- for i in 1..amount
- t = Game_CustomEquip.new
- t.object = item
- @armors.push(t)
- end
- armor_sort
- end
- elsif item.is_a?(Game_CustomEquip) && item.is_armor?
- if amount == 1
- @armors.push(item)
- armor_sort
- elsif amount == -1
- # Can't sell more than 1 at a time
- # (is there any other way to remove more than 1 at a time?
- # except through events?)
- @armors.delete_at(item.pos)
- armor_sort
- end
- else
- ie_gain_item(item, amount, include_equip)
- return
- end
- $game_map.need_refresh = true
- end
-
- def weapon_sort
- @weapons.sort! { |a, b| a.item_id <=> b.item_id }
- for i in [email protected] - 1
- @weapons[i].pos = i
- end
- end
-
- def armor_sort
- @armors.sort! { |a, b| a.item_id <=> b.item_id }
- for i in [email protected] - 1
- @armors[i].pos = i
- end
- end
-
- alias ie_max_item_number max_item_number
- def max_item_number(item)
- if item.class == RPG::Weapon
- return CustomEquip::MAX_INVENTORY_SIZE - @weapons.size
- elsif item.class == RPG::Armor
- return CustomEquip::MAX_INVENTORY_SIZE - @armors.size
- else
- return ie_max_item_number(item)
- end
- end
- end
- class Window_ItemList < Window_Selectable
-
- alias ie_include? include?
- def include?(item)
- case @category
- when :weapon
- item.is_a?(Game_CustomEquip) && item.object.is_a?(RPG::Weapon)
- when :armor
- item.is_a?(Game_CustomEquip) && item.object.is_a?(RPG::Armor)
- else
- ie_include?(item)
- end
- end
-
- alias ie_draw_item draw_item
- def draw_item(index)
- item = @data[index]
- if item && !item.is_a?(Game_CustomEquip)
- ie_draw_item(index)
- elsif item && item.is_a?(Game_CustomEquip)
- rect = item_rect(index)
- rect.width -= 4
- draw_item_name(item, rect.x, rect.y, enable?(item))
- #draw_item_number(rect, item) just this line removed from the default
- end
- end
-
- end
- class Window_EquipItem < Window_ItemList
- #--------------------------------------------------------------------------
- # ● Aliases include?
- #--------------------------------------------------------------------------
- alias ie2_include? include?
- def include?(item)
- return true if item == nil
- return false unless item.is_a?(Game_CustomEquip)
- return ie2_include?(item.object)
- end
- #--------------------------------------------------------------------------
- # ● Rewrites update_help
- #--------------------------------------------------------------------------
- def update_help
- super
- if @actor && @status_window
- temp_actor = Marshal.load(Marshal.dump(@actor))
- temp_actor.force_change_equip(@slot_id, item) unless item.nil?
- @status_window.set_temp_actor(temp_actor)
- end
- end
- end
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # ● Rewrites init_equips
- #--------------------------------------------------------------------------
- def init_equips(equips)
- @equips = Array.new(equip_slots.size) { Game_CustomEquip.new } # only change
- equips.each_with_index do |item_id, i|
- etype_id = index_to_etype_id(i)
- slot_id = empty_slot(etype_id)
- @equips[slot_id].set_equip(etype_id == 0, item_id) if slot_id
- end
- refresh
- end
- #--------------------------------------------------------------------------
- # ● Rewrites change_equip
- #--------------------------------------------------------------------------
- def change_equip(slot_id, item)
- return unless trade_item_with_party(item, @equips[slot_id])
- return if item && equip_slots[slot_id] != item.etype_id
- if item.nil?
- @equips[slot_id] = Game_CustomEquip.new
- else
- @equips[slot_id] = item
- end
- refresh
- end
- #--------------------------------------------------------------------------
- # ● Rewrites force_change_equip
- #--------------------------------------------------------------------------
- def force_change_equip(slot_id, item)
- if item.nil?
- @equips[slot_id] = Game_CustomEquip.new
- else
- @equips[slot_id] = item
- end
- release_unequippable_items(false)
- refresh
- end
- #--------------------------------------------------------------------------
- # ● Rewrites trade_item_with_party
- #--------------------------------------------------------------------------
- def trade_item_with_party(new_item, old_item)
- #return false if new_item && !$game_party.has_item?(new_item) removed
- $game_party.gain_item(old_item, 1)
- $game_party.lose_item(new_item, 1)
- return true
- end
- #--------------------------------------------------------------------------
- # ● Rewrites change_equip_by_id
- #--------------------------------------------------------------------------
- def change_equip_by_id(slot_id, item_id)
- if equip_slots[slot_id] == 0
- t = Game_CustomEquip.new
- t.object = $data_weapons[item_id]
- $game_party.gain_item(t, 1)
- change_equip(slot_id, t)
- else
- t = Game_CustomEquip.new
- t.object = $data_armors[item_id]
- $game_party.gain_item(t, 1)
- change_equip(slot_id, t)
- end
- end
- #--------------------------------------------------------------------------
- # ● Rewrites optimize_equipments or does it
- #--------------------------------------------------------------------------
- def optimize_equipments
- clear_equipments
- equip_slots.size.times do |i|
- next if !equip_change_ok?(i)
- items = $game_party.equip_items.select do |item|
- item.etype_id == equip_slots[i] &&
- equippable?(item.object) && item.performance >= 0
- end
- change_equip(i, items.max_by {|item| item.performance })
- end
- end
- end
- class Window_ShopStatus < Window_Base
-
- alias ie_draw_possession draw_possession
- def draw_possession(x, y)
- return if @item.is_a?(RPG::EquipItem)
- ie_draw_possession(x, y)
- end
-
- alias ie_draw_equip_info draw_equip_info
- def draw_equip_info(x, y)
- ie_draw_equip_info(x, y - line_height * 2)
- end
- end
- =begin
- Equipment Levels Up
- by Fomar0153
- Version 1.0
- ----------------------
- Notes
- ----------------------
- This script allows weapons to grow stronger and level up when they
- gain exp or ap.
- ----------------------
- Instructions
- ----------------------
- Requires my individual equipment script. (Make sure it is version 1.1+)
- Requires an AP script if leveling weapons using AP.
- Customise the variables in the module below to set up the script to your
- liking.
- Notetags
- <maxlevel x> - adds a non-default max level to the tagged equipment.
- ----------------------
- Known bugs
- ----------------------
- None
- =end
- module Fomar
-
- # If you only want to implement this for weapons or armours set
- # the following to false as you see fit
- WLU_WEAPONS_LEVEL_UP = true
- WLU_ARMOURS_LEVEL_UP = true
- # This script can be set up to use either EXP or AP
- # For AP you will also need an AP system.
- # true -> uses AP
- # false -> uses EXP
- WLU_USE_AP = true
- # Determines the order of the substitutions
- # true -> level, name
- # false -> name, level
- WLU_PREFIX = true
- # the %s are replaced by the level and name of the weapon
- WLU_VOCAB_WEAPON_NAME = "%s级%s"
- # Default max level
- # set to 0 to only allow chosen weapons to level up
- WLU_DEF_MAX_LEVEL = 5
- # Default stat increase per level (percentage)
- WLU_DEF_PARAM_INC = 25
- # Set to false if you want the price of the item to be unaffected
- # by leveling up
- WLU_PRICE_LEVEL_UP = true
- # Default experience per level
- # I have provided two defaults, one designed for EXP and one for AP
- def self.WLU_EXP_FOR_LEVEL(item); return item.performance * 10; end
- def self.WLU_AP_FOR_LEVEL(item); return item.performance; end
-
- end
- class Game_CustomEquip < Game_BaseItem
-
- alias wlu_initialize initialize
- def initialize
- wlu_initialize
- @exp = 0
- @level = 1
- end
-
- def gain_exp(exp)
- return unless levels?
- @exp += exp
- last_level = @level
- unless Fomar::WLU_USE_AP
- while @exp >= @level * Fomar.WLU_EXP_FOR_LEVEL(object) and @level < object.max_level
- @level += 1
- $game_message.add(object.name + " levels up.")
- end
- else
- while @exp >= @level * Fomar.WLU_AP_FOR_LEVEL(object) and @level < object.max_level
- @level += 1
- $game_message.add(object.name + " levels up.")
- end
- end
- end
-
- def levels?
- return false if is_nil?
- return (((is_weapon? and Fomar::WLU_WEAPONS_LEVEL_UP) or
- (is_armor? and Fomar::WLU_ARMOURS_LEVEL_UP)) and
- object.max_level > 0)
- end
-
- alias wlu_name name
- def name
- return nil if is_nil?
- return wlu_name unless levels?
- return sprintf(Fomar::WLU_VOCAB_WEAPON_NAME,@level,wlu_name) if Fomar::WLU_PREFIX
- return sprintf(Fomar::WLU_VOCAB_WEAPON_NAME,wlu_name,@level)
- end
-
- alias wlu_price price
- def price
- return nil if is_nil?
- return wlu_price unless levels?
- return wlu_price unless Fomar::WLU_PRICE_LEVEL_UP
- return (100 + Fomar::WLU_DEF_PARAM_INC * @level + object.price)/100
- end
-
- def params
- return nil if is_nil?
- par = object.params.clone
- for i in 0..par.size - 1
- par[i] *= 100 + Fomar::WLU_DEF_PARAM_INC * (@level - 1)
- par[i] /= 100
- end
- return par
- end
-
- alias wlu_performance performance
- def performance
- return nil if is_nil?
- return wlu_performance unless levels?
- par = params
- p = 0
- for pa in par
- p += pa
- end
- if is_weapon?
- p += par[2] + par[4]
- else
- p += par[3] + par[5]
- end
- return p
- end
-
- end
- module RPG
- class EquipItem
- def max_level
- if self.note =~ /<maxlevel (.*)>/i
- return $1.to_i
- else
- return Fomar::WLU_DEF_MAX_LEVEL
- end
- end
- end
- end
- class Game_Actor < Game_Battler
-
- alias wlu_gain_exp gain_exp
- def gain_exp(exp)
- for equip in @equips
- equip.gain_exp(exp)
- end
- wlu_gain_exp(exp)
- end
-
- def gain_ap(ap)
- for equip in @equips
- equip.gain_exp(ap)
- end
- end
-
- def custom_equips
- return @equips
- end
-
- # rewrites param_plus
- def param_plus(param_id)
- p = super(param_id)
- for equip in @equips
- p += equip.params[param_id] unless equip.is_nil?
- end
- return p
- end
-
- end
- class Window_Base < Window
-
- alias wlu_draw_item_name draw_item_name
- def draw_item_name(item, x, y, enabled = true, width = 172)
- return unless item
- if item.is_a?(Game_CustomEquip)
- return if item.is_nil?
- end
- wlu_draw_item_name(item, x, y, enabled = true, width)
- end
-
- end
- class Window_EquipSlot < Window_Selectable
-
- # rewrites draw_item
- def draw_item(index)
- return unless @actor
- rect = item_rect_for_text(index)
- change_color(system_color, enable?(index))
- draw_text(rect.x, rect.y, 92, line_height, slot_name(index))
- draw_item_name(@actor.custom_equips[index], rect.x + 92, rect.y, enable?(index))
- end
-
- end
- =begin
- Equipment Skills System Script
- by Fomar0153
- Version 1.1
- ----------------------
- Notes
- ----------------------
- Requires an AP System if you want characters to
- learn skills pernamently.
- If using my Custom Equipment Slots script then
- make sure this script is above the Equipment Slots Script
- and make sure you have the compatability patch.
- Allows learning of skills by equipment with the
- option to learn skills pernamently.
- ----------------------
- Instructions
- ----------------------
- Set Learn_Skills to false if you want the skills to
- only be temporary.
- If you can learn skills then you need to set up AP for
- each skill you put on an item.
- In the notes section put:
- AP:n
- where n is the ap required to learn pernamently.
- Then follow the instructions below about how to add skills
- to weapons and armor.
- ----------------------
- Change Log
- ----------------------
- 1.0 -> 1.1 Fixed a bug which caused skills learnt from
- armour to not display they were learnt.
- ----------------------
- Known bugs
- ----------------------
- None
- =end
-
-
- module Equipment_Skills
-
- # If set to false then characters will not
- # learn the skills pernamently and you will
- # not need an ap system
- Learn_Skills = true
-
- Weapons = []
- # Add weapon skills in this format
- # Weapons[weapon_id] = [skillid1, skillid2]
- Weapons[1] = [8]
-
- Armors = []
- # Add weapon skills in this format
- # Armors[armor_id] = [skillid1, skillid2]
- Armors[3] = [9]
-
- def self.get_ap_cost(skill_id)
- t = $data_skills[skill_id].note
- if t.include?("AP:")
- ap = /AP:(\d+)/.match(t)
- ap = ap[0].split(":")
- return ap[1].to_i
- end
- return 999
- end
-
- end
-
- class Game_Actor < Game_Battler
- attr_reader :ap
- #--------------------------------------------------------------------------
- # ● Aliases setup
- #--------------------------------------------------------------------------
- alias eqskills_setup setup
- def setup(actor_id)
- eqskills_setup(actor_id)
- if Equipment_Skills::Learn_Skills
- @ap = []
- end
- end
- #--------------------------------------------------------------------------
- # ● Rewrites change_equip
- #--------------------------------------------------------------------------
- def change_equip(slot_id, item)
- return unless trade_item_with_party(item, equips[slot_id])
- if equips[slot_id].is_a?(RPG::Weapon)
- unless Equipment_Skills::Weapons[equips[slot_id].id] == nil
- for skill in Equipment_Skills::Weapons[equips[slot_id].id]
- if Equipment_Skills::Learn_Skills
- if @ap[skill] == nil
- @ap[skill] = 0
- end
- unless @ap[skill] >= Equipment_Skills.get_ap_cost(skill)
- forget_skill(skill)
- end
- else
- forget_skill(skill)
- end
- end
- end
- end
- if equips[slot_id].is_a?(RPG::Armor)
- unless Equipment_Skills::Armors[equips[slot_id].id] == nil
- for skill in Equipment_Skills::Armors[equips[slot_id].id]
- if Equipment_Skills::Learn_Skills
- if @ap[skill] == nil
- @ap[skill] = 0
- end
- unless @ap[skill] >= Equipment_Skills.get_ap_cost(skill)
- forget_skill(skill)
- end
- else
- forget_skill(skill)
- end
- end
- end
- end
- return if item && equip_slots[slot_id] != item.etype_id
- @equips[slot_id].object = item
- refresh
- end
- #--------------------------------------------------------------------------
- # ● New Method or Rewrites gain_ap
- #--------------------------------------------------------------------------
- def gain_ap(ap)
- if Equipment_Skills::Learn_Skills
- for item in self.equips
- if item.is_a?(RPG::Weapon)
- unless Equipment_Skills::Weapons[item.id] == nil
- for skill in Equipment_Skills::Weapons[item.id]
- if @ap[skill] == nil
- @ap[skill] = 0
- end
- last_ap = @ap[skill]
- @ap[skill] += ap
- if last_ap < Equipment_Skills.get_ap_cost(skill) and Equipment_Skills.get_ap_cost(skill) <= @ap[skill]
- SceneManager.scene.add_message(actor.name + " learns " + $data_skills[skill].name + ".")
- end
- end
- end
- end
- if item.is_a?(RPG::Armor)
- unless Equipment_Skills::Armors[item.id] == nil
- for skill in Equipment_Skills::Armors[item.id]
- if @ap[skill] == nil
- @ap[skill] = 0
- end
- last_ap = @ap[skill]
- @ap[skill] += ap
- if last_ap < Equipment_Skills.get_ap_cost(skill) and Equipment_Skills.get_ap_cost(skill) <= @ap[skill]
- SceneManager.scene.add_message(actor.name + " learns " + $data_skills[skill].name + ".")
- end
- end
- end
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● Aliases refresh
- #--------------------------------------------------------------------------
- alias eqskills_refresh refresh
- def refresh
- eqskills_refresh
- for item in self.equips
- if item.is_a?(RPG::Weapon)
- unless Equipment_Skills::Weapons[item.id] == nil
- for skill in Equipment_Skills::Weapons[item.id]
- learn_skill(skill)
- end
- end
- end
- if item.is_a?(RPG::Armor)
- unless Equipment_Skills::Armors[item.id] == nil
- for skill in Equipment_Skills::Armors[item.id]
- learn_skill(skill)
- end
- end
- end
- end
- # relearn any class skills you may have forgotten
- self.class.learnings.each do |learning|
- learn_skill(learning.skill_id) if learning.level <= @level
- end
- end
- end
-
-
- class Window_EquipItem < Window_ItemList
- #--------------------------------------------------------------------------
- # ● Rewrites col_max
- #--------------------------------------------------------------------------
- def col_max
- return 1
- end
- #--------------------------------------------------------------------------
- # ● Aliases update_help
- #--------------------------------------------------------------------------
- alias eqskills_update_help update_help
- def update_help
- eqskills_update_help
- if @actor && @status_window
- @status_window.refresh(item)
- end
- end
- end
-
- class Scene_Equip < Scene_MenuBase
- #--------------------------------------------------------------------------
- # ● Rewrites create_item_window
- #--------------------------------------------------------------------------
- alias eqskills_create_item_window create_item_window
- def create_item_window
- wx = @status_window.width # Edited line if you need to merge
- wy = @slot_window.y + @slot_window.height
- ww = @slot_window.width # Edited line if you need to merge
- wh = Graphics.height - wy
- @item_window = Window_EquipItem.new(wx, wy, ww, wh)
- @item_window.viewport = @viewport
- @item_window.help_window = @help_window
- @item_window.status_window = @status_window
- @item_window.actor = @actor
- @item_window.set_handler(:ok, method(:on_item_ok))
- @item_window.set_handler(:cancel, method(:on_item_cancel))
- @slot_window.item_window = @item_window
- end
- end
-
-
- class Window_EquipStatus < Window_Base
- #--------------------------------------------------------------------------
- # ● Rewrites window_height
- #--------------------------------------------------------------------------
- def window_height
- Graphics.height - (2 * line_height + standard_padding * 2)#fitting_height(visible_line_number)
- end
- #--------------------------------------------------------------------------
- # ● Aliases refresh
- #--------------------------------------------------------------------------
- alias eqskills_refresh refresh
- def refresh(item = nil)
- eqskills_refresh
- contents.clear
- draw_actor_name(@actor, 4, 0) if @actor
- 6.times {|i| draw_item(0, line_height * (1 + i), 2 + i) }
- unless item == nil
- if item.is_a?(RPG::Weapon)
- unless Equipment_Skills::Weapons[item.id] == nil
- skills = Equipment_Skills::Weapons[item.id]
- end
- end
- if item.is_a?(RPG::Armor)
- unless Equipment_Skills::Armors[item.id] == nil
- skills = Equipment_Skills::Armors[item.id]
- end
- end
- unless skills == nil
- change_color(normal_color)
- draw_text(4, 168, width, line_height, "Equipment Skills")
- change_color(system_color)
- i = 1
- for skill in skills
- draw_text(4, 168 + 24 * i, width, line_height, $data_skills[skill].name)
- if Equipment_Skills::Learn_Skills and @actor.ap[skill] == nil
- @actor.ap[skill] = 0
- end
- i = i + 1
- if Equipment_Skills::Learn_Skills
- draw_current_and_max_values(4, 168 + 24 * i, width - 50, [@actor.ap[skill],Equipment_Skills.get_ap_cost(skill)].min, Equipment_Skills.get_ap_cost(skill), system_color, system_color)
- i = i + 1
- end
- end
- end
- end
- end
- end
-
-
- class Window_EquipSlot < Window_Selectable
- #--------------------------------------------------------------------------
- # ● Aliases update
- #--------------------------------------------------------------------------
- alias eqskills_update update
- def update
- eqskills_update
- @status_window.refresh(self.item) if self.active == true
- end
- end
-
-
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # ● New method add_text
- #--------------------------------------------------------------------------
- def add_message(text)
- $game_message.add('\.' + text)
- end
- end
- =begin
- Equipment Skills by Level
- by Fomar0153
- Version 1.0
- ----------------------
- Notes
- ----------------------
- Requires an AP System if you want characters to
- learn skills pernamently.
- Scripts should be in this order
- Individual Equipment
- Equipment Levels Up
- Equipment Skills
- Equipment Skills by Level
- If using an AP script it should be above this script.
- ----------------------
- Instructions
- ----------------------
- Follow the instructions in all the other script and then
- edit the Equipment_Skills module below to suit your needs.
- ----------------------
- Known bugs
- ----------------------
- None
- =end
- module Equipment_Skills
-
- Weapons = []
- # Add weapon skills in this format
- # Weapons[weapon_id, level] = [[level,skillid], [level,skillid]]
- Weapons[1] = [[1,8],[5,9]]
-
- Armors = []
- # Add weapon skills in this format
- # Armors[armor_id, level] = [[level,skillid],[level,skillid]]
- Armors[1] = [[1,10]]
-
- end
- class Game_Actor
-
- def change_equip(slot_id, item)
- return unless trade_item_with_party(item, equips[slot_id])
- if equips[slot_id].is_a?(RPG::Weapon)
- unless Equipment_Skills::Weapons[equips[slot_id].id] == nil
- for skill in Equipment_Skills::Weapons[equips[slot_id].id]
- if Equipment_Skills::Learn_Skills
- if @ap[skill[1]] == nil
- @ap[skill[1]] = 0
- end
- unless @ap[skill[1]] >= Equipment_Skills.get_ap_cost(skill[1])
- forget_skill(skill[1])
- end
- else
- forget_skill(skill[1])
- end
- end
- end
- end
- if equips[slot_id].is_a?(RPG::Armor)
- unless Equipment_Skills::Armors[equips[slot_id].id] == nil
- for skill in Equipment_Skills::Armors[equips[slot_id].id]
- if Equipment_Skills::Learn_Skills
- if @ap[skill[1]] == nil
- @ap[skill[1]] = 0
- end
- unless @ap[skill[1]] >= Equipment_Skills.get_ap_cost(skill[1])
- forget_skill(skill[1])
- end
- else
- forget_skill(skill[1])
- end
- end
- end
- end
- return if item && equip_slots[slot_id] != item.etype_id
- if item.nil?
- @equips[slot_id] = Game_CustomEquip.new
- else
- @equips[slot_id] = item
- end
- refresh
- end
-
- def gain_ap(ap)
- if Equipment_Skills::Learn_Skills
- for item in @equips
- if item.is_weapon?
- unless Equipment_Skills::Weapons[item.id] == nil
- for skill in Equipment_Skills::Weapons[item.id]
- if @ap[skill[1]] == nil
- @ap[skill[1]] = 0
- end
- last_ap = @ap[skill[1]]
- @ap[skill[1]] += ap if skill[0] <= item.level
- if last_ap < Equipment_Skills.get_ap_cost(skill[1]) and Equipment_Skills.get_ap_cost(skill[1]) <= @ap[skill[1]]
- SceneManager.scene.add_message(actor.name + " learns " + $data_skills[skill[1]].name + ".")
- end
- end
- end
- end
- if item.is_armor?
- unless Equipment_Skills::Armors[item.id] == nil
- for skill in Equipment_Skills::Armors[item.id]
- if @ap[skill[1]] == nil
- @ap[skill[1]] = 0
- end
- last_ap = @ap[skill[1]]
- @ap[skill[1]] += ap if skill[0] <= item.level
- if last_ap < Equipment_Skills.get_ap_cost(skill[1]) and Equipment_Skills.get_ap_cost(skill[1]) <= @ap[skill[1]]
- SceneManager.scene.add_message(actor.name + " learns " + $data_skills[skill[1]].name + ".")
- end
- end
- end
- end
- end
- end
- end
-
- def refresh
- eqskills_refresh
- for item in @equips
- if item.is_weapon?
- unless Equipment_Skills::Weapons[item.id] == nil
- for skill in Equipment_Skills::Weapons[item.id]
- learn_skill(skill[1]) if skill[0] <= item.level
- end
- end
- end
- if item.is_armor?
- unless Equipment_Skills::Armors[item.id] == nil
- for skill in Equipment_Skills::Armors[item.id]
- learn_skill(skill[1]) if skill[0] <= item.level
- end
- end
- end
- end
- # relearn any class skills you may have forgotten
- self.class.learnings.each do |learning|
- learn_skill(learning.skill_id) if learning.level <= @level
- end
- end
-
- end
- class Game_CustomEquip < Game_BaseItem
-
- def level
- return @level
- end
-
- end
- class Window_EquipStatus < Window_Base
-
- def refresh(item = nil)
- eqskills_refresh
- contents.clear
- draw_actor_name(@actor, 4, 0) if @actor
- 6.times {|i| draw_item(0, line_height * (1 + i), 2 + i) }
- unless item == nil
- if item.is_a?(RPG::Weapon)
- unless Equipment_Skills::Weapons[item.id] == nil
- skills = Equipment_Skills::Weapons[item.id]
- end
- end
- if item.is_a?(RPG::Armor)
- unless Equipment_Skills::Armors[item.id] == nil
- skills = Equipment_Skills::Armors[item.id]
- end
- end
- unless skills == nil
- change_color(normal_color)
- draw_text(4, 168, width, line_height, "Equipment Skills")
- change_color(system_color)
- i = 1
- for skill in skills
- draw_text(4, 168 + 24 * i, width, line_height, $data_skills[skill[1]].name + " (" + skill[0].to_s + ")")
- if Equipment_Skills::Learn_Skills and @actor.ap[skill[1]] == nil
- @actor.ap[skill[1]] = 0
- end
- i = i + 1
- if Equipment_Skills::Learn_Skills
- draw_current_and_max_values(4, 168 + 24 * i, width - 50, [@actor.ap[skill[1]],Equipment_Skills.get_ap_cost(skill[1])].min, Equipment_Skills.get_ap_cost(skill[1]), system_color, system_color)
- i = i + 1
- end
- end
- end
- end
- end
-
- end
复制代码 |
|