Project1
标题:
求高手解决两个脚本冲突问题
[打印本页]
作者:
hanailian1
时间:
2009-5-10 02:41
标题:
求高手解决两个脚本冲突问题
能力突破极限的脚本
和这个商店的5个脚本发生了冲突
#==============================================================================
# ■ Window_ShopBuy
#------------------------------------------------------------------------------
# 购买窗口。
#==============================================================================
class Window_ShopBuy < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化
# x : X 坐标
# y : Y 坐标
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 384, 256)
@shop_goods = $game_temp.shop_goods
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● 帮助文字更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_item(item)
end
end
复制代码
#==============================================================================
# ■ Window_ShopBuy
#------------------------------------------------------------------------------
# 购买窗口。
#==============================================================================
class Window_ShopBuy < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化
# x : X 坐标
# y : Y 坐标
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 384, 256)
@shop_goods = $game_temp.shop_goods
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● 帮助文字更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_item(item)
end
end
复制代码
#==============================================================================
# ■ Window_ShopNumber
#------------------------------------------------------------------------------
# 买卖输入个数窗口。
#==============================================================================
class Window_ShopNumber < Window_Base
#--------------------------------------------------------------------------
# ● 初始化
# x : 窗口 X 坐标
# y : 窗口 Y 坐标
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 384, 256)
@item = nil
@max = 1
@price = 0
@number = 1
end
end
复制代码
#==============================================================================
# ■ Window_ShopHelp
#------------------------------------------------------------------------------
# 商店说明。
#==============================================================================
class Window_ShopHelp < Window_Base
#--------------------------------------------------------------------------
# ● 初始化
#--------------------------------------------------------------------------
def initialize
super(0, 312, 544, 104)
end
#--------------------------------------------------------------------------
# ● 文字设定
# item : 物品
#--------------------------------------------------------------------------
def set_item(item)
if item.nil?
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, 512, 24, $game_temp.shop_word)
@item = nil
return
end
if item != @item
@item = item
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0, 0, 512, 24, @item.description)
if @item.is_a?(RPG::Item)
# 物品范围描述
scope = "[对象] : "
case @item.scope
when 0; scope += "无"
when 1; scope += "敌单体"
when 2; scope += "敌全体"
when 3; scope += "敌单体 连续"
when 4; scope += "敌单体 随机"
when 5; scope += "敌二体 随机"
when 6; scope += "敌三体 随机"
when 7; scope += "我方单体"
when 8; scope += "我方全体"
when 9; scope += "我方单体 (阵亡)"
when 10; scope += "我方全体 (阵亡)"
when 11; scope += "使用者"
end
self.contents.draw_text(0, 24, 512, 24, scope)
# 物品范围描述结束
# 物品恢复效果描述
effection = "[效果] : "
if @item.hp_recovery_rate > 0
effection += "#{Vocab.hp}+#{@item.hp_recovery_rate}% "
elsif @item.hp_recovery_rate < 0
effection += "#{Vocab.hp}-#{@item.hp_recovery_rate}% "
elsif @item.hp_recovery > 0
effection += "#{Vocab.hp}+#{@item.hp_recovery} "
elsif @item.hp_recovery < 0
effection += "#{Vocab.hp}-#{@item.hp_recovery} "
end
if @item.mp_recovery_rate > 0
effection += "#{Vocab.mp}+#{@item.mp_recovery_rate}% "
elsif @item.mp_recovery_rate < 0
effection += "#{Vocab.mp}-#{@item.mp_recovery_rate}% "
elsif @item.mp_recovery > 0
effection += "#{Vocab.mp}+#{@item.mp_recovery} "
elsif @item.mp_recovery < 0
effection += "#{Vocab.mp}-#{@item.mp_recovery} "
end
effection += "伤害#{@item.base_damage} " if @item.base_damage != 0
case @item.parameter_type
when 1
effection += "最大#{Vocab.hp}+#{@item.parameter_points}"
when 2
effection += "最大#{Vocab.mp}+#{@item.parameter_points}"
when 3
effection += "#{Vocab.atk}+#{@item.parameter_points}"
when 4
effection += "#{Vocab.def}+#{@item.parameter_points}"
when 5
effection += "#{Vocab.spi}+#{@item.parameter_points}"
when 6
effection += "#{Vocab.agi}+#{@item.parameter_points}"
end
self.contents.draw_text(0, 48, 512, 24, effection)
# 物品恢复效果描述结束
else
# 武器防具可装备人员描述
equip = "[可装备] : "
for actor in $game_party.members
if actor.equippable?(@item)
equip += "、" if equip != "[可装备] : "
equip += actor.name
end
end
equip += "无" if equip == "[可装备] : "
self.contents.draw_text(0, 24, 512, 24, equip)
# 武器防具可装备人员描述结束
# 武器防具攻防增减描述
effection = "[属性] : "
if @item.atk != 0
effection += "攻击力+#{@item.atk} "
end
if @item.def != 0
effection += "防御力+#{@item.def} "
end
if @item.spi != 0
effection += "精神力+#{@item.spi} "
end
if @item.agi != 0
effection += "敏捷性+#{@item.agi} "
end
# 武器防具攻防增减描述结束
if @item.is_a?(RPG::Armor)
# 防具特殊属性描述
if @item.prevent_critical
effection += "防止会心一击 "
end
if @item.half_mp_cost
effection += "消费MP减半 "
end
if @item.double_exp_gain
effection += "双倍经验 "
end
if @item.auto_hp_recover
effection += "自动恢复HP "
end
# 防具特殊属性描述结束
else
# 武器特殊属性描述
if @item.two_handed
effection += "双手持 "
end
if @item.fast_attack
effection += "先发制人 "
end
if @item.dual_attack
effection += "连击 "
end
if @item.critical_bonus
effection += "频发会心一击 "
end
# 武器特殊属性描述结束
end
unless @item.element_set.empty?
# 武器防具属性描述(左边那一栏需要打勾的)
effection += @item.is_a?(RPG::Armor) ? " [防具状态] : " : " [武器属性] : "
for state in @item.element_set
effection += $data_system.elements[state] + " "
end
# 武器防具属性描述结束
end
unless @item.state_set.empty?
# 武器防具状态描述(右边那一栏需要打勾的)
effection += @item.is_a?(RPG::Armor) ? " [无效化属性] : " : " [附加状态] : "
for state in @item.state_set
effection += $data_states[state].name + " "
end
# 武器防具状态描述结束
end
self.contents.draw_text(0, 48, 512, 24, effection)
end
end
end
end
复制代码
class Game_Temp
attr_accessor :shop_name
attr_accessor :shop_word
attr_accessor :shop_mm
alias old_ini initialize
def initialize
old_ini
@shop_name = ""
@shop_word = ""
@shop_mm = ""
end
end
#==============================================================================
# ■ Scene_Shop
#------------------------------------------------------------------------------
# ショップ画面の処理を行うクラスです。
#==============================================================================
class Scene_Shop < Scene_Base
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
def start
super
create_menu_background
create_command_window
@help_window = Window_ShopHelp.new
@gold_window = Window_Gold.new(384, 56)
@title_window = Window_Base.new(0, 0, @command_window.x, 56)
@title_window.contents.draw_text(0, 0, @title_window.width - 32, 24, $game_temp.shop_name)
@buy_window = Window_ShopBuy.new(0, 56)
@buy_window.active = false
@buy_window.visible = false
@buy_window.help_window = @help_window
@sell_window = Window_ShopSell.new(0, 56, 384, 256)
@sell_window.active = false
@sell_window.visible = false
@sell_window.help_window = @help_window
@number_window = Window_ShopNumber.new(0, 56)
@number_window.active = false
@number_window.visible = false
@loli_sprite = Sprite.new
@loli_sprite.x = 384
@loli_sprite.y = 112
@loli_sprite.bitmap = Cache.picture($game_temp.shop_mm)
@help_window.set_item(nil)
end
#--------------------------------------------------------------------------
# ● 終了処理
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
dispose_command_window
@help_window.dispose
@gold_window.dispose
@title_window.dispose
@buy_window.dispose
@sell_window.dispose
@number_window.dispose
@loli_sprite.bitmap.dispose
@loli_sprite.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
update_menu_background
@help_window.update
@command_window.update
@gold_window.update
@buy_window.update
@sell_window.update
@number_window.update
if @command_window.active
update_command_selection
elsif @buy_window.active
update_buy_selection
elsif @sell_window.active
update_sell_selection
elsif @number_window.active
update_number_input
end
end
#--------------------------------------------------------------------------
# ● コマンドウィンドウの作成
#--------------------------------------------------------------------------
def create_command_window
s1 = Vocab::ShopBuy
s2 = Vocab::ShopSell
s3 = Vocab::ShopCancel
@command_window = Window_Command.new(384, [s1, s2, s3], 3)
@command_window.x = Graphics.width - @command_window.width
if $game_temp.shop_purchase_only
@command_window.draw_item(1, false)
end
end
#--------------------------------------------------------------------------
# ● コマンドウィンドウの解放
#--------------------------------------------------------------------------
def dispose_command_window
@command_window.dispose
end
#--------------------------------------------------------------------------
# ● コマンド選択の更新
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
case @command_window.index
when 0 # 購入する
Sound.play_decision
@command_window.active = false
@buy_window.active = true
@buy_window.visible = true
@buy_window.refresh
@buy_window.update_help
when 1 # 売却する
if $game_temp.shop_purchase_only
Sound.play_buzzer
else
Sound.play_decision
@command_window.active = false
@sell_window.active = true
@sell_window.visible = true
@sell_window.refresh
@sell_window.update_help
end
when 2 # やめる
Sound.play_decision
$scene = Scene_Map.new
end
end
end
#--------------------------------------------------------------------------
# ● 購入アイテム選択の更新
#--------------------------------------------------------------------------
def update_buy_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@command_window.active = true
@buy_window.active = false
@buy_window.visible = false
@help_window.set_item(nil)
return
end
if Input.trigger?(Input::C)
@item = @buy_window.item
number = $game_party.item_number(@item)
if @item == nil or @item.price > $game_party.gold or number == 99
Sound.play_buzzer
else
Sound.play_decision
max = @item.price == 0 ? 99 : $game_party.gold / @item.price
max = [max, 99 - number].min
@buy_window.active = false
@buy_window.visible = false
@number_window.set(@item, max, @item.price)
@number_window.active = true
@number_window.visible = true
end
end
end
#--------------------------------------------------------------------------
# ● 売却アイテム選択の更新
#--------------------------------------------------------------------------
def update_sell_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@command_window.active = true
@sell_window.active = false
@sell_window.visible = false
@help_window.set_item(nil)
elsif Input.trigger?(Input::C)
@item = @sell_window.item
if @item == nil or @item.price == 0
Sound.play_buzzer
else
Sound.play_decision
max = $game_party.item_number(@item)
@sell_window.active = false
@sell_window.visible = false
@number_window.set(@item, max, @item.price / 2)
@number_window.active = true
@number_window.visible = true
end
end
end
#--------------------------------------------------------------------------
# ● 個数入力の更新
#--------------------------------------------------------------------------
def update_number_input
if Input.trigger?(Input::B)
cancel_number_input
elsif Input.trigger?(Input::C)
decide_number_input
end
end
#--------------------------------------------------------------------------
# ● 個数入力のキャンセル
#--------------------------------------------------------------------------
def cancel_number_input
Sound.play_cancel
@number_window.active = false
@number_window.visible = false
case @command_window.index
when 0 # 購入する
@buy_window.active = true
@buy_window.visible = true
when 1 # 売却する
@sell_window.active = true
@sell_window.visible = true
end
end
#--------------------------------------------------------------------------
# ● 個数入力の決定
#--------------------------------------------------------------------------
def decide_number_input
Sound.play_shop
@number_window.active = false
@number_window.visible = false
case @command_window.index
when 0 # 購入する
$game_party.lose_gold(@number_window.number * @item.price)
$game_party.gain_item(@item, @number_window.number)
@gold_window.refresh
@buy_window.refresh
@buy_window.active = true
@buy_window.visible = true
when 1 # 売却する
$game_party.gain_gold(@number_window.number * (@item.price / 2))
$game_party.lose_item(@item, @number_window.number)
@gold_window.refresh
@sell_window.refresh
@sell_window.active = true
@sell_window.visible = true
end
end
end
复制代码
错误是突破能力极限的脚本第587行“ @status_window.item = @buy_window.item”发生了错误,希望高手能帮忙解决一下啊,谢谢。
作者:
hanailian1
时间:
2009-5-10 06:23
能力突破极限脚本我用的是这个
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ ◆ 能力值突破 - KGC_LimitBreak ◆ VX ◆
#_/ ◇ Last update : 2008/01/09 ◇
#_/ ◇http://f44.aaa.livedoor.jp/~ytomy/index.html◇
#_/ ◇ BY 66rpg.com 真の邵东 汉化 ◇
#==============================================================================
# ★ 修改项目 ★
#==============================================================================
module KGC
module LimitBreak
# ◆ 能力値算出方式
# 0..按数据库方式计算。
# (100级以后按PARAMETER_CALC_EXP计算)
#
# 1..使用数据库的2次函数。
# a:等级1的值 b:等级2的值 c:等级3的值 x:现在等级
# 用ax^2+ bx + c算出能力值。
#<例>
#等级1的值 : 4
#等级1的值 : 30
#等级1的值 : 400
#等级为50的能力值
#(4 * 50 + 30) * 50 + 400 = 11900
#等级为100的能力值
# (4 * 100 + 30) * 100 + 400 = 43400
#(请注意使用此方式,数值因等级过高引起过高!)
# 2..使用数据库的2次函数。
# b:等级2的值 c:等级3的值 x:现在等级
# 用bx + c算出能力值
# (为了使用等级2 和 3 的价值,轻松跟2次函数方式的分开使用)
# < 例 >
#等级2的值 : 120
#等级3的值 : 800
#等级为50的能力值
#120 * 50 + 800 = 6800
#等级为100的能力值、
#120 * 100 + 800 = 12800
PARAMETER_CALC_METHOD = 0 #设置能力值计算方式
# ◆ 等级100以后的能力值计算方式
# PARAMETER_CALC_METHOD = 0 的使用
# ↓计算方式如下↓
# (99级的能力值 - 98级的能力值) x (当前等级 - 99)
PARAMETER_CALC_EXP = "(param[99] - param[98]) * (level - 99)"
# ◆ 角色等级上限
ACTOR_FINAL_LEVEL = [] # ←这段不能去掉
# 使用以下方式设置每个角色的最高等级
# ACTOR_FINAL_LEVEL[角色ID] = 最高等级
# <例> ↓ 角色ID为1的最高等级
ACTOR_FINAL_LEVEL[1] = 999
# ◆ 角色等级上限 (默认)
# 没有设定上限的角色,使用这个值为上限值
ACTOR_FINAL_LEVEL_DEFAULT = 999
# ◆ 角色的经验值上限
ACTOR_EXP_LIMIT = 99999999
# ◆ 角色的MaxHP上限
ACTOR_MAXHP_LIMIT = 99999
# ◆ 角色的MaxMP上限
ACTOR_MAXMP_LIMIT = 99999
# ◆ 角色的攻撃力、防御力、精神力、敏捷性上限
ACTOR_PARAMETER_LIMIT = 9999
# ◆ 敌人MaxHP 上限
ENEMY_MAXHP_LIMIT = 9999999
# ◆ 敌人MaxMP 上限
ENEMY_MAXMP_LIMIT = 9999999
# ◆ 敌人攻撃力、防御力、精神力、敏捷性上限
ENEMY_PARAMETER_LIMIT = 9999
# ◆ 敌人能力值修正
# 把敌人的各种能力值做为数据库的0%
# 如果要数据库那样请设为100
ENEMY_MAXHP_RATE = 100 # MaxHP
ENEMY_MAXMP_RATE = 100 # MaxMP
ENEMY_ATK_RATE = 100 # 攻撃力
ENEMY_DEF_RATE = 100 # 防御力
ENEMY_SPI_RATE = 100 # 精神力
ENEMY_AGI_RATE = 100 # 敏捷性
# ◆ 所持金上限
GOLD_LIMIT = 99999999
# ◆ 物品所持数上限
#单独物品上限 请在数据库物品的备注写<物品数上限 n> n为数量
ITEM_NUMBER_LIMIT = 30
module_function
#--------------------------------------------------------------------------
# ○ 敵能力値直接指定
# 在这里,能直接指定敌人的 MaxHP等
# 如果没有指定,将按照数据库的值使用
#--------------------------------------------------------------------------
def set_enemy_parameters
# <例> 如果把ID:10 的敌人的 MaxHP 设置为 2000000
# $data_enemies[10].maxhp = 2000000
# <例> 如果把ID:16 的敌人的攻击力设置为 5000
# $data_enemies[16].atk = 5000
# <例> 如果把ID:20 的敌人的防御力设置为2倍
# $data_enemies[20].def *= 2
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
$imported = {} if $imported == nil
$imported["LimitBreak"] = true
module KGC::LimitBreak
# 正規表現を定義
module Regexp
# ベースアイテム
module BaseItem
# 所持数上限
NUMBER_LIMIT = /^<(?:NUMBER_LIMIT|物品数上限)[ ]*(\d+)>/i
end
end
module_function
#--------------------------------------------------------------------------
# ○ 敵の能力補正を適用
#--------------------------------------------------------------------------
def revise_enemy_parameters
(1...$data_enemies.size).each { |i|
enemy = $data_enemies[i]
enemy.maxhp = enemy.maxhp * ENEMY_MAXHP_RATE / 100
enemy.maxmp = enemy.maxmp * ENEMY_MAXMP_RATE / 100
enemy.atk = enemy.atk * ENEMY_ATK_RATE / 100
enemy.def = enemy.def * ENEMY_DEF_RATE / 100
enemy.spi = enemy.spi * ENEMY_SPI_RATE / 100
enemy.agi = enemy.agi * ENEMY_AGI_RATE / 100
}
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ RPG::BaseItem
#==============================================================================
class RPG::BaseItem
#--------------------------------------------------------------------------
# ○ 限界突破のキャッシュ生成
#--------------------------------------------------------------------------
def create_limit_break_cache
@__number_limit = KGC::LimitBreak::ITEM_NUMBER_LIMIT
@note.split(/[\r\n]+/).each { |line|
if line =~ KGC::LimitBreak::Regexp::BaseItem::NUMBER_LIMIT
# 所持数上限
@__number_limit = $1.to_i
end
}
end
#--------------------------------------------------------------------------
# ○ 所持数上限取得
#--------------------------------------------------------------------------
def number_limit
create_limit_break_cache if @__number_limit == nil
return @__number_limit
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Battler
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● MaxHP の制限値取得
#--------------------------------------------------------------------------
def maxhp_limit
return KGC::LimitBreak::ENEMY_MAXHP_LIMIT
end
#--------------------------------------------------------------------------
# ○ MaxMP の制限値取得
#--------------------------------------------------------------------------
def maxmp_limit
return KGC::LimitBreak::ENEMY_MAXMP_LIMIT
end
#--------------------------------------------------------------------------
# ● MaxMP の取得
#--------------------------------------------------------------------------
def maxmp
return [[base_maxmp + @maxmp_plus, 0].max, maxmp_limit].min
end
#--------------------------------------------------------------------------
# ○ 各種パラメータの制限値取得
#--------------------------------------------------------------------------
def parameter_limit
return KGC::LimitBreak::ENEMY_PARAMETER_LIMIT
end
#--------------------------------------------------------------------------
# ● 攻撃力の取得
#--------------------------------------------------------------------------
def atk
n = [base_atk + @atk_plus, 1].max
states.each { |state| n *= state.atk_rate / 100.0 }
n = [[Integer(n), 1].max, parameter_limit].min
return n
end
#--------------------------------------------------------------------------
# ● 防御力の取得
#--------------------------------------------------------------------------
def def
n = [base_def + @def_plus, 1].max
states.each { |state| n *= state.def_rate / 100.0 }
n = [[Integer(n), 1].max, parameter_limit].min
return n
end
#--------------------------------------------------------------------------
# ● 精神力の取得
#--------------------------------------------------------------------------
def spi
n = [base_spi + @spi_plus, 1].max
states.each { |state| n *= state.spi_rate / 100.0 }
n = [[Integer(n), 1].max, parameter_limit].min
return n
end
#--------------------------------------------------------------------------
# ● 敏捷性の取得
#--------------------------------------------------------------------------
def agi
n = [base_agi + @agi_plus, 1].max
states.each { |state| n *= state.agi_rate / 100.0 }
n = [[Integer(n), 1].max, parameter_limit].min
return n
end
#--------------------------------------------------------------------------
# ● MaxHP の設定
# new_maxhp : 新しい MaxHP
#--------------------------------------------------------------------------
def maxhp=(new_maxhp)
@maxhp_plus += new_maxhp - self.maxhp
@maxhp_plus = [[@maxhp_plus, -maxhp_limit].max, maxhp_limit].min
@hp = [@hp, self.maxhp].min
end
#--------------------------------------------------------------------------
# ● MaxMP の設定
# new_maxmp : 新しい MaxMP
#--------------------------------------------------------------------------
def maxmp=(new_maxmp)
@maxmp_plus += new_maxmp - self.maxmp
@maxmp_plus = [[@maxmp_plus, -maxmp_limit].max, maxmp_limit].min
@mp = [@mp, self.maxmp].min
end
#--------------------------------------------------------------------------
# ● 攻撃力の設定
# new_atk : 新しい攻撃力
#--------------------------------------------------------------------------
def atk=(new_atk)
@atk_plus += new_atk - self.atk
@atk_plus = [[@atk_plus, -parameter_limit].max, parameter_limit].min
end
#--------------------------------------------------------------------------
# ● 防御力の設定
# new_def : 新しい防御力
#--------------------------------------------------------------------------
def def=(new_def)
@def_plus += new_def - self.def
@def_plus = [[@def_plus, -parameter_limit].max, parameter_limit].min
end
#--------------------------------------------------------------------------
# ● 精神力の設定
# new_spi : 新しい精神力
#--------------------------------------------------------------------------
def spi=(new_spi)
@spi_plus += new_spi - self.spi
@spi_plus = [[@spi_plus, -parameter_limit].max, parameter_limit].min
end
#--------------------------------------------------------------------------
# ● 敏捷性の設定
# agi : 新しい敏捷性
#--------------------------------------------------------------------------
def agi=(new_agi)
@agi_plus += new_agi - self.agi
@agi_plus = [[@agi_plus, -parameter_limit].max, parameter_limit].min
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Actor
#==============================================================================
class Game_Actor < Game_Battler
#--------------------------------------------------------------------------
# ● 経験値計算
#--------------------------------------------------------------------------
def make_exp_list
@exp_list = Array.new(final_level + 2)
@exp_list[1] = @exp_list[final_level + 1] = 0
m = actor.exp_basis
n = 0.75 + actor.exp_inflation / 200.0
(2..final_level).each { |i|
@exp_list[i] = @exp_list[i-1] + Integer(m)
m *= 1 + n
n *= 0.9
}
end
#--------------------------------------------------------------------------
# ○ 最終レベルの取得
#--------------------------------------------------------------------------
def final_level
n = KGC::LimitBreak::ACTOR_FINAL_LEVEL[self.id]
return (n != nil ? n : KGC::LimitBreak::ACTOR_FINAL_LEVEL_DEFAULT)
end
#--------------------------------------------------------------------------
# ● MaxHP の制限値取得
#--------------------------------------------------------------------------
def maxhp_limit
return KGC::LimitBreak::ACTOR_MAXHP_LIMIT
end
#--------------------------------------------------------------------------
# ○ MaxMP の制限値取得
#--------------------------------------------------------------------------
def maxmp_limit
return KGC::LimitBreak::ACTOR_MAXMP_LIMIT
end
#--------------------------------------------------------------------------
# ○ 各種パラメータの制限値取得
#--------------------------------------------------------------------------
def parameter_limit
return KGC::LimitBreak::ACTOR_PARAMETER_LIMIT
end
#--------------------------------------------------------------------------
# ○ 経験値の制限値取得
#--------------------------------------------------------------------------
def exp_limit
return KGC::LimitBreak::ACTOR_EXP_LIMIT
end
#--------------------------------------------------------------------------
# ● 経験値の変更
# exp : 新しい経験値
# show : レベルアップ表示フラグ
#--------------------------------------------------------------------------
def change_exp(exp, show)
last_level = @level
last_skills = skills
@exp = [[exp, exp_limit].min, 0].max
while @exp >= @exp_list[@level+1] && @exp_list[@level+1] > 0
level_up
end
while @exp < @exp_list[@level]
level_down
end
@hp = [@hp, maxhp].min
@mp = [@mp, maxmp].min
if show && @level > last_level
display_level_up(skills - last_skills)
end
end
#--------------------------------------------------------------------------
# ● レベルの変更
# level : 新しいレベル
# show : レベルアップ表示フラグ
#--------------------------------------------------------------------------
def change_level(level, show)
level = [[level, final_level].min, 1].max
change_exp(@exp_list[level], show)
end
#--------------------------------------------------------------------------
# ○ 基本パラメータの取得
#--------------------------------------------------------------------------
def base_parameter(type)
case KGC::LimitBreak::PARAMETER_CALC_METHOD
when 0 # 数式定義
if @level >= 100
calc_text = KGC::LimitBreak::PARAMETER_CALC_EXP.dup
calc_text.gsub!(/level/i) { "@level" }
calc_text.gsub!(/param\[(\d+)\]/i) {
"actor.parameters[type, #{$1.to_i}]"
}
return actor.parameters[type, 99] + eval(calc_text)
end
when 1 # 二次関数
a = actor.parameters[type, 1]
b = actor.parameters[type, 2]
c = actor.parameters[type, 3]
return ((a * @level + b) * @level + c)
when 2 # 一次関数
b = actor.parameters[type, 2]
c = actor.parameters[type, 3]
return (b * @level + c)
end
return actor.parameters[type, @level]
end
#--------------------------------------------------------------------------
# ● 基本 MaxHP の取得
#--------------------------------------------------------------------------
def base_maxhp
return base_parameter(0)
end
#--------------------------------------------------------------------------
# ● 基本 MaxMP の取得
#--------------------------------------------------------------------------
def base_maxmp
return base_parameter(1)
end
#--------------------------------------------------------------------------
# ● 基本攻撃力の取得
#--------------------------------------------------------------------------
def base_atk
n = base_parameter(2)
equips.compact.each { |item| n += item.atk }
return n
end
#--------------------------------------------------------------------------
# ● 基本防御力の取得
#--------------------------------------------------------------------------
def base_def
n = base_parameter(3)
equips.compact.each { |item| n += item.def }
return n
end
#--------------------------------------------------------------------------
# ● 基本精神力の取得
#--------------------------------------------------------------------------
def base_spi
n = base_parameter(4)
equips.compact.each { |item| n += item.spi }
return n
end
#--------------------------------------------------------------------------
# ● 基本敏捷性の取得
#--------------------------------------------------------------------------
def base_agi
n = base_parameter(5)
equips.compact.each { |item| n += item.agi }
return n
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Party
#==============================================================================
class Game_Party < Game_Unit
#--------------------------------------------------------------------------
# ○ 所持金の制限値取得
#--------------------------------------------------------------------------
def gold_limit
return KGC::LimitBreak::GOLD_LIMIT
end
#--------------------------------------------------------------------------
# ● ゴールドの増加 (減少)
# n : 金額
#--------------------------------------------------------------------------
def gain_gold(n)
@gold = [[@gold + n, 0].max, gold_limit].min
end
#--------------------------------------------------------------------------
# ● アイテムの増加 (減少)
# item : アイテム
# n : 個数
# include_equip : 装備品も含める
#--------------------------------------------------------------------------
def gain_item(item, n, include_equip = false)
number = item_number(item)
case item
when RPG::Item
@items[item.id] = [[number + n, 0].max, item.number_limit].min
when RPG::Weapon
@weapons[item.id] = [[number + n, 0].max, item.number_limit].min
when RPG::Armor
@armors[item.id] = [[number + n, 0].max, item.number_limit].min
end
n += number
if include_equip && n < 0
members.each { |actor|
while n < 0 && actor.equips.include?(item)
actor.discard_equip(item)
n += 1
end
}
end
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Window_ShopBuy
#==============================================================================
class Window_ShopBuy < Window_Selectable
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
number = $game_party.item_number(item)
enabled = (item.price <= $game_party.gold && number < item.number_limit)
rect = item_rect(index)
self.contents.clear_rect(rect)
draw_item_name(item, rect.x, rect.y, enabled)
rect.width -= 4
self.contents.draw_text(rect, item.price, 2)
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_Title
#==============================================================================
class Scene_Title < Scene_Base
#--------------------------------------------------------------------------
# ● データベースのロード
#--------------------------------------------------------------------------
alias load_database_KGC_LimitBreak load_database
def load_database
load_database_KGC_LimitBreak
set_enemy_parameters
end
#--------------------------------------------------------------------------
# ● 戦闘テスト用データベースのロード
#--------------------------------------------------------------------------
alias load_bt_database_KGC_LimitBreak load_bt_database
def load_bt_database
load_bt_database_KGC_LimitBreak
set_enemy_parameters
end
#--------------------------------------------------------------------------
# ○ エネミーの能力値を設定
#--------------------------------------------------------------------------
def set_enemy_parameters
KGC::LimitBreak.revise_enemy_parameters
KGC::LimitBreak.set_enemy_parameters
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_File
#==============================================================================
class Scene_File < Scene_Base
#--------------------------------------------------------------------------
# ● セーブデータの読み込み
# file : 読み込み用ファイルオブジェクト (オープン済み)
#--------------------------------------------------------------------------
alias read_save_data_KGC_LimitBreak read_save_data
def read_save_data(file)
read_save_data_KGC_LimitBreak(file)
(1...$data_actors.size).each { |i|
actor = $game_actors[i]
actor.make_exp_list
# レベル上限チェック
if actor.level > actor.final_level
while actor.level > actor.final_level
actor.level_down
end
# 減少した HP などを反映させるためのおまじない
actor.change_level(actor.final_level, false)
end
}
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_Shop
#==============================================================================
class Scene_Shop < Scene_Base
#--------------------------------------------------------------------------
# ● 購入アイテム選択の更新
#--------------------------------------------------------------------------
def update_buy_selection
@status_window.item = @buy_window.item
if Input.trigger?(Input::B)
Sound.play_cancel
@command_window.active = true
@dummy_window.visible = true
@buy_window.active = false
@buy_window.visible = false
@status_window.visible = false
@status_window.item = nil
@help_window.set_text("")
return
end
if Input.trigger?(Input::C)
@item = @buy_window.item
number = $game_party.item_number(@item)
if @item == nil || @item.price > $game_party.gold ||
number == @item.number_limit
Sound.play_buzzer
else
Sound.play_decision
max = (@item.price == 0 ?
@item.number_limit : $game_party.gold / @item.price)
max = [max, @item.number_limit - number].min
@buy_window.active = false
@buy_window.visible = false
@number_window.set(@item, max, @item.price)
@number_window.active = true
@number_window.visible = true
end
end
end
end
复制代码
作者:
hanailian1
时间:
2009-5-11 02:11
能给我说说这句话的意思也好啊, @status_window.item = @buy_window.item
拜托各位大大了
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1