grimreaper1357
Member
When you try to change a modified weapons name (with Z) the game crashes with this error:
Script 'KGC - Equipment Modification' line 1654: NoMethodError occurred.
undefined method 'name=' for nil:NilClass
Can some help me out?
Credit goes to twilight and KGC
Script 'KGC - Equipment Modification' line 1654: NoMethodError occurred.
undefined method 'name=' for nil:NilClass
Can some help me out?
Credit goes to twilight and KGC
Code:
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ â—† Equipmen Alteration - KGC_AlterEquipment â—†
#_/----------------------------------------------------------------------------
#_/ Alters the equipment and gives added effects or increases parameters in specified areas
# Call Script: call_equip_alter
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
$data_states = load_data("Data/States.rxdata") if $data_states == nil
#================================================= =============================
# ★ ã‚«ã‚¹ã‚¿ãƒžã‚¤ã‚ºé …ç›® ★
#================================================= =============================
module KGC
# â—†The Maximum number of Weapons that can be altered
# More than 300 can possibly cause errors so be careful.
AEQ_WEAPON_MAX = 50
# â—†Maximum number of aloud Armors that can be altered
AEQ_ARMOR_MAX = 50
# â—†Add a number suffix to the altered item
# If true it will add a +1, +2 to the equipment to show how many times it has been altered
AEQ_SHOW_ALTER_COUNT = false
# â—†Prescribed form of frequency of remodelling
# <{n}?Frequency of remodelling>
AEQ_ALTER_COUNT_FORMAT = "+{n}"
# â—†Actor ID used for renaming equipment
AEQ_RENAME_ACTOR_ID = 13
# â—†The maximum number of letters of equipment name (MAX: 16)
AEQ_RENAME_MAX_LENGTH = 16
# â—†The button which moves to the equipment name modification picture
# (A, X, recommending Y and Z. When it makes nil, there is no equipment name modification function)
AEQ_RENAME_BUTTON = Input::A
# â—†Alteration Max
# How many times the selected item can be altered
# When its set to a negative number then the item has a limitless alteration count
AEQ_ALTERABLE_COUNT = 3 # Setting this to 10 would limit it to only being altered 10 times.
# I would set it to a low number so as to prevent creating a overpowered weapon.
# â—†Exclusion equipment type
# Equipment ID's that cannot be altered
AEQ_EXCLUDE_EQUIP_TYPE = []
# â—†Exclusion weapon
# Insert the Weapon ID's for special weapons that cannot be altered (Such as a Ultima Weapon)
AEQ_EXCLUDE_WEAPONS = []
# â—†Exclusion guard
# Insert the Weapon ID's for special armos that cannot be altered (Such as the Genji Armor)
AEQ_EXCLUDE_ARMORS = []
# â—†Weapon factor summary
# "Alteration Name", "Information", [[Type, ID],... ], Default Cost, [Item ID, Amount], ...]
# I am not sure why the Fire is in the parenthesis, I just left it their in case it might cause an
# error if removed
# Type: 0 = Attribute Add on (IE. Fire Strike),
# Type: 1 = Status Infliction (IE. Poison Touch)
# Type: 2 = Status Removal, The skill removes a state from the target (IE.Poison Eater),
# Type: 3 = Power Increase (IE. Intelligence + 20)
#
# ID: The ID used when the Attribute or Status is Added. [Note uses the status menu to calculate the
# Increase in power. (IE. Intelligence + 20 for Status ID 25 which is Intel 20] power increase
# for the weapon/armor)]
#
# Alteration Cost: The ratio used to calculate the price of the weapon
#
# The Item ID's and amount that is required to perform the necessary modifications.
#
# Code
# ["[Effect] Strike", "Description", [[Type, ID]], Base Cost, [Item ID, Amount]],
AEQ_WEAPON_FACTORS = [
# Elemental Strikes
["[Fire] Strike", "Imbues weapon with the Fire Element.", [[0, 1]], 10, [13, 1]],
# Status Strikes
["[Poison] Touch", "Adds a venomous effect to your weapon.", [[1, 3]], 20, [10, 1], [13, 1]],
# Status Removals
["[Poison] Eater", "Removes the Poisoned State.", [[2, 3]], 10, [13, 1]],
# Weapon Increase
["[Mind] Boost", "Increase intelligence by 10", [[3, 27]], 10, [13, 1]],
["[Attack] Boost", "Increase Atk by 10", [[3, 28]], 10, [13, 1]],
] # â†DO NOT REMOVE
# â—†Armor Alteration
# ["Name", "Description", [[Type, ID], ...], Base Cost, [Item ID, Amount], ...]
# [Types] 0 = Element Protection, 1= Status Protection 3 = Parameter Increase
# ID = Same as weapons, choose the ID to add on to the selected armor
# Base Cost = The initial cost of the modification
AEQ_ARMOR_FACTORS = [
# Elemental Guard
["[Fire] Guard", "Reduces damage from Fire Base Attacks.", [[0, 1]], 10, [13, 1]],
# Status Guard
["[Poison] Guard", "Defends against poison", [[1, 3]], 20, [10, 1], [13, 1]],
# Parameter Boost
["[Attack] Boost", "Increase Atk by 10", [[3, 28]], 10, [13, 1]]
# Because (it is difficult, just this)
] # â†Do Not Remove
# â—†This is basically the formula for calculating the cost of the upgrade to a weapon
AEQ_WEAPON_PRICE_FORMULA =
"(atk + pdef + mdef + (str_p + dex_p + agi_p + int_p).abs) * 30"
# â—† Same as above but for armors
AEQ_ARMOR_PRICE_FORMULA =
"(pdef + mdef + (eva + str_p + dex_p + agi_p + int_p).abs) * 30"
# â—†Background
AEQ_BACK_TRANSPARENT = false
# â—†?Weapon remodelling? name
AEQ_COMMAND_WEAPON_ALTER = "Modify Weapon"
# â—†?Remodelling equipment cancellation? name
AEQ_COMMAND_WEAPON_DISPOSE = "Destroy Weapon"
# â—†?Guard remodelling? name
AEQ_COMMAND_ARMOR_ALTER = "Modify Armor"
# â—†?Remodelling guard cancellation? name
AEQ_COMMAND_ARMOR_DISPOSE = "Destroy Armor"
# Yes if you want to free up space, you must destroy an item
# â—†?Weapon remodelling? help
AEQ_HELP_WEAPON_ALTER = "What weapon do you want to modify?"
# â—†ã€Œæ”¹é€ è£…å‚™ç ´æ£„ã€ãƒ˜ãƒ«ãƒ—
AEQ_HELP_WEAPON_DISPOSE = "What weapon do you want to destroy? (You won't get it back if you do)"
# â—†ã€Œé˜²å…·æ”¹é€ ã€ãƒ˜ãƒ«ãƒ—
AEQ_HELP_ARMOR_ALTER = "What armor do you want to modify"
# â—†ã€Œæ”¹é€ é˜²å…·ç ´æ£„ã€ãƒ˜ãƒ«ãƒ—
AEQ_HELP_ARMOR_DISPOSE = "What armor do you want to destroy? (You won't get it back if you do)"
# â—†æ”¹é€ æ¦å™¨ãƒªã‚¹ãƒˆç©ºæ¬„ã®è¡¨ç¤ºæ–‡å—列
AEQ_TEXT_NO_WEAPON = "- Open Slot -"
# â—†æ”¹é€ é˜²å…·ãƒªã‚¹ãƒˆç©ºæ¬„ã®è¡¨ç¤ºæ–‡å—列
AEQ_TEXT_NO_ARMOR = "- Open Slot -"
# â—†This defines the range of your elements
# ([Integer][Range]クラスã®é…列)
AEQ_ELEMENT_RANGE = [1..8]
# â—†This defines the range of your status
# (指定方法㯠AEQ_ELEMENT_RANGE ã¨åŒæ§˜)
AEQ_STATE_RANGE = [1...$data_states.size]
# â—†æ¦å™¨æ”¹é€ 確èªã‚³ãƒžãƒ³ãƒ‰
AEQ_ALTER_COMMAND = ["Modify", "Cancel"]
# â—†æ¦å™¨ç ´æ£„確èªã‚³ãƒžãƒ³ãƒ‰
AEQ_DISPOSE_COMMAND = ["Destroy", "Cancel"]
# â—†ãƒ•ã‚¡ã‚¯ã‚¿ãƒ¼ä»˜åŠ ç¢ºèªã‚³ãƒžãƒ³ãƒ‰
AEQ_FACTOR_COMMAND = ["Add", "Cancel"]
# â€»â†‘ï¼“é …ç›®ã¯ã€ã‚³ãƒžãƒ³ãƒ‰æ•°ã‚’変更ã™ã‚‹ã¨ãƒã‚°ã‚Šã¾ã™ã€‚
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
$imported = {} if $imported == nil
$imported["AlterEquipment"] = true
#--------------------------------------------------------------------------
# ◠装備å“æ”¹é€ ç”»é¢å‘¼ã³å‡ºã—
#--------------------------------------------------------------------------
def call_equip_alter
# プレイヤーã®å§¿å‹¢ã‚’矯æ£
$game_player.straighten
# 装備å“æ”¹é€ ç”»é¢ã«åˆ‡ã‚Šæ›¿ãˆ
$scene = Scene_AlterEquipment.new
end
module AlteredEquipment
#--------------------------------------------------------------------------
# â— æ”¹é€ æ¦å™¨ç ´æ£„
# index : æ”¹é€ æ¦å™¨ç•ªå· (1~AEQ_WEAPON_MAX)
#--------------------------------------------------------------------------
def self.dispose_weapon(index)
# ç ´æ£„ã§ããªã„å ´åˆã¯æˆ»ã‚‹
if index < 1 || index > KGC::AEQ_WEAPON_MAX ||
$game_party.alter_weapons[index - 1] == nil
return
end
# 指定æ¦å™¨ã‚’ç ´æ£„
id = $game_party.alter_weapons[index - 1].id
$game_party.alter_weapons[index - 1] = nil
$data_weapons[id] = RPG::Weapon2.new
$game_party.lose_weapon(id, 99)
end
#--------------------------------------------------------------------------
# â— æ”¹é€ é˜²å…·ç ´æ£„
# index : æ”¹é€ é˜²å…·ç•ªå· (1~AEQ_ARMOR_MAX)
#--------------------------------------------------------------------------
def self.dispose_armor(index)
# ç ´æ£„ã§ããªã„å ´åˆã¯æˆ»ã‚‹
if index < 1 || index > KGC::AEQ_ARMOR_MAX ||
$game_party.alter_armors[index - 1] == nil
return
end
# æŒ‡å®šé˜²å…·ã‚’ç ´æ£„
id = $game_party.alter_armors[index - 1].id
$game_party.alter_armors[index - 1] = nil
$data_armors[id] = RPG::Armor2.new
$game_party.lose_armor(id, 99)
end
#--------------------------------------------------------------------------
# ◠指定IDã®æ¦å™¨ã¨ã€ãã‚Œã‚’æ”¹é€ ã—ãŸæ¦å™¨ã‚’ã™ã¹ã¦ç ´æ£„
# id : æ¦å™¨ID
#--------------------------------------------------------------------------
def self.dispose_all_weapon(id)
weapons = $game_party.alter_weapons.find_all { |w|
w != nil && w.original_id == id
}
weapons.each { |w|
index = $game_party.alter_weapons.index(w) + 1
dispose_weapon(index)
}
$game_party.lose_weapon(id, 99)
end
#--------------------------------------------------------------------------
# ◠指定IDã®é˜²å…·ã¨ã€ãã‚Œã‚’æ”¹é€ ã—ãŸé˜²å…·ã‚’ã™ã¹ã¦ç ´æ£„
# id : 防具ID
#--------------------------------------------------------------------------
def self.dispose_all_armor(id)
armors = $game_party.alter_armors.find_all { |a|
a != nil && a.original_id == id
}
armors.each { |a|
index = $game_party.alter_armors.index(a) + 1
dispose_armor(index)
}
$game_party.lose_armor(id, 99)
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#================================================= =============================
# â– æ¦å™¨ãƒ»é˜²å…· 共用モジュール
#================================================= =============================
module KGC_AlterEquipment_WA
#--------------------------------------------------------------------------
# ◠オリジナルåå–å¾—
#--------------------------------------------------------------------------
def original_name
return @name
end
#--------------------------------------------------------------------------
# â— æ”¹é€ å¯èƒ½å›žæ•°å–å¾—
#--------------------------------------------------------------------------
def alterable_count
return original_name =~ /\[ALT[ ]*(\d+)\]/i ? $1.to_i : KGC::AEQ_ALTERABLE_COUNT
end
end
module KGC_AlterEquipment_WA2
attr_writer :change_name
#--------------------------------------------------------------------------
# â— æ”¹é€ å›žæ•°ã‚’é™¤åŽ»ã—ãŸå称å–å¾—
#--------------------------------------------------------------------------
def plain_name
if KGC::AEQ_SHOW_ALTER_COUNT
rg = (KGC::AEQ_ALTER_COUNT_FORMAT.gsub(/(.*){n}/i) {
"[#{$1}]{#{$1.scan(/./).size}}\\d+"
}).gsub(/\-/) {"\-"}
return name.gsub(%r(#{rg}$)i) {""}
else
return name
end
end
#--------------------------------------------------------------------------
# â— æ®‹ã‚Šæ”¹é€ å¯èƒ½å›žæ•°å–å¾—
#--------------------------------------------------------------------------
def alterable_count
return (@name =~ /\[ALT[ ]*(\d+)\]/i ? $1.to_i : KGC::AEQ_ALTERABLE_COUNT) - @alter_count
end
#--------------------------------------------------------------------------
# ◠オリジナルIDå–å¾—
#--------------------------------------------------------------------------
def original_id
return @original_id
end
#--------------------------------------------------------------------------
# â— æ”¹é€ å›žæ•°å–å¾—
#--------------------------------------------------------------------------
def alter_count
@alter_count = 0 if @alter_count == nil
return @alter_count
end
#--------------------------------------------------------------------------
# â— æ”¹é€ å›žæ•°åŠ ç®—
#--------------------------------------------------------------------------
def add_alter_count
@alter_count = 0 if @alter_count == nil
@alter_count += 1
self.show_alter_count
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#================================================= =============================
# â– RPG::Weapon
#================================================= =============================
class RPG::Weapon
include KGC_AlterEquipment_WA
#--------------------------------------------------------------------------
# â— å称å–å¾—
#--------------------------------------------------------------------------
def name
return @name.gsub(/\[.*\]/) {""}
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#================================================= =============================
# â– RPG::Armor
#================================================= =============================
class RPG::Armor
include KGC_AlterEquipment_WA
#--------------------------------------------------------------------------
# â— å称å–å¾—
#--------------------------------------------------------------------------
def name
return @name.gsub(/\[.*\]/) {""}
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#================================================= =============================
# â– RPG::Weapon2
#================================================= =============================
class RPG::Weapon2 < RPG::Weapon
include KGC_AlterEquipment_WA2
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
def initialize
super
@original_id = 0
@original_price = 0
@alter_count = 0
end
#--------------------------------------------------------------------------
# â— å称å–å¾—
#--------------------------------------------------------------------------
def name
return @name.gsub(/\[.*\]/) {""}
end
#--------------------------------------------------------------------------
# â— æ”¹é€ è²»ç”¨ç®—å‡º
#--------------------------------------------------------------------------
def alter_cost(factor)
if @original_price == 0
formula = KGC::AEQ_WEAPON_PRICE_FORMULA.dup
formula.gsub!(/atk/i) {"@atk"}
formula.gsub!(/pdef/i) {"@pdef"}
formula.gsub!(/mdef/i) {"@mdef"}
formula.gsub!(/str_p/i) {"@str_plus"}
formula.gsub!(/dex_p/i) {"@dex_plus"}
formula.gsub!(/agi_p/i) {"@agi_plus"}
formula.gsub!(/int_p/i) {"@int_plus"}
cost = eval(formula)
else
cost = @original_price
end
cost = cost * factor[3] / 100
return Integer(cost)
end
#--------------------------------------------------------------------------
# â— ãƒ•ã‚¡ã‚¯ã‚¿ãƒ¼ä»˜åŠ å¯å¦
#--------------------------------------------------------------------------
def can_add_factor?(factor)
# ä¾¡æ ¼åˆ¤å®š
if $game_party.gold < self.alter_cost(factor)
return false
end
# アイテム所æŒåˆ¤å®š
(4...factor.size).each { |i|
if $game_party.item_number(factor[i][0]) < factor[i][1]
return false
end
}
(0...factor[2].size).each { |i|
# ä»˜åŠ æ¸ˆã¿åˆ¤å®š
case factor[2][i][0]
when 0 # 属性
if @element_set.include?(factor[2][i][1])
return false
end
when 1 # ステート付åŠ
if @plus_state_set.include?(factor[2][i][1])
return false
end
when 2 # ステート解除
if @minus_state_set.include?(factor[2][i][1])
return false
end
end
}
return true
end
#--------------------------------------------------------------------------
# ◠ファクター付åŠ
#--------------------------------------------------------------------------
def add_factor(factor)
(0...factor[2].size).each { |i|
# ファクターを付åŠ
case factor[2][i][0]
when 0 # 属性
@element_set.push(factor[2][i][1])
@element_set.sort!
when 1 # ステート付åŠ
@plus_state_set.push(factor[2][i][1])
@plus_state_set.sort!
when 2 # ステート解除
@minus_state_set.push(factor[2][i][1])
@minus_state_set.sort!
when 3 # 能力値
return if (state = $data_states[factor[2][i][1]]) == nil
if state.original_name =~ /\[EQAL[ ]*(?:%|ï¼…)\]/i
@atk += @atk * state.atk_rate / 100
@pdef += @pdef * state.pdef_rate / 100
@mdef += @mdef * state.mdef_rate / 100
@str_plus += @str_plus * state.str_rate / 100
@dex_plus += @dex_plus * state.dex_rate / 100
@agi_plus += @agi_plus * state.agi_rate / 100
@int_plus += @int_plus * state.int_rate / 100
else
@atk += state.atk_rate
@pdef += state.pdef_rate
@mdef += state.mdef_rate
@str_plus += state.str_rate
@dex_plus += state.dex_rate
@agi_plus += state.agi_rate
@int_plus += state.int_rate
end
end
}
# 金消費
$game_party.lose_gold(self.alter_cost(factor))
# アイテム消費
(4...factor.size).each { |i|
$game_party.lose_item(factor[i][0], factor[i][1])
}
# æ”¹é€ å›žæ•°åŠ ç®—
self.add_alter_count
end
#--------------------------------------------------------------------------
# â— æ¦å™¨æƒ…å ±ã‚’ã‚³ãƒ”ãƒ¼
#--------------------------------------------------------------------------
def copy_weapon(id)
weapon = $data_weapons[id]
@original_id = id
@change_name = nil
self.show_alter_count
@icon_name = weapon.icon_name.dup
@description = weapon.description.dup
@animation1_id = weapon.animation1_id
@animation2_id = weapon.animation2_id
@price = 0
@original_price = weapon.price
@atk = weapon.atk
@pdef = weapon.pdef
@mdef = weapon.mdef
@str_plus = weapon.str_plus
@dex_plus = weapon.dex_plus
@agi_plus = weapon.agi_plus
@int_plus = weapon.int_plus
@element_set = weapon.element_set.dup
@plus_state_set = weapon.plus_state_set.dup
@minus_state_set = weapon.minus_state_set.dup
# 装備å¯èƒ½è€…ã‚’è¨å®š
(1...$data_classes.size).each { |i|
actor_class = $data_classes[i]
# æ”¹é€ å¯¾è±¡ã®æ¦å™¨ã‚’装備ã§ãるクラスã®å ´åˆ
if actor_class.weapon_set.include?(id)
# 装備å¯èƒ½æ¦å™¨ã«è¿½åŠ
actor_class.weapon_set.push(@id)
else
# 装備ã§ããªã„å ´åˆã¯è£…å‚™å¯èƒ½æ¦å™¨ã‹ã‚‰å‰Šé™¤
actor_class.weapon_set.delete(@id)
end
}
end
#--------------------------------------------------------------------------
# â— æ”¹é€ å›žæ•°è¡¨ç¤º
#--------------------------------------------------------------------------
def show_alter_count
@name = (@change_name != nil ? @change_name :
$data_weapons[@original_id].original_name).dup
if KGC::AEQ_SHOW_ALTER_COUNT
@name += KGC::AEQ_ALTER_COUNT_FORMAT.gsub(/{n}/i) {"#{@alter_count}"}
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#================================================= =============================
# â– RPG::Armor2
#================================================= =============================
class RPG::Armor2 < RPG::Armor
include KGC_AlterEquipment_WA2
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
def initialize
super
@original_id = 0
@original_price = 0
@alter_count = 0
end
#--------------------------------------------------------------------------
# â— å称å–å¾—
#--------------------------------------------------------------------------
def name
return @name.gsub(/\[.*\]/) {""}
end
#--------------------------------------------------------------------------
# â— æ”¹é€ è²»ç”¨ç®—å‡º
#--------------------------------------------------------------------------
def alter_cost(factor)
if @original_price == 0
formula = KGC::AEQ_ARMOR_PRICE_FORMULA.dup
formula.gsub!(/pdef/i) {"@pdef"}
formula.gsub!(/mdef/i) {"@mdef"}
formula.gsub!(/eva/i) {"@eva"}
formula.gsub!(/str_p/i) {"@str_plus"}
formula.gsub!(/dex_p/i) {"@dex_plus"}
formula.gsub!(/agi_p/i) {"@agi_plus"}
formula.gsub!(/int_p/i) {"@int_plus"}
cost = eval(formula)
else
cost = @original_price
end
cost = cost * factor[3] / 100
return Integer(cost)
end
#--------------------------------------------------------------------------
# â— ãƒ•ã‚¡ã‚¯ã‚¿ãƒ¼ä»˜åŠ å¯å¦
#--------------------------------------------------------------------------
def can_add_factor?(factor)
# ä¾¡æ ¼åˆ¤å®š
if $game_party.gold < self.alter_cost(factor)
return false
end
# アイテム所æŒåˆ¤å®š
(4...factor.size).each { |i|
if $game_party.item_number(factor[i][0]) < factor[i][1]
return false
end
}
(0...factor[2].size).each { |i|
# ä»˜åŠ æ¸ˆã¿åˆ¤å®š
case factor[2][i][0]
when 0 # 防御属性
if @guard_element_set.include?(factor[2][i][1])
return false
end
when 1 # 防御ステート
if @guard_state_set.include?(factor[2][i][1])
return false
end
end
}
return true
end
#--------------------------------------------------------------------------
# ◠ファクター付åŠ
#--------------------------------------------------------------------------
def add_factor(factor)
# 金消費
$game_party.lose_gold(self.alter_cost(factor))
# アイテム消費
(4...factor.size).each { |i|
$game_party.lose_item(factor[i][0], factor[i][1])
}
(0...factor[2].size).each { |i|
# ファクターを付åŠ
case factor[2][i][0]
when 0 # 防御属性
@guard_element_set.push(factor[2][i][1])
@guard_element_set.sort!
when 1 # 防御ステート
@guard_state_set.push(factor[2][i][1])
@guard_state_set.sort!
when 2 # 能力値
return if (state = $data_states[factor[2][i][1]]) == nil
if state.original_name =~ /\[EQAL[ ]*(?:%|ï¼…)\]/i
@pdef += @pdef * state.pdef_rate / 100
@mdef += @mdef * state.mdef_rate / 100
@eva += @eva * state.eva / 100
@str_plus += @str_plus * state.str_rate / 100
@dex_plus += @dex_plus * state.dex_rate / 100
@agi_plus += @agi_plus * state.agi_rate / 100
@int_plus += @int_plus * state.int_rate / 100
else
@pdef += state.pdef_rate
@mdef += state.mdef_rate
@eva += state.eva
@str_plus += state.str_rate
@dex_plus += state.dex_rate
@agi_plus += state.agi_rate
@int_plus += state.int_rate
end
end
}
# æ”¹é€ å›žæ•°åŠ ç®—
self.add_alter_count
end
#--------------------------------------------------------------------------
# â— é˜²å…·æƒ…å ±ã‚’ã‚³ãƒ”ãƒ¼
#--------------------------------------------------------------------------
def copy_armor(id)
armor = $data_armors[id]
@original_id = id
@change_name = nil
self.show_alter_count
@icon_name = armor.icon_name.dup
@description = armor.description.dup
@kind = armor.kind
@auto_state_id = armor.auto_state_id
@price = 0
@original_price = armor.price
@pdef = armor.pdef
@mdef = armor.mdef
@eva = armor.eva
@str_plus = armor.str_plus
@dex_plus = armor.dex_plus
@agi_plus = armor.agi_plus
@int_plus = armor.int_plus
@guard_element_set = armor.guard_element_set.dup
@guard_state_set = armor.guard_state_set.dup
# 装備å¯èƒ½è€…ã‚’è¨å®š
(1...$data_classes.size).each { |i|
actor_class = $data_classes[i]
# æ”¹é€ å¯¾è±¡ã®æ¦å™¨ã‚’装備ã§ãるクラスã®å ´åˆ
if actor_class.armor_set.include?(id)
# 装備å¯èƒ½æ¦å™¨ã«è¿½åŠ
actor_class.armor_set.push(@id)
else
# 装備ã§ããªã„å ´åˆã¯è£…å‚™å¯èƒ½æ¦å™¨ã‹ã‚‰å‰Šé™¤
actor_class.armor_set.delete(@id)
end
}
end
#--------------------------------------------------------------------------
# â— æ”¹é€ å›žæ•°è¡¨ç¤º
#--------------------------------------------------------------------------
def show_alter_count
@name = (@change_name != nil ? @change_name :
$data_armors[@original_id].original_name).dup
if KGC::AEQ_SHOW_ALTER_COUNT
@name += KGC::AEQ_ALTER_COUNT_FORMAT.gsub(/{n}/i) {"#{@alter_count}"}
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#================================================= =============================
# â– RPG::State
#================================================= =============================
class RPG::State
#--------------------------------------------------------------------------
# â— åå‰ã®å–å¾—
#--------------------------------------------------------------------------
def name
return @name.gsub(/\[.*\]/) {""}
end
#--------------------------------------------------------------------------
# ◠オリジナルåå–å¾—
#--------------------------------------------------------------------------
def original_name
return @name
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#================================================= =============================
# â– Game_Temp
#================================================= =============================
class Game_Temp
#--------------------------------------------------------------------------
# ◠公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :equipment_alter_rename, :equipment_alter_rename_type,
:equipment_alter_rename_id
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
alias initialize_KGC_AlterEquipment initialize
def initialize
initialize_KGC_AlterEquipment
@equipment_alter_rename = false
@equipment_alter_rename_type = @equipment_alter_rename_id = 0
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#================================================= =============================
# â– Game_Party
#================================================= =============================
class Game_Party
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
alias initialize_KGC_AlterEquipment initialize
def initialize
# å…ƒã®å‡¦ç†ã‚’実行
initialize_KGC_AlterEquipment
@alter_weapons, @alter_armors = [], []
end
#--------------------------------------------------------------------------
# â— æ”¹é€ è£…å‚™å–å¾—
#--------------------------------------------------------------------------
def alter_weapons
@alter_weapons = [] if @alter_weapons == nil
return @alter_weapons
end
#--------------------------------------------------------------------------
# â— æ”¹é€ è£…å‚™è¨å®š
#--------------------------------------------------------------------------
def alter_weapons=(ary)
@alter_weapons = [] if @alter_weapons == nil
@alter_weapons = ary
end
#--------------------------------------------------------------------------
# â— æ”¹é€ é˜²å…·å–å¾—
#--------------------------------------------------------------------------
def alter_armors
@alter_armors = [] if @alter_armors == nil
return @alter_armors
end
#--------------------------------------------------------------------------
# â— æ”¹é€ é˜²å…·è¨å®š
#--------------------------------------------------------------------------
def alter_armors=(ary)
@alter_armors = [] if @alter_armors == nil
@alter_armors = ary
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#================================================= =============================
# â– Window_AlterEquipmentCommand
#------------------------------------------------------------------------------
# ã€€è£…å‚™æ”¹é€ ç”»é¢ã§ã€æ“作をé¸æŠžã™ã‚‹ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã§ã™ã€‚
#================================================= =============================
class Window_AlterEquipmentCommand < Window_Selectable
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
def initialize
super(0, 64, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@commands = [KGC::AEQ_COMMAND_WEAPON_ALTER, KGC::AEQ_COMMAND_WEAPON_DISPOSE,
KGC::AEQ_COMMAND_ARMOR_ALTER, KGC::AEQ_COMMAND_ARMOR_DISPOSE]
@item_max = @commands.size
@column_max = @commands.size
@item_width = (width - 32) / @commands.size
self.z = 1000
self.index = 0
refresh
end
#--------------------------------------------------------------------------
# ◠リフレッシュ
#--------------------------------------------------------------------------
def refresh
for i in [email=0...@commands.size]0...@commands.size[/email]
rect = Rect.new(@item_width * i, 0, @item_width, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.font.color = system_color
self.contents.draw_text(rect, @commands[i], 1)
end
end
#--------------------------------------------------------------------------
# ◠カーソルã®çŸ©å½¢æ›´æ–°
#--------------------------------------------------------------------------
def update_cursor_rect
if index != -1
self.cursor_rect.set(@item_width * index, 0, @item_width, 32)
end
end
#--------------------------------------------------------------------------
# ◠ヘルプテã‚スト更新
#--------------------------------------------------------------------------
def update_help
case self.index
when 0
@help_window.set_text(KGC::AEQ_HELP_WEAPON_ALTER)
when 1
@help_window.set_text(KGC::AEQ_HELP_WEAPON_DISPOSE )
when 2
@help_window.set_text(KGC::AEQ_HELP_ARMOR_ALTER)
when 3
@help_window.set_text(KGC::AEQ_HELP_ARMOR_DISPOSE)
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#================================================= =============================
# â– Window_AlterEquipmentLeft
#------------------------------------------------------------------------------
# ã€€è£…å‚™æ”¹é€ ç”»é¢ã§ã€æ”¹é€ ã™ã‚‹è£…備スãƒãƒƒãƒˆã®ä¸€è¦§ã‚’表示ã™ã‚‹ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã§ã™ã€‚
#================================================= =============================
class Window_AlterEquipmentLeft < Window_Selectable
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
def initialize
super(0, 128, 320, 352)
self.active = false
self.index = -1
self.back_opacity = 160 if KGC::AEQ_BACK_TRANSPARENT
@column_max = 1
refresh
end
#--------------------------------------------------------------------------
# ◠装備ã®å–å¾—
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ◠リフレッシュ
#--------------------------------------------------------------------------
def refresh(type = 0)
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# スãƒãƒƒãƒˆä¸€è¦§ã‚’作æˆ
case type
when 0
for i in 0...KGC::AEQ_WEAPON_MAX
weapon = $game_party.alter_weapons[i]
@data.push(weapon)
end
when 1
for i in 0...KGC::AEQ_ARMOR_MAX
armor = $game_party.alter_armors[i]
@data.push(armor)
end
end
# ビットマップを作æˆã—ã€å…¨é …目をæç”»
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i, type)
end
end
#--------------------------------------------------------------------------
# â— é …ç›®ã®æç”»
#--------------------------------------------------------------------------
def draw_item(index, type)
item = @data[index]
x = 36
y = index * 32
self.contents.font.color = text_color(6)
self.contents.draw_text(x - 32, y, 32, 32, (index + 1).to_s, 1)
if item != nil
case type
when 0
number = $game_party.weapon_number(item.id)
when 1
number = $game_party.armor_number(item.id)
end
ac = item.alterable_count
if number > 0 && ac != 0
self.contents.font.color = normal_color
opacity = 255
else
self.contents.font.color = disabled_color
opacity = ac != 0 ? 255 : 160
end
icon = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, icon, icon.rect, opacity)
self.contents.draw_text(x + 28, y, 224, 32, item.name)
else
self.contents.font.color = disabled_color
case type
when 0
self.contents.draw_text(x, y, 256, 32, KGC::AEQ_TEXT_NO_WEAPON, 1)
when 1
self.contents.draw_text(x, y, 256, 32, KGC::AEQ_TEXT_NO_ARMOR, 1)
end
end
end
#--------------------------------------------------------------------------
# â— é …ç›®ã®å†æç”»
#--------------------------------------------------------------------------
def redraw_item(index, type)
case type
when 0
@data[index] = $game_party.alter_weapons[index]
when 1
@data[index] = $game_party.alter_armors[index]
end
self.contents.fill_rect(0, index * 32, 288, 32, Color.new(0, 0, 0, 0))
self.draw_item(index, type)
end
#--------------------------------------------------------------------------
# ◠ヘルプテã‚スト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#================================================= =============================
# â– Window_AlterEquipmentRight
#------------------------------------------------------------------------------
# ã€€è£…å‚™æ”¹é€ ç”»é¢ã§ã€æ‰€æŒã—ã¦ã„る装備一覧を表示ã™ã‚‹ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã§ã™ã€‚
#================================================= =============================
class Window_AlterEquipmentRight < Window_Selectable
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
def initialize
super(320, 128, 320, 352)
self.active = false
self.visible = false
self.index = 0
self.back_opacity = 160 if KGC::AEQ_BACK_TRANSPARENT
@column_max = 1
refresh
end
#--------------------------------------------------------------------------
# ◠装備ã®å–å¾—
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ◠リフレッシュ
#--------------------------------------------------------------------------
def refresh(type = 0)
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
case type
when 0
unless KGC::AEQ_EXCLUDE_EQUIP_TYPE.include?(0)
# 所æŒã—ã¦ã„ã‚‹æ¦å™¨ã‚’追åŠ
(1...$alter_weapon_start).each { |i|
if $game_party.weapon_number(i) > 0 &&
$data_weapons[i].alterable_count != 0 &&
!KGC::AEQ_EXCLUDE_WEAPONS.include?(i)
@data << $data_weapons[i]
end
}
end
when 1
# 所æŒã—ã¦ã„る防具を追åŠ
(1...$alter_armor_start).each { |i|
if $game_party.armor_number(i) > 0 &&
$data_armors[i].alterable_count != 0 &&
!KGC::AEQ_EXCLUDE_ARMORS.include?(i) &&
!KGC::AEQ_EXCLUDE_EQUIP_TYPE.include?($data_armors[i].kind + 1)
@data << $data_armors[i]
end
}
end
# 個数㌠0 ã®å ´åˆã¯ nil を追åŠ
@data.push(nil) if @data.size == 0
# ビットマップを作æˆã—ã€å…¨é …目をæç”»
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i, type)
end
end
#--------------------------------------------------------------------------
# â— é …ç›®ã®æç”»
#--------------------------------------------------------------------------
def draw_item(index, type)
item = @data[index]
return if item == nil
x = 4
y = index * 32
icon = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, icon, icon.rect)
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 216, 32, item.name)
case type
when 0
number = $game_party.weapon_number(item.id)
when 1
number = $game_party.armor_number(item.id)
end
self.contents.draw_text(x + 244, y, 16, 32, ":", 1)
self.contents.draw_text(x + 260, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# ◠ヘルプテã‚スト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#================================================= =============================
# â– Window_AlterEquipmentStatus
#------------------------------------------------------------------------------
# ã€€è£…å‚™æ”¹é€ ç”»é¢ã§ã€é¸æŠžã—ãŸè£…å‚™ã®èƒ½åŠ›ã‚’表示ã™ã‚‹ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã§ã™ã€‚
#================================================= =============================
class Window_AlterEquipmentStatus < Window_Base
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
def initialize
super(320, 128, 320, 352)
self.contents = Bitmap.new(width - 32, height - 32)
self.back_opacity = 160 if KGC::AEQ_BACK_TRANSPARENT
self.z = 500
refresh(nil)
end
#--------------------------------------------------------------------------
# ◠リフレッシュ
#--------------------------------------------------------------------------
def refresh(item, factor = nil)
self.contents.clear
if factor == nil # アイテムステータス
return if item == nil || item.name == ""
# é …ç›®æç”»
self.contents.font.size = 20
self.contents.font.color = system_color
case item
when RPG::Weapon
self.contents.draw_text(4, 0, 80, 32, $data_system.words.atk)
self.contents.draw_text(148, 0, 80, 32, $data_system.words.pdef)
self.contents.draw_text(4, 32, 80, 32, $data_system.words.mdef)
when RPG::Armor
self.contents.draw_text(4, 0, 80, 32, $data_system.words.pdef)
self.contents.draw_text(148, 0, 80, 32, $data_system.words.mdef)
self.contents.draw_text(4, 32, 80, 32, "回é¿ä¿®æ£")
end
self.contents.draw_text(148, 32, 80, 32, $data_system.words.str)
self.contents.draw_text(4, 64, 80, 32, $data_system.words.dex)
self.contents.draw_text(148, 64, 80, 32, $data_system.words.agi)
self.contents.draw_text(4, 96, 80, 32, $data_system.words.int)
self.contents.font.color = normal_color
case item
when RPG::Weapon
self.contents.draw_text(84, 0, 48, 32, item.atk.to_s, 2)
self.contents.draw_text(228, 0, 48, 32, item.pdef.to_s, 2)
self.contents.draw_text(84, 32, 48, 32, item.mdef.to_s, 2)
when RPG::Armor
self.contents.draw_text(84, 0, 48, 32, item.pdef.to_s, 2)
self.contents.draw_text(228, 0, 48, 32, item.mdef.to_s, 2)
self.contents.draw_text(84, 32, 48, 32, item.eva.to_s, 2)
end
self.contents.draw_text(228, 32, 48, 32, item.str_plus.to_s, 2)
self.contents.draw_text(84, 64, 48, 32, item.dex_plus.to_s, 2)
self.contents.draw_text(228, 64, 48, 32, item.agi_plus.to_s, 2)
self.contents.draw_text(84, 96, 48, 32, item.int_plus.to_s, 2)
# 属性æç”»
ix, iy = 4, 148
self.contents.font.size = 18
self.contents.font.color = system_color
case item
when RPG::Weapon
self.contents.draw_text(32, 128, 160, 20, "攻撃属性")
elements = item.element_set.dup
when RPG::Armor
self.contents.draw_text(32, 128, 160, 20, "防御属性")
elements = item.guard_element_set.dup
end
self.contents.font.color = normal_color
skip = true
elements.each { |element|
KGC::AEQ_ELEMENT_RANGE.each { |rng|
case rng
when Integer
skip = element != rng
when Range
skip = !rng.member?(element)
end
}
next if skip
text = "[#{$data_system.elements[element]}]"
cx = self.contents.text_size(text).width
self.contents.draw_text(ix, iy, cx + 8, 20, text)
ix += cx
if ix >= 264
ix = 4
iy += 20
if iy >= 192
break
end
end
}
# ä»˜åŠ /防御ステートæç”»
ix, iy = 4, 212
self.contents.font.color = system_color
case item
when RPG::Weapon
self.contents.draw_text(32, 192, 160, 20, "ä»˜åŠ ã‚¹ãƒ†ãƒ¼ãƒˆ")
states = item.plus_state_set.dup
when RPG::Armor
self.contents.draw_text(32, 192, 160, 20, "防御ステート")
states = item.guard_state_set.dup
end
self.contents.font.color = normal_color
self.contents.font.size = 18
skip = true
states.each { |state|
KGC::AEQ_STATE_RANGE.each { |rng|
case rng
when Integer
skip = state != rng
when Range
skip = !rng.member?(state)
end
}
next if skip
text = "[#{$data_states[state].name}]"
cx = self.contents.text_size(text).width
self.contents.draw_text(ix, iy, cx + 8, 20, text)
ix += cx
if ix >= 264
ix = 4
iy += 24
if iy >= 256
break
end
end
}
return if item.is_a?(RPG::Armor)
# 解除ステートæç”»
ix, iy = 4, 276
self.contents.font.color = system_color
self.contents.draw_text(32, 256, 160, 20, "解除ステート")
self.contents.font.color = normal_color
self.contents.font.size = 18
skip = true
item.minus_state_set.each { |state|
KGC::AEQ_STATE_RANGE.each { |rng|
case rng
when Integer
skip = state != rng
when Range
skip = !rng.member?(state)
end
}
next if skip
text = "[#{$data_states[state].name}]"
cx = self.contents.text_size(text).width
self.contents.draw_text(ix, iy, cx + 8, 20, text)
ix += cx
if ix >= 264
ix = 4
iy += 24
if iy >= 320
break
end
end
}
else # ç´ æアイテム数
return if factor == nil
self.contents.font.size = 22
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 128, 32, "æ”¹é€ è²»ç”¨")
self.contents.draw_text(232, 0, 48, 32, $data_system.words.gold)
self.contents.font.color = normal_color
self.contents.draw_text(104, 0, 128, 32, item.alter_cost(factor).to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 32, 128, 32, "所æŒé‡‘")
self.contents.draw_text(232, 32, 48, 32, $data_system.words.gold)
self.contents.font.color = normal_color
self.contents.draw_text(104, 32, 128, 32, $game_party.gold.to_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(4, 64, 128, 32, "消費アイテム")
for i in 4...factor.size
self.contents.font.color = system_color
self.contents.draw_text(4, 128 + (i - 4) * 64, 80, 32, "å¿…è¦æ•°")
self.contents.draw_text(144, 128 + (i - 4) * 64, 80, 32, "所æŒæ•°")
self.contents.font.color = normal_color
text = $data_items[factor[i][0]].name
icon = RPG::Cache.icon($data_items[factor[i][0]].icon_name)
self.contents.blt(4, 100 + (i - 4) * 64, icon, icon.rect)
self.contents.draw_text(32, 96 + (i - 4) * 64, 256, 32, text)
self.contents.draw_text(84, 128 + (i - 4) * 64, 48, 32, factor[i][1].to_s, 2)
self.contents.draw_text(224, 128 + (i - 4) * 64, 48, 32, $game_party.item_number(factor[i][0]).to_s, 2)
end
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#================================================= =============================
# â– Window_AlterEquipmentFactor
#------------------------------------------------------------------------------
# ã€€è£…å‚™æ”¹é€ ç”»é¢ã§ã€ä»˜åŠ è¦ç´ 一覧を表示ã™ã‚‹ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ã§ã™ã€‚
#================================================= =============================
class Window_AlterEquipmentFactor < Window_Selectable
#--------------------------------------------------------------------------
# ◠オブジェクトåˆæœŸåŒ–
#--------------------------------------------------------------------------
def initialize
super(320, 128, 320, 352)
@column_max = 1
self.active = false
self.visible = false
self.index = 0
self.back_opacity = 160 if KGC::AEQ_BACK_TRANSPARENT
end
#--------------------------------------------------------------------------
# ◠ファクターã®å–å¾—
#--------------------------------------------------------------------------
def factor
return @data[self.index]
end
#--------------------------------------------------------------------------
# ◠リフレッシュ
#--------------------------------------------------------------------------
def refresh(item)
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@item = item
@data = []
# ä»˜åŠ ã§ãるファクターを追åŠ
case item
when RPG::Weapon
factors = KGC::AEQ_WEAPON_FACTORS
when RPG::Armor
factors = KGC::AEQ_ARMOR_FACTORS
end
for i in 0...factors.size
factor = factors[i]
next if factor == nil
@data.push(factor)
end
# 個数㌠0 ã®å ´åˆã¯ nil を追åŠ
@data.push(nil) if @data.size == 0
# ビットマップを作æˆã—ã€å…¨é …目をæç”»
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# â— é …ç›®ã®æç”»
#--------------------------------------------------------------------------
def draw_item(index)
factor = @data[index]
return if factor == nil
x = 4
y = index * 32
if @item.can_add_factor?(factor)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.draw_text(x, y, 280, 32, factor[0], 0)
end
#--------------------------------------------------------------------------
# ◠ヘルプテã‚スト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.factor == nil ? "" : self.factor[1])
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#================================================= =============================
# â– Scene_Title
#================================================= =============================
class Scene_Title
#--------------------------------------------------------------------------
# ◠コマンド : ニューゲーãƒ
#--------------------------------------------------------------------------
alias command_new_game_KGC_AlterEquipment command_new_game
def command_new_game
# å…ƒã®å‡¦ç†ã‚’実行
command_new_game_KGC_AlterEquipment
# æ”¹é€ è£…å‚™ã‚’åˆæœŸåŒ–
$alter_weapon_start = $data_weapons.size
for i in 0...KGC::AEQ_WEAPON_MAX
$data_weapons[$alter_weapon_start + i] = RPG::Weapon2.new
end
$alter_armor_start = $data_armors.size
for i in 0...KGC::AEQ_ARMOR_MAX
$data_armors[$alter_armor_start + i] = RPG::Armor2.new
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#================================================= =============================
# â– Scene_Load
#================================================= =============================
class Scene_Load < Scene_File
#--------------------------------------------------------------------------
# ◠決定時ã®å‡¦ç†
#--------------------------------------------------------------------------
alias on_decision_KGC_AlterEquipment on_decision
def on_decision(filename)
# å…ƒã®å‡¦ç†ã‚’実行
on_decision_KGC_AlterEquipment(filename)
# ファイルãŒå˜åœ¨ã—ãªã„å ´åˆã¯æˆ»ã‚‹
return unless FileTest.exist?(filename)
# æ”¹é€ è£…å‚™ã‚’å–å¾—
$alter_weapon_start = $data_weapons.size
for i in 0...KGC::AEQ_WEAPON_MAX
if $game_party.alter_weapons[i] == nil
$data_weapons[$alter_weapon_start + i] = RPG::Weapon2.new
else
$data_weapons[$alter_weapon_start + i] = $game_party.alter_weapons[i]
weapon = $game_party.alter_weapons[i]
weapon.show_alter_count
# 装備å¯èƒ½è€…ã‚’è¨å®š
for i in 1...$data_classes.size
actor_class = $data_classes[i]
# æ”¹é€ å¯¾è±¡ã®æ¦å™¨ã‚’装備ã§ãるクラスã®å ´åˆ
if actor_class.weapon_set.include?(weapon.original_id )
# 装備å¯èƒ½æ¦å™¨ã«è¿½åŠ
actor_class.weapon_set.push(weapon.id)
else
# 装備ã§ããªã„å ´åˆã¯è£…å‚™å¯èƒ½æ¦å™¨ã‹ã‚‰å‰Šé™¤
actor_class.weapon_set.delete(weapon.id)
end
end
end
end
$alter_armor_start = $data_armors.size
for i in 0...KGC::AEQ_ARMOR_MAX
if $game_party.alter_armors[i] == nil
$data_armors[$alter_armor_start + i] = RPG::Armor2.new
else
$data_armors[$alter_armor_start + i] = $game_party.alter_armors[i]
armor = $game_party.alter_armors[i]
armor.show_alter_count
# 装備å¯èƒ½è€…ã‚’è¨å®š
for i in 1...$data_classes.size
actor_class = $data_classes[i]
# æ”¹é€ å¯¾è±¡ã®æ¦å™¨ã‚’装備ã§ãるクラスã®å ´åˆ
if actor_class.armor_set.include?(armor.original_id)
# 装備å¯èƒ½æ¦å™¨ã«è¿½åŠ
actor_class.armor_set.push(armor.id)
else
# 装備ã§ããªã„å ´åˆã¯è£…å‚™å¯èƒ½æ¦å™¨ã‹ã‚‰å‰Šé™¤
actor_class.armor_set.delete(armor.id)
end
end
end
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#================================================= =============================
# â– Scene_Name
#================================================= =============================
class Scene_Name
#--------------------------------------------------------------------------
# ◠メイン処ç†
#--------------------------------------------------------------------------
alias main_KGC_AlterEquipment main
def main
# å…ƒã®å‡¦ç†ã‚’実行
main_KGC_AlterEquipment
# 装備å変更ã®å ´åˆ
if $game_temp.equipment_alter_rename
case $game_temp.equipment_alter_rename_type
when 0
type = "weapon"
when 1
type = "armor"
end
equip = eval("$data_#{type}s[$game_temp.equipment_alter_rename_id]")
equip.change_name = @actor.name.dup
equip.show_alter_count
$game_temp.equipment_alter_rename_type = 0
$game_temp.equipment_alter_rename_id = 0
$game_temp.equipment_alter_rename = false
# 装備å“æ”¹é€ ç”»é¢ã«åˆ‡ã‚Šæ›¿ãˆ
$scene = Scene_AlterEquipment.new
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#================================================= =============================
# â– Scene_AlterEquipment
#------------------------------------------------------------------------------
# ã€€è£…å‚™æ”¹é€ ç”»é¢ã®å‡¦ç†ã‚’è¡Œã†ã‚¯ãƒ©ã‚¹ã§ã™ã€‚
#================================================= =============================
class Scene_AlterEquipment
#--------------------------------------------------------------------------
# ◠メイン処ç†
#--------------------------------------------------------------------------
def main
@spriteset = Spriteset_Map.new if KGC::AEQ_BACK_TRANSPARENT
# ウィンドウを作æˆ
if $imported["HelpExtension"]
@help_window = Window_HelpExtension.new
else
@help_window = Window_Help.new
end
@help_window.back_opacity = 160 if KGC::AEQ_BACK_TRANSPARENT
@command_window = Window_AlterEquipmentCommand.new
@left_window = Window_AlterEquipmentLeft.new
@right_window = Window_AlterEquipmentRight.new
@factor_window = Window_AlterEquipmentFactor.new
@status_window = Window_AlterEquipmentStatus.new
# ヘルプウィンドウを関連付ã‘
@command_window.help_window = @help_window
@left_window.help_window = @help_window
@right_window.help_window = @help_window
@factor_window.help_window = @help_window
# カーソルä½ç½®ã‚’è¨å®š
@left_window.index = 0
@status_window.refresh(@left_window.item)
# トランジション実行
Graphics.transition
# メインループ
loop do
# ゲーム画é¢ã‚’æ›´æ–°
Graphics.update
# å…¥åŠ›æƒ…å ±ã‚’æ›´æ–°
Input.update
# フレーム更新
update
# ç”»é¢ãŒåˆ‡ã‚Šæ›¿ã‚ã£ãŸã‚‰ãƒ«ãƒ¼ãƒ—ã‚’ä¸æ–
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@help_window.dispose
@command_window.dispose
@left_window.dispose
@right_window.dispose
@factor_window.dispose
@status_window.dispose
@left_command_window.dispose if @left_command_window != nil
@right_command_window.dispose if @right_command_window != nil
@factor_command_window.dispose if @factor_command_window != nil
@spriteset.dispose if KGC::AEQ_BACK_TRANSPARENT
end
#--------------------------------------------------------------------------
# ◠リフレッシュ
#--------------------------------------------------------------------------
def refresh
@command_window.refresh
@left_window.refresh
@right_window.refresh
@factor_window.refresh(nil)
@status_window.refresh(nil)
end
#--------------------------------------------------------------------------
# ◠フレーム更新
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@command_window.update
@left_window.update
@right_window.update
@factor_window.update
# コマンドウィンドウãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ: update_command を呼ã¶
if @command_window.active
update_command
return
end
# レフトウィンドウãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ: update_left を呼ã¶
if @left_window.active
@status_window.x = 320
update_left
return
end
# ライトウィンドウãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ: update_right を呼ã¶
if @right_window.active
@status_window.x = 0
update_right
return
end
# ãƒ•ã‚¡ã‚¯ã‚¿ãƒ¼è¿½åŠ ã‚¦ã‚£ãƒ³ãƒ‰ã‚¦ãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ: update_factor を呼ã¶
if @factor_window.active
@status_window.x = 0
update_factor
return
end
# レフトコマンドウィンドウãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ: update_left_command を呼ã¶
if @left_command_window != nil && @left_command_window.active
update_left_command
return
end
# ライトコマンドウィンドウãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ: update_right_command を呼ã¶
if @right_command_window != nil && @right_command_window.active
update_right_command
return
end
# ファクターコマンドウィンドウãŒã‚¢ã‚¯ãƒ†ã‚£ãƒ–ã®å ´åˆ: update_factor_command を呼ã¶
if @factor_command_window != nil && @factor_command_window.active
update_factor_command
return
end
end