赞 | 0 |
VIP | 9 |
好人卡 | 1 |
积分 | 1 |
经验 | 15070 |
最后登录 | 2016-8-8 |
在线时间 | 556 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 556 小时
- 注册时间
- 2010-11-18
- 帖子
- 774
|
5星屑
本帖最后由 s196050 于 2015-9-18 00:02 编辑
物品分类脚本 和这个新增装备脚本怎么整合,或者 如何调用新增的“项链”“鞋子”今日物品分类
或者 165~176行应该怎么写
#============================================================================== # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息 #============================================================================== #============================================================================== # ■ Harts_Window_ItemTitle #------------------------------------------------------------------------------ # アイテム画面で、タイトルを表示するウィンドウ。 #============================================================================== class Harts_Window_ItemTitle < Window_Base #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(0, 0, 160, 64) self.contents = Bitmap.new(width - 32, height - 32) self.contents.clear self.contents.font.color = normal_color self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1) end end #============================================================================== # ■ Harts_Window_ItemCommand #------------------------------------------------------------------------------ # アイテムの種別選択を行うウィンドウです。 #============================================================================== class Harts_Window_ItemCommand < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(0, 64, 160, 360) self.contents = Bitmap.new(width - 32, height - 32) @item_max = 10 @commands = ["一般用", "战斗用", $data_system.words.weapon, $data_system.words.armor1, $data_system.words.armor2, $data_system.words.armor3, "戒指", "项链","鞋","特殊道具"] refresh self.index = 0 end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear for i in 0...@item_max draw_item(i, normal_color) end end #-------------------------------------------------------------------------- # ● 項目の描画 # index : 項目番号 # color : 文字色 #-------------------------------------------------------------------------- def draw_item(index, color) self.contents.font.color = color y = index * 32 self.contents.draw_text(4, y, 128, 32, @commands[index]) end #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help case self.index when 0 @text = @commands[0] when 1 @text = @commands[1] when 2 @text = @commands[2] when 3 @text = @commands[3] when 4 @text = @commands[4] when 5 @text = @commands[5] when 6 @text = @commands[6] when 7 @text = @commands[7] when 8 @text = @commands[8] when 9 @text = @commands[9] end @help_window.set_text(@text) end end #============================================================================== # ■ Window_Item #------------------------------------------------------------------------------ # アイテム画面で、所持アイテムの一覧を表示するウィンドウです。 #============================================================================== class Harts_Window_ItemList < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(160, 0, 480, 416) refresh self.index = 0 end #-------------------------------------------------------------------------- # ● アイテムの取得 #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] end #-------------------------------------------------------------------------- # ● アイテム一覧設定 # command : 選択中のコマンド #-------------------------------------------------------------------------- def set_item(command) refresh case command when 0 for i in 1...$data_items.size if ($data_items[i].occasion == 0 or $data_items[i].occasion == 2) and $game_party.item_number(i) > 0 @data.push($data_items[i]) end end when 1 for i in 1...$data_items.size if ($data_items[i].occasion == 1 and $game_party.item_number(i) > 0) @data.push($data_items[i]) end end when 2 for i in 1...$data_weapons.size if $game_party.weapon_number(i) > 0 @data.push($data_weapons[i]) end end when 3 for i in 1...$data_armors.size if $data_armors[i].kind == 0 and $game_party.armor_number(i) > 0 @data.push($data_armors[i]) end end when 4 for i in 1...$data_armors.size if $data_armors[i].kind == 1 and $game_party.armor_number(i) > 0 @data.push($data_armors[i]) end end when 5 for i in 1...$data_armors.size if $data_armors[i].kind == 2 and $game_party.armor_number(i) > 0 @data.push($data_armors[i]) end end when 6 for i in 1...$data_armors.size if $data_armors[i].kind == 3 and $game_party.armor_number(i) > 0 @data.push($data_armors[i]) end end # when 7 #for i in 1...$data_items.size #if $data_armors[i].kind == 4 and $game_party.armor_number(id) > 0 #@data.push($data_armors[i]) #end #end #when 8 #for i in 1...$data_items.size #if $data_armors[i].kind == 5 and $game_party.armor_number(id) > 0 #@data.push($data_armors[i]) #end #end when 9 for i in 1...$data_items.size if $data_items[i].occasion == 3 and $game_party.item_number(i) > 0 @data.push($data_items[i]) end end end # 項目数が 0 でなければビットマップを作成し、全項目を描画 @item_max = @data.size if @item_max > 0 self.contents = Bitmap.new(width - 32, row_max * 32) self.contents.clear for i in 0...@item_max draw_item(i) end end end #-------------------------------------------------------------------------- # ● 種類別アイテム数の取得 #-------------------------------------------------------------------------- def item_number return @item_max end #-------------------------------------------------------------------------- # ● 項目の描画 # index : 項目番号 #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] case item when RPG::Item number = $game_party.item_number(item.id) when RPG::Weapon number = $game_party.weapon_number(item.id) when RPG::Armor number = $game_party.armor_number(item.id) end if item.is_a?(RPG::Item) and $game_party.item_can_use?(item.id) self.contents.font.color = normal_color else self.contents.font.color = disabled_color end x = 4 y = index * 32 bitmap = RPG::Cache.icon(item.icon_name) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x + 28, y, 212, 32, item.name, 0) self.contents.draw_text(x + 400, y, 16, 32, ":", 1) self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2) end #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.set_text(self.item == nil ? "" : self.item.description) end end #============================================================================== # ■ Harts_Scene_Item #------------------------------------------------------------------------------ # アイテム画面の処理を行うクラスです。再定義 #============================================================================== class Scene_Item #-------------------------------------------------------------------------- # ● メイン処理 #-------------------------------------------------------------------------- def main # タイトルウィンドウを作成 @itemtitle_window = Harts_Window_ItemTitle.new #コマンドウィンドウを作成 @itemcommand_window = Harts_Window_ItemCommand.new @command_index = @itemcommand_window.index #アイテムウィンドウを作成 @itemlist_window = Harts_Window_ItemList.new @itemlist_window.active = false #ヘルプウィンドウを作成 @help_window = Window_Help.new @help_window.x = 0 @help_window.y = 416 # ヘルプウィンドウを関連付け @itemcommand_window.help_window = @help_window @itemlist_window.help_window = @help_window # ターゲットウィンドウを作成 (不可視?非アクティブに設定) @target_window = Window_Target.new @target_window.visible = false @target_window.active = false # アイテムウィンドウ内容表示 @itemlist_window.set_item(@command_index) # トランジション実行 Graphics.transition # メインループ loop do # ゲーム画面を更新 Graphics.update # 入力情報を更新 Input.update # フレーム更新 update # 画面が切り替わったらループを中断 if $scene != self break end end # トランジション準備 Graphics.freeze # ウィンドウを解放 @itemtitle_window.dispose @itemcommand_window.dispose @itemlist_window.dispose @help_window.dispose @target_window.dispose end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update # ウィンドウを更新 @itemtitle_window.update @itemcommand_window.update @itemlist_window.update @help_window.update @target_window.update if @command_index != @itemcommand_window.index @command_index = @itemcommand_window.index @itemlist_window.set_item(@command_index) end # コマンドウィンドウがアクティブの場合: update_itemcommand を呼ぶ if @itemcommand_window.active update_itemcommand return end # アイテムウィンドウがアクティブの場合: update_itemlist を呼ぶ if @itemlist_window.active update_itemlist return end # ターゲットウィンドウがアクティブの場合: update_target を呼ぶ if @target_window.active update_target return end end #-------------------------------------------------------------------------- # ● フレーム更新 (コマンドウィンドウがアクティブの場合) #-------------------------------------------------------------------------- def update_itemcommand # B ボタンが押された場合 if Input.trigger?(Input::B) # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # メニュー画面に切り替え $scene = Scene_Menu.new(0) return end # C ボタンが押された場合 if Input.trigger?(Input::C) # 選択中のコマンドのアイテムがない場合 if @itemlist_window.item_number == 0 # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # アイテムウィンドウをアクティブにする @itemcommand_window.active = false @itemlist_window.active = true @itemlist_window.index = 0 return end end #-------------------------------------------------------------------------- # ● フレーム更新 (アイテムウィンドウがアクティブの場合) #-------------------------------------------------------------------------- def update_itemlist # B ボタンが押された場合 if Input.trigger?(Input::B) # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # アイテムウィンドウをアクティブにする @itemcommand_window.active = true @itemlist_window.active = false @itemlist_window.index = 0 @itemcommand_window.index = @command_index return end # C ボタンが押された場合 if Input.trigger?(Input::C) # アイテムウィンドウで現在選択されているデータを取得 @item = @itemlist_window.item # 使用アイテムではない場合 unless @item.is_a?(RPG::Item) # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # 使用できない場合 unless $game_party.item_can_use?(@item.id) # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # 効果範囲が味方の場合 if @item.scope >= 3 # ターゲットウィンドウをアクティブ化 @itemlist_window.active = false @target_window.x = 304 @target_window.visible = true @target_window.active = true # 効果範囲 (単体/全体) に応じてカーソル位置を設定 if @item.scope == 4 || @item.scope == 6 @target_window.index = -1 else @target_window.index = 0 end # 効果範囲が味方以外の場合 else # コモンイベント ID が有効の場合 if @item.common_event_id > 0 # コモンイベント呼び出し予約 $game_temp.common_event_id = @item.common_event_id # アイテムの使用時 SE を演奏 $game_system.se_play(@item.menu_se) # 消耗品の場合 if @item.consumable # 使用したアイテムを 1 減らす $game_party.lose_item(@item.id, 1) # アイテムウィンドウの項目を再描画 @itemlist_window.draw_item(@itemlist_window.index) end # マップ画面に切り替え $scene = Scene_Map.new return end end return end end #-------------------------------------------------------------------------- # ● フレーム更新 (ターゲットウィンドウがアクティブの場合) #-------------------------------------------------------------------------- def update_target # B ボタンが押された場合 if Input.trigger?(Input::B) # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # アイテム切れなどで使用できなくなった場合 unless $game_party.item_can_use?(@item.id) # アイテムウィンドウの内容を再作成 @itemlist_window.refresh end # ターゲットウィンドウを消去 @itemlist_window.active = true @target_window.visible = false @target_window.active = false @itemlist_window.set_item(@command_index) return end # C ボタンが押された場合 if Input.trigger?(Input::C) # アイテムを使い切った場合 if $game_party.item_number(@item.id) == 0 # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) return end # ターゲットが全体の場合 if @target_window.index == -1 # パーティ全体にアイテムの使用効果を適用 used = false for i in $game_party.actors used |= i.item_effect(@item) end end # ターゲットが単体の場合 if @target_window.index >= 0 # ターゲットのアクターにアイテムの使用効果を適用 target = $game_party.actors[@target_window.index] used = target.item_effect(@item) end # アイテムを使った場合 if used # アイテムの使用時 SE を演奏 $game_system.se_play(@item.menu_se) # 消耗品の場合 if @item.consumable # 使用したアイテムを 1 減らす $game_party.lose_item(@item.id, 1) # アイテムウィンドウの項目を再描画 @itemlist_window.draw_item(@itemlist_window.index) @itemlist_window.set_item(@command_index) end # ターゲットウィンドウの内容を再作成 @target_window.refresh # 全滅の場合 if $game_party.all_dead? # ゲームオーバー画面に切り替え $scene = Scene_Gameover.new return end # コモンイベント ID が有効の場合 if @item.common_event_id > 0 # コモンイベント呼び出し予約 $game_temp.common_event_id = @item.common_event_id # マップ画面に切り替え $scene = Scene_Map.new return end end # アイテムを使わなかった場合 unless used # ブザー SE を演奏 $game_system.se_play($data_system.buzzer_se) end return end end end #============================================================================== # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息 #==============================================================================
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
#==============================================================================
# ■ Harts_Window_ItemTitle
#------------------------------------------------------------------------------
# アイテム画面で、タイトルを表示するウィンドウ。
#==============================================================================
class Harts_Window_ItemTitle < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 0, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, 120, 32, $data_system.words.item, 1)
end
end
#==============================================================================
# ■ Harts_Window_ItemCommand
#------------------------------------------------------------------------------
# アイテムの種別選択を行うウィンドウです。
#==============================================================================
class Harts_Window_ItemCommand < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 64, 160, 360)
self.contents = Bitmap.new(width - 32, height - 32)
@item_max = 10
@commands = ["一般用", "战斗用", $data_system.words.weapon, $data_system.words.armor1, $data_system.words.armor2, $data_system.words.armor3, "戒指", "项链","鞋","特殊道具"]
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
# color : 文字色
#--------------------------------------------------------------------------
def draw_item(index, color)
self.contents.font.color = color
y = index * 32
self.contents.draw_text(4, y, 128, 32, @commands[index])
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
case self.index
when 0
@text = @commands[0]
when 1
@text = @commands[1]
when 2
@text = @commands[2]
when 3
@text = @commands[3]
when 4
@text = @commands[4]
when 5
@text = @commands[5]
when 6
@text = @commands[6]
when 7
@text = @commands[7]
when 8
@text = @commands[8]
when 9
@text = @commands[9]
end
@help_window.set_text(@text)
end
end
#==============================================================================
# ■ Window_Item
#------------------------------------------------------------------------------
# アイテム画面で、所持アイテムの一覧を表示するウィンドウです。
#==============================================================================
class Harts_Window_ItemList < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(160, 0, 480, 416)
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● アイテムの取得
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
end
#--------------------------------------------------------------------------
# ● アイテム一覧設定
# command : 選択中のコマンド
#--------------------------------------------------------------------------
def set_item(command)
refresh
case command
when 0
for i in 1...$data_items.size
if ($data_items[i].occasion == 0 or $data_items[i].occasion == 2) and $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
when 1
for i in 1...$data_items.size
if ($data_items[i].occasion == 1 and $game_party.item_number(i) > 0)
@data.push($data_items[i])
end
end
when 2
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0
@data.push($data_weapons[i])
end
end
when 3
for i in 1...$data_armors.size
if $data_armors[i].kind == 0 and $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
when 4
for i in 1...$data_armors.size
if $data_armors[i].kind == 1 and $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
when 5
for i in 1...$data_armors.size
if $data_armors[i].kind == 2 and $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
when 6
for i in 1...$data_armors.size
if $data_armors[i].kind == 3 and $game_party.armor_number(i) > 0
@data.push($data_armors[i])
end
end
# when 7
#for i in 1...$data_items.size
#if $data_armors[i].kind == 4 and $game_party.armor_number(id) > 0
#@data.push($data_armors[i])
#end
#end
#when 8
#for i in 1...$data_items.size
#if $data_armors[i].kind == 5 and $game_party.armor_number(id) > 0
#@data.push($data_armors[i])
#end
#end
when 9
for i in 1...$data_items.size
if $data_items[i].occasion == 3 and $game_party.item_number(i) > 0
@data.push($data_items[i])
end
end
end
# 項目数が 0 でなければビットマップを作成し、全項目を描画
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
end
#--------------------------------------------------------------------------
# ● 種類別アイテム数の取得
#--------------------------------------------------------------------------
def item_number
return @item_max
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
case item
when RPG::Item
number = $game_party.item_number(item.id)
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
if item.is_a?(RPG::Item) and
$game_party.item_can_use?(item.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4
y = index * 32
bitmap = RPG::Cache.icon(item.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 400, y, 16, 32, ":", 1)
self.contents.draw_text(x + 416, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.item == nil ? "" : self.item.description)
end
end
#==============================================================================
# ■ Harts_Scene_Item
#------------------------------------------------------------------------------
# アイテム画面の処理を行うクラスです。再定義
#==============================================================================
class Scene_Item
#--------------------------------------------------------------------------
# ● メイン処理
#--------------------------------------------------------------------------
def main
# タイトルウィンドウを作成
@itemtitle_window = Harts_Window_ItemTitle.new
#コマンドウィンドウを作成
@itemcommand_window = Harts_Window_ItemCommand.new
@command_index = @itemcommand_window.index
#アイテムウィンドウを作成
@itemlist_window = Harts_Window_ItemList.new
@itemlist_window.active = false
#ヘルプウィンドウを作成
@help_window = Window_Help.new
@help_window.x = 0
@help_window.y = 416
# ヘルプウィンドウを関連付け
@itemcommand_window.help_window = @help_window
@itemlist_window.help_window = @help_window
# ターゲットウィンドウを作成 (不可視?非アクティブに設定)
@target_window = Window_Target.new
@target_window.visible = false
@target_window.active = false
# アイテムウィンドウ内容表示
@itemlist_window.set_item(@command_index)
# トランジション実行
Graphics.transition
# メインループ
loop do
# ゲーム画面を更新
Graphics.update
# 入力情報を更新
Input.update
# フレーム更新
update
# 画面が切り替わったらループを中断
if $scene != self
break
end
end
# トランジション準備
Graphics.freeze
# ウィンドウを解放
@itemtitle_window.dispose
@itemcommand_window.dispose
@itemlist_window.dispose
@help_window.dispose
@target_window.dispose
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ウィンドウを更新
@itemtitle_window.update
@itemcommand_window.update
@itemlist_window.update
@help_window.update
@target_window.update
if @command_index != @itemcommand_window.index
@command_index = @itemcommand_window.index
@itemlist_window.set_item(@command_index)
end
# コマンドウィンドウがアクティブの場合: update_itemcommand を呼ぶ
if @itemcommand_window.active
update_itemcommand
return
end
# アイテムウィンドウがアクティブの場合: update_itemlist を呼ぶ
if @itemlist_window.active
update_itemlist
return
end
# ターゲットウィンドウがアクティブの場合: update_target を呼ぶ
if @target_window.active
update_target
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (コマンドウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_itemcommand
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# メニュー画面に切り替え
$scene = Scene_Menu.new(0)
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# 選択中のコマンドのアイテムがない場合
if @itemlist_window.item_number == 0
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# アイテムウィンドウをアクティブにする
@itemcommand_window.active = false
@itemlist_window.active = true
@itemlist_window.index = 0
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (アイテムウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_itemlist
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# アイテムウィンドウをアクティブにする
@itemcommand_window.active = true
@itemlist_window.active = false
@itemlist_window.index = 0
@itemcommand_window.index = @command_index
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# アイテムウィンドウで現在選択されているデータを取得
@item = @itemlist_window.item
# 使用アイテムではない場合
unless @item.is_a?(RPG::Item)
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 使用できない場合
unless $game_party.item_can_use?(@item.id)
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# 決定 SE を演奏
$game_system.se_play($data_system.decision_se)
# 効果範囲が味方の場合
if @item.scope >= 3
# ターゲットウィンドウをアクティブ化
@itemlist_window.active = false
@target_window.x = 304
@target_window.visible = true
@target_window.active = true
# 効果範囲 (単体/全体) に応じてカーソル位置を設定
if @item.scope == 4 || @item.scope == 6
@target_window.index = -1
else
@target_window.index = 0
end
# 効果範囲が味方以外の場合
else
# コモンイベント ID が有効の場合
if @item.common_event_id > 0
# コモンイベント呼び出し予約
$game_temp.common_event_id = @item.common_event_id
# アイテムの使用時 SE を演奏
$game_system.se_play(@item.menu_se)
# 消耗品の場合
if @item.consumable
# 使用したアイテムを 1 減らす
$game_party.lose_item(@item.id, 1)
# アイテムウィンドウの項目を再描画
@itemlist_window.draw_item(@itemlist_window.index)
end
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
end
return
end
end
#--------------------------------------------------------------------------
# ● フレーム更新 (ターゲットウィンドウがアクティブの場合)
#--------------------------------------------------------------------------
def update_target
# B ボタンが押された場合
if Input.trigger?(Input::B)
# キャンセル SE を演奏
$game_system.se_play($data_system.cancel_se)
# アイテム切れなどで使用できなくなった場合
unless $game_party.item_can_use?(@item.id)
# アイテムウィンドウの内容を再作成
@itemlist_window.refresh
end
# ターゲットウィンドウを消去
@itemlist_window.active = true
@target_window.visible = false
@target_window.active = false
@itemlist_window.set_item(@command_index)
return
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# アイテムを使い切った場合
if $game_party.item_number(@item.id) == 0
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
return
end
# ターゲットが全体の場合
if @target_window.index == -1
# パーティ全体にアイテムの使用効果を適用
used = false
for i in $game_party.actors
used |= i.item_effect(@item)
end
end
# ターゲットが単体の場合
if @target_window.index >= 0
# ターゲットのアクターにアイテムの使用効果を適用
target = $game_party.actors[@target_window.index]
used = target.item_effect(@item)
end
# アイテムを使った場合
if used
# アイテムの使用時 SE を演奏
$game_system.se_play(@item.menu_se)
# 消耗品の場合
if @item.consumable
# 使用したアイテムを 1 減らす
$game_party.lose_item(@item.id, 1)
# アイテムウィンドウの項目を再描画
@itemlist_window.draw_item(@itemlist_window.index)
@itemlist_window.set_item(@command_index)
end
# ターゲットウィンドウの内容を再作成
@target_window.refresh
# 全滅の場合
if $game_party.all_dead?
# ゲームオーバー画面に切り替え
$scene = Scene_Gameover.new
return
end
# コモンイベント ID が有効の場合
if @item.common_event_id > 0
# コモンイベント呼び出し予約
$game_temp.common_event_id = @item.common_event_id
# マップ画面に切り替え
$scene = Scene_Map.new
return
end
end
# アイテムを使わなかった場合
unless used
# ブザー SE を演奏
$game_system.se_play($data_system.buzzer_se)
end
return
end
end
end
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
新增装备脚本
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ # # 防具类追加 # # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ module RPG class Armor def name name = @name.split(/,/)[0] return name != nil ? name : '' end def kind kind = @name.split(/,/)[1] return kind != nil ? kind.to_i : @kind end end end # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ # # Game_Actor添加新的防具ID,并对相关方法修正 # # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ class Game_Actor < Game_Battler attr_reader :armor5_id # 项链 ID attr_reader :armor6_id # 鞋 ID #-------------------------------------------------------------------------- # ● 设置 # actor_id : 角色 ID #-------------------------------------------------------------------------- alias old_setup setup def setup(actor_id) old_setup(actor_id) @armor5_id = 0 @armor6_id = 0 update_auto_state(nil, $data_armors[@armor5_id]) update_auto_state(nil, $data_armors[@armor6_id]) end #-------------------------------------------------------------------------- # ● 取得属性修正值 # element_id : 属性 ID #-------------------------------------------------------------------------- def element_rate(element_id) # 获取对应属性有效度的数值 table = [0,200,150,100,50,0,-100] result = table[$data_classes[@class_id].element_ranks[element_id]] # 防具能防御本属性的情况下效果减半 for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id, @armor6_id] armor = $data_armors[i] if armor != nil and armor.guard_element_set.include?(element_id) result /= 2 end end # 状态能防御本属性的情况下效果减半 for i in @states if $data_states[i].guard_element_set.include?(element_id) result /= 2 end end # 过程结束 return result end #-------------------------------------------------------------------------- # ● 判定防御属性 # state_id : 属性 ID #-------------------------------------------------------------------------- def state_guard?(state_id) for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id, @armor6_id] armor = $data_armors[i] if armor != nil if armor.guard_state_set.include?(state_id) return true end end end return false end #-------------------------------------------------------------------------- # ● 获取基本力量 #-------------------------------------------------------------------------- def base_str n = $data_actors[@actor_id].parameters[2, @level] weapon = $data_weapons[@weapon_id] armor1 = $data_armors[@armor1_id] armor2 = $data_armors[@armor2_id] armor3 = $data_armors[@armor3_id] armor4 = $data_armors[@armor4_id] armor5 = $data_armors[@armor5_id] armor6 = $data_armors[@armor6_id] n += weapon != nil ? weapon.str_plus : 0 n += armor1 != nil ? armor1.str_plus : 0 n += armor2 != nil ? armor2.str_plus : 0 n += armor3 != nil ? armor3.str_plus : 0 n += armor4 != nil ? armor4.str_plus : 0 n += armor5 != nil ? armor5.str_plus : 0 n += armor6 != nil ? armor6.str_plus : 0 return [[n, 1].max, 999].min end #-------------------------------------------------------------------------- # ● 获取基本灵巧 #-------------------------------------------------------------------------- def base_dex n = $data_actors[@actor_id].parameters[3, @level] weapon = $data_weapons[@weapon_id] armor1 = $data_armors[@armor1_id] armor2 = $data_armors[@armor2_id] armor3 = $data_armors[@armor3_id] armor4 = $data_armors[@armor4_id] armor5 = $data_armors[@armor5_id] armor6 = $data_armors[@armor6_id] n += weapon != nil ? weapon.dex_plus : 0 n += armor1 != nil ? armor1.dex_plus : 0 n += armor2 != nil ? armor2.dex_plus : 0 n += armor3 != nil ? armor3.dex_plus : 0 n += armor4 != nil ? armor4.dex_plus : 0 n += armor5 != nil ? armor5.dex_plus : 0 n += armor6 != nil ? armor6.dex_plus : 0 return [[n, 1].max, 999].min end #-------------------------------------------------------------------------- # ● 获取基本速度 #-------------------------------------------------------------------------- def base_agi n = $data_actors[@actor_id].parameters[4, @level] weapon = $data_weapons[@weapon_id] armor1 = $data_armors[@armor1_id] armor2 = $data_armors[@armor2_id] armor3 = $data_armors[@armor3_id] armor4 = $data_armors[@armor4_id] armor5 = $data_armors[@armor5_id] armor6 = $data_armors[@armor6_id] n += weapon != nil ? weapon.agi_plus : 0 n += armor1 != nil ? armor1.agi_plus : 0 n += armor2 != nil ? armor2.agi_plus : 0 n += armor3 != nil ? armor3.agi_plus : 0 n += armor4 != nil ? armor4.agi_plus : 0 n += armor5 != nil ? armor5.agi_plus : 0 n += armor6 != nil ? armor6.agi_plus : 0 return [[n, 1].max, 999].min end #-------------------------------------------------------------------------- # ● 获取基本魔力 #-------------------------------------------------------------------------- def base_int n = $data_actors[@actor_id].parameters[5, @level] weapon = $data_weapons[@weapon_id] armor1 = $data_armors[@armor1_id] armor2 = $data_armors[@armor2_id] armor3 = $data_armors[@armor3_id] armor4 = $data_armors[@armor4_id] armor5 = $data_armors[@armor5_id] armor6 = $data_armors[@armor6_id] n += weapon != nil ? weapon.int_plus : 0 n += armor1 != nil ? armor1.int_plus : 0 n += armor2 != nil ? armor2.int_plus : 0 n += armor3 != nil ? armor3.int_plus : 0 n += armor4 != nil ? armor4.int_plus : 0 n += armor5 != nil ? armor5.int_plus : 0 n += armor6 != nil ? armor6.int_plus : 0 return [[n, 1].max, 999].min end #-------------------------------------------------------------------------- # ● 获取基本物理防御 #-------------------------------------------------------------------------- def base_pdef weapon = $data_weapons[@weapon_id] armor1 = $data_armors[@armor1_id] armor2 = $data_armors[@armor2_id] armor3 = $data_armors[@armor3_id] armor4 = $data_armors[@armor4_id] armor5 = $data_armors[@armor5_id] armor6 = $data_armors[@armor6_id] pdef1 = weapon != nil ? weapon.pdef : 0 pdef2 = armor1 != nil ? armor1.pdef : 0 pdef3 = armor2 != nil ? armor2.pdef : 0 pdef4 = armor3 != nil ? armor3.pdef : 0 pdef5 = armor4 != nil ? armor4.pdef : 0 pdef6 = armor5 != nil ? armor5.pdef : 0 pdef7 = armor6 != nil ? armor6.pdef : 0 return pdef1 + pdef2 + pdef3 + pdef4 + pdef5 + pdef6 + pdef7 + dex*0.33 end #-------------------------------------------------------------------------- # ● 获取基本魔法防御 #-------------------------------------------------------------------------- def base_mdef weapon = $data_weapons[@weapon_id] armor1 = $data_armors[@armor1_id] armor2 = $data_armors[@armor2_id] armor3 = $data_armors[@armor3_id] armor4 = $data_armors[@armor4_id] armor5 = $data_armors[@armor5_id] armor6 = $data_armors[@armor6_id] mdef1 = weapon != nil ? weapon.mdef : 0 mdef2 = armor1 != nil ? armor1.mdef : 0 mdef3 = armor2 != nil ? armor2.mdef : 0 mdef4 = armor3 != nil ? armor3.mdef : 0 mdef5 = armor4 != nil ? armor4.mdef : 0 mdef6 = armor5 != nil ? armor5.mdef : 0 mdef7 = armor6 != nil ? armor6.mdef : 0 return mdef1 + mdef2 + mdef3 + mdef4 + mdef5 + mdef6 + mdef7 + int*0.33 end #-------------------------------------------------------------------------- # ● 获取基本回避修正 #-------------------------------------------------------------------------- def base_eva armor1 = $data_armors[@armor1_id] armor2 = $data_armors[@armor2_id] armor3 = $data_armors[@armor3_id] armor4 = $data_armors[@armor4_id] armor5 = $data_armors[@armor5_id] armor6 = $data_armors[@armor6_id] eva1 = armor1 != nil ? armor1.eva : 0 eva2 = armor2 != nil ? armor2.eva : 0 eva3 = armor3 != nil ? armor3.eva : 0 eva4 = armor4 != nil ? armor4.eva : 0 eva5 = armor5 != nil ? armor5.eva : 0 eva6 = armor6 != nil ? armor6.eva : 0 return eva1 + eva2 + eva3 + eva4 + eva5 + eva6 end #-------------------------------------------------------------------------- # ● 装备固定判定 # equip_type : 装备类型 #-------------------------------------------------------------------------- def equip_fix?(equip_type) case equip_type when 0 # 武器 return $data_actors[@actor_id].weapon_fix when 1 # 盾 return $data_actors[@actor_id].armor1_fix when 2 # 头 return $data_actors[@actor_id].armor2_fix when 3 # 身体 return $data_actors[@actor_id].armor3_fix when 4 # 装饰品 return $data_actors[@actor_id].armor4_fix end return false end #-------------------------------------------------------------------------- # ● 变更装备 # equip_type : 装备类型 # id : 武器 or 防具 ID (0 为解除装备) #-------------------------------------------------------------------------- def equip(equip_type, id) case equip_type when 0 # 武器 if id == 0 or $game_party.weapon_number(id) > 0 $game_party.gain_weapon(@weapon_id, 1) @weapon_id = id $game_party.lose_weapon(id, 1) end when 1 # 盾 if id == 0 or $game_party.armor_number(id) > 0 update_auto_state($data_armors[@armor1_id], $data_armors[id]) $game_party.gain_armor(@armor1_id, 1) @armor1_id = id $game_party.lose_armor(id, 1) end when 2 # 头 if id == 0 or $game_party.armor_number(id) > 0 update_auto_state($data_armors[@armor2_id], $data_armors[id]) $game_party.gain_armor(@armor2_id, 1) @armor2_id = id $game_party.lose_armor(id, 1) end when 3 # 身体 if id == 0 or $game_party.armor_number(id) > 0 update_auto_state($data_armors[@armor3_id], $data_armors[id]) $game_party.gain_armor(@armor3_id, 1) @armor3_id = id $game_party.lose_armor(id, 1) end when 4 # 装饰品 if id == 0 or $game_party.armor_number(id) > 0 update_auto_state($data_armors[@armor4_id], $data_armors[id]) $game_party.gain_armor(@armor4_id, 1) @armor4_id = id $game_party.lose_armor(id, 1) end when 5 # 项链 if id == 0 or $game_party.armor_number(id) > 0 update_auto_state($data_armors[@armor5_id], $data_armors[id]) $game_party.gain_armor(@armor5_id, 1) @armor5_id = id $game_party.lose_armor(id, 1) end when 6 # 鞋 if id == 0 or $game_party.armor_number(id) > 0 update_auto_state($data_armors[@armor6_id], $data_armors[id]) $game_party.gain_armor(@armor6_id, 1) @armor6_id = id $game_party.lose_armor(id, 1) end end end #-------------------------------------------------------------------------- # ● 更改职业 ID # class_id : 新的职业 ID #-------------------------------------------------------------------------- def class_id=(class_id) if $data_classes[class_id] != nil @class_id = class_id # 避开无法装备的物品 unless equippable?($data_weapons[@weapon_id]) equip(0, 0) end unless equippable?($data_armors[@armor1_id]) equip(1, 0) end unless equippable?($data_armors[@armor2_id]) equip(2, 0) end unless equippable?($data_armors[@armor3_id]) equip(3, 0) end unless equippable?($data_armors[@armor4_id]) equip(4, 0) end unless equippable?($data_armors[@armor5_id]) equip(5, 0) end unless equippable?($data_armors[@armor6_id]) equip(6, 0) end end end end # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ # # Window_Base美化,增加属性增减颜色,及全能力值描绘 # # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ #============================================================================== # ■ Window_Base #------------------------------------------------------------------------------ # 游戏中全部窗口的超级类。 #============================================================================== class Window_Base < Window ################## 属性增减颜色 ############################## def up_color return Color.new(0, 255, 0) end def down_color return Color.new(255, 0, 0) end #-------------------------------------------------------------------------- # ● 描绘能力值 # actor : 角色 # x : 描画目标 X 坐标 # y : 描画目标 Y 坐标 # type : 能力值种类 (0~6) #-------------------------------------------------------------------------- def draw_actor_parameter(actor, x, y, type) case type when 0 parameter_name = $data_system.words.atk parameter_value = actor.atk when 1 parameter_name = $data_system.words.pdef parameter_value = actor.pdef when 2 parameter_name = $data_system.words.mdef parameter_value = actor.mdef when 3 parameter_name = $data_system.words.str parameter_value = actor.str when 4 parameter_name = $data_system.words.dex parameter_value = actor.dex when 5 parameter_name = $data_system.words.agi parameter_value = actor.agi when 6 parameter_name = $data_system.words.int parameter_value = actor.int when 7 parameter_name = "回避" parameter_value = actor.eva end self.contents.font.color = system_color self.contents.draw_text(x, y, 120, 32, parameter_name) self.contents.font.color = normal_color self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2) end end # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ # # 装备窗口美化,全能力值描绘并追加新的防具装备栏 # # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ #============================================================================== # ■ Window_EquipRight #------------------------------------------------------------------------------ # 装备画面、显示角色现在装备的物品的窗口。 #============================================================================== class Window_EquipRight < Window_Selectable #-------------------------------------------------------------------------- # ● 初始化对像 # actor : 角色 #-------------------------------------------------------------------------- def initialize(actor) super(272, 64, 368, 256) self.contents = Bitmap.new(width - 32, height - 32) @actor = actor refresh self.index = 0 end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh self.contents.clear @data = [] @data.push($data_weapons[@actor.weapon_id]) @data.push($data_armors[@actor.armor1_id]) @data.push($data_armors[@actor.armor2_id]) @data.push($data_armors[@actor.armor3_id]) @data.push($data_armors[@actor.armor4_id]) @data.push($data_armors[@actor.armor5_id]) @data.push($data_armors[@actor.armor6_id]) @item_max = @data.size self.contents.font.color = system_color self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon) self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1) self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2) self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3) self.contents.draw_text(4, 32 * 4, 92, 32, $data_system.words.armor4) self.contents.draw_text(4, 32 * 5, 92, 32, "项链") self.contents.draw_text(4, 32 * 6, 92, 32, "鞋") draw_item_name(@data[0], 92, 32 * 0) draw_item_name(@data[1], 92, 32 * 1) draw_item_name(@data[2], 92, 32 * 2) draw_item_name(@data[3], 92, 32 * 3) draw_item_name(@data[4], 92, 32 * 4) draw_item_name(@data[5], 92, 32 * 5) draw_item_name(@data[6], 92, 32 * 6) end end #============================================================================== # ■ Window_EquipLeft #------------------------------------------------------------------------------ # 装备画面的、显示角色能力值变化的窗口。 #============================================================================== class Window_EquipLeft < Window_Base #-------------------------------------------------------------------------- # ● 初始化对像 # actor : 角色 #-------------------------------------------------------------------------- def initialize(actor) super(0, 64, 272, 416) self.contents = Bitmap.new(width - 32, height - 32) @actor = actor refresh end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh self.contents.clear draw_actor_name(@actor, 4, 0) draw_actor_level(@actor, 4, 32) draw_actor_parameter(@actor, 4, 64, 0) draw_actor_parameter(@actor, 4, 96, 1) draw_actor_parameter(@actor, 4, 128, 2) draw_actor_parameter(@actor, 4, 160, 7) draw_actor_parameter(@actor, 4, 192, 3) draw_actor_parameter(@actor, 4, 224, 4) draw_actor_parameter(@actor, 4, 256, 5) draw_actor_parameter(@actor, 4, 288, 6) if @new_atk != nil self.contents.font.color = system_color self.contents.draw_text(160, 64, 40, 32, "→", 1) self.contents.font.color = @new_atk>@actor.atk ? up_color : down_color self.contents.font.color = normal_color if @new_atk == @actor.atk self.contents.draw_text(200, 64, 36, 32, @new_atk.to_s, 2) end if @new_pdef != nil self.contents.font.color = system_color self.contents.draw_text(160, 96, 40, 32, "→", 1) self.contents.font.color = @new_pdef>@actor.pdef ? up_color : down_color self.contents.font.color = normal_color if @new_pdef == @actor.pdef self.contents.draw_text(200, 96, 36, 32, @new_pdef.to_s, 2) end if @new_mdef != nil self.contents.font.color = system_color self.contents.draw_text(160, 128, 40, 32, "→", 1) self.contents.font.color = @new_mdef>@actor.mdef ? up_color : down_color self.contents.font.color = normal_color if @new_mdef == @actor.mdef self.contents.draw_text(200, 128, 36, 32, @new_mdef.to_s, 2) end if @new_eva != nil self.contents.font.color = system_color self.contents.draw_text(160, 160, 40, 32, "→", 1) self.contents.font.color = @new_eva>@actor.eva ? up_color : down_color self.contents.font.color = normal_color if @new_eva == @actor.eva self.contents.draw_text(200, 160, 36, 32, @new_eva.to_s, 2) end if @new_str != nil self.contents.font.color = system_color self.contents.draw_text(160, 192, 40, 32, "→", 1) self.contents.font.color = @new_str>@actor.str ? up_color : down_color self.contents.font.color = normal_color if @new_str == @actor.str self.contents.draw_text(200, 192, 36, 32, @new_str.to_s, 2) end if @new_dex != nil self.contents.font.color = system_color self.contents.draw_text(160, 224, 40, 32, "→", 1) self.contents.font.color = @new_dex>@actor.dex ? up_color : down_color self.contents.font.color = normal_color if @new_dex == @actor.dex self.contents.draw_text(200, 224, 36, 32, @new_dex.to_s, 2) end if @new_agi != nil self.contents.font.color = system_color self.contents.draw_text(160, 256, 40, 32, "→", 1) self.contents.font.color = @new_agi>@actor.agi ? up_color : down_color self.contents.font.color = normal_color if @new_agi == @actor.agi self.contents.draw_text(200, 256, 36, 32, @new_agi.to_s, 2) end if @new_int != nil self.contents.font.color = system_color self.contents.draw_text(160, 288, 40, 32, "→", 1) self.contents.font.color = @new_int>@actor.int ? up_color : down_color self.contents.font.color = normal_color if @new_int == @actor.int self.contents.draw_text(200, 288, 36, 32, @new_int.to_s, 2) end end #-------------------------------------------------------------------------- # ● 变更装备后的能力值设置 # new_atk : 变更装备后的攻击力 # new_pdef : 变更装备后的物理防御 # new_mdef : 变更装备后的魔法防御 #-------------------------------------------------------------------------- def set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int) if @new_atk != new_atk or @new_pdef !=new_pdef or @new_mdef != new_mdef or @new_eva != new_eva or @new_str != new_str or @new_dex !=new_dex or @new_agi != new_agi or @new_int != new_int @new_atk = new_atk @new_pdef = new_pdef @new_mdef = new_mdef @new_eva = new_eva @new_str = new_str @new_dex = new_dex @new_agi = new_agi @new_int = new_int refresh end end end #============================================================================== # ■ Window_EquipItem #------------------------------------------------------------------------------ # 装备画面、显示浏览变更装备的候补物品的窗口。 #============================================================================== class Window_EquipItem < Window_Selectable #-------------------------------------------------------------------------- # ● 初始化对像 # actor : 角色 # equip_type : 装备部位 (0~3) #-------------------------------------------------------------------------- def initialize(actor, equip_type) super(272, 320, 368, 160) @actor = actor @equip_type = equip_type @column_max = 1 refresh self.active = false self.index = -1 end #-------------------------------------------------------------------------- # ● 项目的描绘 # index : 项目符号 #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] x = 4 y = index * 32 case item when RPG::Weapon number = $game_party.weapon_number(item.id) when RPG::Armor number = $game_party.armor_number(item.id) end bitmap = RPG::Cache.icon(item.icon_name) self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24)) self.contents.font.color = normal_color self.contents.draw_text(x + 28, y, 212, 32, item.name, 0) self.contents.draw_text(x + 240, y, 16, 32, ":", 1) self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2) end end class Scene_Equip #-------------------------------------------------------------------------- # ● 主处理 #-------------------------------------------------------------------------- def main # 获取角色 @actor = $game_party.actors[@actor_index] # 生成窗口 @help_window = Window_Help.new @left_window = Window_EquipLeft.new(@actor) @right_window = Window_EquipRight.new(@actor) @item_window1 = Window_EquipItem.new(@actor, 0) @item_window2 = Window_EquipItem.new(@actor, 1) @item_window3 = Window_EquipItem.new(@actor, 2) @item_window4 = Window_EquipItem.new(@actor, 3) @item_window5 = Window_EquipItem.new(@actor, 4) @item_window6 = Window_EquipItem.new(@actor, 5) @item_window7 = Window_EquipItem.new(@actor, 6) # 关联帮助窗口 @right_window.help_window = @help_window @item_window1.help_window = @help_window @item_window2.help_window = @help_window @item_window3.help_window = @help_window @item_window4.help_window = @help_window @item_window5.help_window = @help_window @item_window6.help_window = @help_window @item_window7.help_window = @help_window # 设置光标位置 @right_window.index = @equip_index refresh # 执行过渡 Graphics.transition # 主循环 loop do # 刷新游戏画面 Graphics.update # 刷新输入信息 Input.update # 刷新画面 update # 如果画面切换的话的就中断循环 if $scene != self break end end # 准备过渡 Graphics.freeze # 释放窗口 @help_window.dispose @left_window.dispose @right_window.dispose @item_window1.dispose @item_window2.dispose @item_window3.dispose @item_window4.dispose @item_window5.dispose @item_window6.dispose @item_window7.dispose end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh # 设置物品窗口的可视状态 @item_window1.visible = (@right_window.index == 0) @item_window2.visible = (@right_window.index == 1) @item_window3.visible = (@right_window.index == 2) @item_window4.visible = (@right_window.index == 3) @item_window5.visible = (@right_window.index == 4) @item_window6.visible = (@right_window.index == 5) @item_window7.visible = (@right_window.index == 6) # 获取当前装备中的物品 item1 = @right_window.item # 设置当前的物品窗口到 @item_window case @right_window.index when 0 @item_window = @item_window1 when 1 @item_window = @item_window2 when 2 @item_window = @item_window3 when 3 @item_window = @item_window4 when 4 @item_window = @item_window5 when 5 @item_window = @item_window6 when 6 @item_window = @item_window7 end # 右窗口被激活的情况下 if @right_window.active # 删除变更装备后的能力 ############################################################### @left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil) end # 物品窗口被激活的情况下 if @item_window.active # 获取现在选中的物品 item2 = @item_window.item # 变更装备 last_hp = @actor.hp last_sp = @actor.sp @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id) ############################################################### # 获取变更装备后的能力值 new_atk = @actor.atk new_pdef = @actor.pdef new_mdef = @actor.mdef new_eva = @actor.eva new_str = @actor.str new_dex = @actor.dex new_agi = @actor.agi new_int = @actor.int # 返回到装备 @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id) @actor.hp = last_hp @actor.sp = last_sp # 描画左窗口 ############################################################### @left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int) ############################################################### end end end # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ # # 状态窗口美化,全防具装备栏描绘 # # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ #============================================================================== # ■ Window_Status #------------------------------------------------------------------------------ # 显示状态画面、完全规格的状态窗口。 #============================================================================== class Window_Status < Window_Base #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh self.contents.clear draw_actor_graphic(@actor, 40, 112) draw_actor_name(@actor, 4, 0) draw_actor_class(@actor, 4 + 144, 0) draw_actor_level(@actor, 96, 32) draw_actor_state(@actor, 96, 64) draw_actor_hp(@actor, 96, 112, 172) draw_actor_sp(@actor, 96, 144, 172) draw_actor_parameter(@actor, 96, 192, 0) draw_actor_parameter(@actor, 96, 224, 1) draw_actor_parameter(@actor, 96, 256, 2) draw_actor_parameter(@actor, 96, 304, 3) draw_actor_parameter(@actor, 96, 336, 4) draw_actor_parameter(@actor, 96, 368, 5) draw_actor_parameter(@actor, 96, 400, 6) self.contents.font.color = system_color self.contents.draw_text(320, 48, 80, 32, "EXP") self.contents.draw_text(320, 80, 80, 32, "NEXT") self.contents.font.color = normal_color self.contents.draw_text(320 + 80, 48, 84, 32, @actor.exp_s, 2) self.contents.draw_text(320 + 80, 80, 84, 32, @actor.next_rest_exp_s, 2) self.contents.font.color = system_color self.contents.draw_text(320, 160, 96, 32, "装备") draw_item_name($data_weapons[@actor.weapon_id], 320 + 16, 208) draw_item_name($data_armors[@actor.armor1_id], 320 + 16, 240) draw_item_name($data_armors[@actor.armor2_id], 320 + 16, 272) draw_item_name($data_armors[@actor.armor3_id], 320 + 16, 304) draw_item_name($data_armors[@actor.armor4_id], 320 + 16, 336) draw_item_name($data_armors[@actor.armor5_id], 320 + 16, 368) draw_item_name($data_armors[@actor.armor6_id], 320 + 16, 400) end def dummy self.contents.font.color = system_color self.contents.draw_text(320, 112, 96, 32, $data_system.words.weapon) self.contents.draw_text(320, 176, 96, 32, $data_system.words.armor1) self.contents.draw_text(320, 240, 96, 32, $data_system.words.armor2) self.contents.draw_text(320, 304, 96, 32, $data_system.words.armor3) self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor4) draw_item_name($data_weapons[@actor.weapon_id], 320 + 24, 144) draw_item_name($data_armors[@actor.armor1_id], 320 + 24, 208) draw_item_name($data_armors[@actor.armor2_id], 320 + 24, 272) draw_item_name($data_armors[@actor.armor3_id], 320 + 24, 336) draw_item_name($data_armors[@actor.armor4_id], 320 + 24, 400) end end # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ # # 商店购买窗口美化,增加对新装备位置的描述 # # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ #============================================================================== # ■ Window_ShopStatus #------------------------------------------------------------------------------ # 商店画面、显示物品所持数与角色装备的窗口。 #============================================================================== class Window_ShopStatus < Window_Base #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh self.contents.clear if @item == nil return end case @item when RPG::Item number = $game_party.item_number(@item.id) when RPG::Weapon number = $game_party.weapon_number(@item.id) when RPG::Armor number = $game_party.armor_number(@item.id) end self.contents.font.color = system_color self.contents.draw_text(4, 0, 200, 32, "所持数") self.contents.font.color = normal_color self.contents.draw_text(204, 0, 32, 32, number.to_s, 2) if @item.is_a?(RPG::Item) return end # 添加装备品信息 for i in 0...$game_party.actors.size # 获取角色 actor = $game_party.actors[i] # 可以装备为普通文字颜色、不能装备设置为无效文字颜色 if actor.equippable?(@item) self.contents.font.color = normal_color else self.contents.font.color = disabled_color end # 描绘角色名字 self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name) # 获取当前的装备品 if @item.is_a?(RPG::Weapon) item1 = $data_weapons[actor.weapon_id] elsif @item.kind == 0 item1 = $data_armors[actor.armor1_id] elsif @item.kind == 1 item1 = $data_armors[actor.armor2_id] elsif @item.kind == 2 item1 = $data_armors[actor.armor3_id] elsif @item.kind == 3 item1 = $data_armors[actor.armor4_id] elsif @item.kind == 4 item1 = $data_armors[actor.armor5_id] elsif @item.kind == 5 item1 = $data_armors[actor.armor6_id] end # 可以装备的情况 if actor.equippable?(@item) # 武器的情况 if @item.is_a?(RPG::Weapon) atk1 = item1 != nil ? item1.atk : 0 atk2 = @item != nil ? @item.atk : 0 change = atk2 - atk1 end # 防具的情况 if @item.is_a?(RPG::Armor) pdef1 = item1 != nil ? item1.pdef : 0 mdef1 = item1 != nil ? item1.mdef : 0 pdef2 = @item != nil ? @item.pdef : 0 mdef2 = @item != nil ? @item.mdef : 0 change = pdef2 - pdef1 + mdef2 - mdef1 end # 描绘能力值变化 self.contents.draw_text(124, 64 + 64 * i, 112, 32, sprintf("%+d", change), 2) end # 描绘物品 if item1 != nil x = 4 y = 64 + 64 * i + 32 bitmap = RPG::Cache.icon(item1.icon_name) opacity = self.contents.font.color == normal_color ? 255 : 128 self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity) self.contents.draw_text(x + 28, y, 212, 32, item1.name) end end end end
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
#
# 防具类追加
#
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
module RPG
class Armor
def name
name = @name.split(/,/)[0]
return name != nil ? name : ''
end
def kind
kind = @name.split(/,/)[1]
return kind != nil ? kind.to_i : @kind
end
end
end
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
#
# Game_Actor添加新的防具ID,并对相关方法修正
#
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
class Game_Actor < Game_Battler
attr_reader :armor5_id # 项链 ID
attr_reader :armor6_id # 鞋 ID
#--------------------------------------------------------------------------
# ● 设置
# actor_id : 角色 ID
#--------------------------------------------------------------------------
alias old_setup setup
def setup(actor_id)
old_setup(actor_id)
@armor5_id = 0
@armor6_id = 0
update_auto_state(nil, $data_armors[@armor5_id])
update_auto_state(nil, $data_armors[@armor6_id])
end
#--------------------------------------------------------------------------
# ● 取得属性修正值
# element_id : 属性 ID
#--------------------------------------------------------------------------
def element_rate(element_id)
# 获取对应属性有效度的数值
table = [0,200,150,100,50,0,-100]
result = table[$data_classes[@class_id].element_ranks[element_id]]
# 防具能防御本属性的情况下效果减半
for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id, @armor6_id]
armor = $data_armors[i]
if armor != nil and armor.guard_element_set.include?(element_id)
result /= 2
end
end
# 状态能防御本属性的情况下效果减半
for i in @states
if $data_states[i].guard_element_set.include?(element_id)
result /= 2
end
end
# 过程结束
return result
end
#--------------------------------------------------------------------------
# ● 判定防御属性
# state_id : 属性 ID
#--------------------------------------------------------------------------
def state_guard?(state_id)
for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id, @armor6_id]
armor = $data_armors[i]
if armor != nil
if armor.guard_state_set.include?(state_id)
return true
end
end
end
return false
end
#--------------------------------------------------------------------------
# ● 获取基本力量
#--------------------------------------------------------------------------
def base_str
n = $data_actors[@actor_id].parameters[2, @level]
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
armor5 = $data_armors[@armor5_id]
armor6 = $data_armors[@armor6_id]
n += weapon != nil ? weapon.str_plus : 0
n += armor1 != nil ? armor1.str_plus : 0
n += armor2 != nil ? armor2.str_plus : 0
n += armor3 != nil ? armor3.str_plus : 0
n += armor4 != nil ? armor4.str_plus : 0
n += armor5 != nil ? armor5.str_plus : 0
n += armor6 != nil ? armor6.str_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# ● 获取基本灵巧
#--------------------------------------------------------------------------
def base_dex
n = $data_actors[@actor_id].parameters[3, @level]
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
armor5 = $data_armors[@armor5_id]
armor6 = $data_armors[@armor6_id]
n += weapon != nil ? weapon.dex_plus : 0
n += armor1 != nil ? armor1.dex_plus : 0
n += armor2 != nil ? armor2.dex_plus : 0
n += armor3 != nil ? armor3.dex_plus : 0
n += armor4 != nil ? armor4.dex_plus : 0
n += armor5 != nil ? armor5.dex_plus : 0
n += armor6 != nil ? armor6.dex_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# ● 获取基本速度
#--------------------------------------------------------------------------
def base_agi
n = $data_actors[@actor_id].parameters[4, @level]
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
armor5 = $data_armors[@armor5_id]
armor6 = $data_armors[@armor6_id]
n += weapon != nil ? weapon.agi_plus : 0
n += armor1 != nil ? armor1.agi_plus : 0
n += armor2 != nil ? armor2.agi_plus : 0
n += armor3 != nil ? armor3.agi_plus : 0
n += armor4 != nil ? armor4.agi_plus : 0
n += armor5 != nil ? armor5.agi_plus : 0
n += armor6 != nil ? armor6.agi_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# ● 获取基本魔力
#--------------------------------------------------------------------------
def base_int
n = $data_actors[@actor_id].parameters[5, @level]
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
armor5 = $data_armors[@armor5_id]
armor6 = $data_armors[@armor6_id]
n += weapon != nil ? weapon.int_plus : 0
n += armor1 != nil ? armor1.int_plus : 0
n += armor2 != nil ? armor2.int_plus : 0
n += armor3 != nil ? armor3.int_plus : 0
n += armor4 != nil ? armor4.int_plus : 0
n += armor5 != nil ? armor5.int_plus : 0
n += armor6 != nil ? armor6.int_plus : 0
return [[n, 1].max, 999].min
end
#--------------------------------------------------------------------------
# ● 获取基本物理防御
#--------------------------------------------------------------------------
def base_pdef
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
armor5 = $data_armors[@armor5_id]
armor6 = $data_armors[@armor6_id]
pdef1 = weapon != nil ? weapon.pdef : 0
pdef2 = armor1 != nil ? armor1.pdef : 0
pdef3 = armor2 != nil ? armor2.pdef : 0
pdef4 = armor3 != nil ? armor3.pdef : 0
pdef5 = armor4 != nil ? armor4.pdef : 0
pdef6 = armor5 != nil ? armor5.pdef : 0
pdef7 = armor6 != nil ? armor6.pdef : 0
return pdef1 + pdef2 + pdef3 + pdef4 + pdef5 + pdef6 + pdef7 + dex*0.33
end
#--------------------------------------------------------------------------
# ● 获取基本魔法防御
#--------------------------------------------------------------------------
def base_mdef
weapon = $data_weapons[@weapon_id]
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
armor5 = $data_armors[@armor5_id]
armor6 = $data_armors[@armor6_id]
mdef1 = weapon != nil ? weapon.mdef : 0
mdef2 = armor1 != nil ? armor1.mdef : 0
mdef3 = armor2 != nil ? armor2.mdef : 0
mdef4 = armor3 != nil ? armor3.mdef : 0
mdef5 = armor4 != nil ? armor4.mdef : 0
mdef6 = armor5 != nil ? armor5.mdef : 0
mdef7 = armor6 != nil ? armor6.mdef : 0
return mdef1 + mdef2 + mdef3 + mdef4 + mdef5 + mdef6 + mdef7 + int*0.33
end
#--------------------------------------------------------------------------
# ● 获取基本回避修正
#--------------------------------------------------------------------------
def base_eva
armor1 = $data_armors[@armor1_id]
armor2 = $data_armors[@armor2_id]
armor3 = $data_armors[@armor3_id]
armor4 = $data_armors[@armor4_id]
armor5 = $data_armors[@armor5_id]
armor6 = $data_armors[@armor6_id]
eva1 = armor1 != nil ? armor1.eva : 0
eva2 = armor2 != nil ? armor2.eva : 0
eva3 = armor3 != nil ? armor3.eva : 0
eva4 = armor4 != nil ? armor4.eva : 0
eva5 = armor5 != nil ? armor5.eva : 0
eva6 = armor6 != nil ? armor6.eva : 0
return eva1 + eva2 + eva3 + eva4 + eva5 + eva6
end
#--------------------------------------------------------------------------
# ● 装备固定判定
# equip_type : 装备类型
#--------------------------------------------------------------------------
def equip_fix?(equip_type)
case equip_type
when 0 # 武器
return $data_actors[@actor_id].weapon_fix
when 1 # 盾
return $data_actors[@actor_id].armor1_fix
when 2 # 头
return $data_actors[@actor_id].armor2_fix
when 3 # 身体
return $data_actors[@actor_id].armor3_fix
when 4 # 装饰品
return $data_actors[@actor_id].armor4_fix
end
return false
end
#--------------------------------------------------------------------------
# ● 变更装备
# equip_type : 装备类型
# id : 武器 or 防具 ID (0 为解除装备)
#--------------------------------------------------------------------------
def equip(equip_type, id)
case equip_type
when 0 # 武器
if id == 0 or $game_party.weapon_number(id) > 0
$game_party.gain_weapon(@weapon_id, 1)
@weapon_id = id
$game_party.lose_weapon(id, 1)
end
when 1 # 盾
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor1_id], $data_armors[id])
$game_party.gain_armor(@armor1_id, 1)
@armor1_id = id
$game_party.lose_armor(id, 1)
end
when 2 # 头
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor2_id], $data_armors[id])
$game_party.gain_armor(@armor2_id, 1)
@armor2_id = id
$game_party.lose_armor(id, 1)
end
when 3 # 身体
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor3_id], $data_armors[id])
$game_party.gain_armor(@armor3_id, 1)
@armor3_id = id
$game_party.lose_armor(id, 1)
end
when 4 # 装饰品
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor4_id], $data_armors[id])
$game_party.gain_armor(@armor4_id, 1)
@armor4_id = id
$game_party.lose_armor(id, 1)
end
when 5 # 项链
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor5_id], $data_armors[id])
$game_party.gain_armor(@armor5_id, 1)
@armor5_id = id
$game_party.lose_armor(id, 1)
end
when 6 # 鞋
if id == 0 or $game_party.armor_number(id) > 0
update_auto_state($data_armors[@armor6_id], $data_armors[id])
$game_party.gain_armor(@armor6_id, 1)
@armor6_id = id
$game_party.lose_armor(id, 1)
end
end
end
#--------------------------------------------------------------------------
# ● 更改职业 ID
# class_id : 新的职业 ID
#--------------------------------------------------------------------------
def class_id=(class_id)
if $data_classes[class_id] != nil
@class_id = class_id
# 避开无法装备的物品
unless equippable?($data_weapons[@weapon_id])
equip(0, 0)
end
unless equippable?($data_armors[@armor1_id])
equip(1, 0)
end
unless equippable?($data_armors[@armor2_id])
equip(2, 0)
end
unless equippable?($data_armors[@armor3_id])
equip(3, 0)
end
unless equippable?($data_armors[@armor4_id])
equip(4, 0)
end
unless equippable?($data_armors[@armor5_id])
equip(5, 0)
end
unless equippable?($data_armors[@armor6_id])
equip(6, 0)
end
end
end
end
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
#
# Window_Base美化,增加属性增减颜色,及全能力值描绘
#
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
# 游戏中全部窗口的超级类。
#==============================================================================
class Window_Base < Window
################## 属性增减颜色 ##############################
def up_color
return Color.new(0, 255, 0)
end
def down_color
return Color.new(255, 0, 0)
end
#--------------------------------------------------------------------------
# ● 描绘能力值
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# type : 能力值种类 (0~6)
#--------------------------------------------------------------------------
def draw_actor_parameter(actor, x, y, type)
case type
when 0
parameter_name = $data_system.words.atk
parameter_value = actor.atk
when 1
parameter_name = $data_system.words.pdef
parameter_value = actor.pdef
when 2
parameter_name = $data_system.words.mdef
parameter_value = actor.mdef
when 3
parameter_name = $data_system.words.str
parameter_value = actor.str
when 4
parameter_name = $data_system.words.dex
parameter_value = actor.dex
when 5
parameter_name = $data_system.words.agi
parameter_value = actor.agi
when 6
parameter_name = $data_system.words.int
parameter_value = actor.int
when 7
parameter_name = "回避"
parameter_value = actor.eva
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, parameter_name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
end
end
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
#
# 装备窗口美化,全能力值描绘并追加新的防具装备栏
#
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
#==============================================================================
# ■ Window_EquipRight
#------------------------------------------------------------------------------
# 装备画面、显示角色现在装备的物品的窗口。
#==============================================================================
class Window_EquipRight < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize(actor)
super(272, 64, 368, 256)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@data = []
@data.push($data_weapons[@actor.weapon_id])
@data.push($data_armors[@actor.armor1_id])
@data.push($data_armors[@actor.armor2_id])
@data.push($data_armors[@actor.armor3_id])
@data.push($data_armors[@actor.armor4_id])
@data.push($data_armors[@actor.armor5_id])
@data.push($data_armors[@actor.armor6_id])
@item_max = @data.size
self.contents.font.color = system_color
self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
self.contents.draw_text(4, 32 * 4, 92, 32, $data_system.words.armor4)
self.contents.draw_text(4, 32 * 5, 92, 32, "项链")
self.contents.draw_text(4, 32 * 6, 92, 32, "鞋")
draw_item_name(@data[0], 92, 32 * 0)
draw_item_name(@data[1], 92, 32 * 1)
draw_item_name(@data[2], 92, 32 * 2)
draw_item_name(@data[3], 92, 32 * 3)
draw_item_name(@data[4], 92, 32 * 4)
draw_item_name(@data[5], 92, 32 * 5)
draw_item_name(@data[6], 92, 32 * 6)
end
end
#==============================================================================
# ■ Window_EquipLeft
#------------------------------------------------------------------------------
# 装备画面的、显示角色能力值变化的窗口。
#==============================================================================
class Window_EquipLeft < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 64, 272, 416)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
draw_actor_level(@actor, 4, 32)
draw_actor_parameter(@actor, 4, 64, 0)
draw_actor_parameter(@actor, 4, 96, 1)
draw_actor_parameter(@actor, 4, 128, 2)
draw_actor_parameter(@actor, 4, 160, 7)
draw_actor_parameter(@actor, 4, 192, 3)
draw_actor_parameter(@actor, 4, 224, 4)
draw_actor_parameter(@actor, 4, 256, 5)
draw_actor_parameter(@actor, 4, 288, 6)
if @new_atk != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 64, 40, 32, "→", 1)
self.contents.font.color = @new_atk>@actor.atk ? up_color : down_color
self.contents.font.color = normal_color if @new_atk == @actor.atk
self.contents.draw_text(200, 64, 36, 32, @new_atk.to_s, 2)
end
if @new_pdef != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 96, 40, 32, "→", 1)
self.contents.font.color = @new_pdef>@actor.pdef ? up_color : down_color
self.contents.font.color = normal_color if @new_pdef == @actor.pdef
self.contents.draw_text(200, 96, 36, 32, @new_pdef.to_s, 2)
end
if @new_mdef != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 128, 40, 32, "→", 1)
self.contents.font.color = @new_mdef>@actor.mdef ? up_color : down_color
self.contents.font.color = normal_color if @new_mdef == @actor.mdef
self.contents.draw_text(200, 128, 36, 32, @new_mdef.to_s, 2)
end
if @new_eva != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 160, 40, 32, "→", 1)
self.contents.font.color = @new_eva>@actor.eva ? up_color : down_color
self.contents.font.color = normal_color if @new_eva == @actor.eva
self.contents.draw_text(200, 160, 36, 32, @new_eva.to_s, 2)
end
if @new_str != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 192, 40, 32, "→", 1)
self.contents.font.color = @new_str>@actor.str ? up_color : down_color
self.contents.font.color = normal_color if @new_str == @actor.str
self.contents.draw_text(200, 192, 36, 32, @new_str.to_s, 2)
end
if @new_dex != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 224, 40, 32, "→", 1)
self.contents.font.color = @new_dex>@actor.dex ? up_color : down_color
self.contents.font.color = normal_color if @new_dex == @actor.dex
self.contents.draw_text(200, 224, 36, 32, @new_dex.to_s, 2)
end
if @new_agi != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 256, 40, 32, "→", 1)
self.contents.font.color = @new_agi>@actor.agi ? up_color : down_color
self.contents.font.color = normal_color if @new_agi == @actor.agi
self.contents.draw_text(200, 256, 36, 32, @new_agi.to_s, 2)
end
if @new_int != nil
self.contents.font.color = system_color
self.contents.draw_text(160, 288, 40, 32, "→", 1)
self.contents.font.color = @new_int>@actor.int ? up_color : down_color
self.contents.font.color = normal_color if @new_int == @actor.int
self.contents.draw_text(200, 288, 36, 32, @new_int.to_s, 2)
end
end
#--------------------------------------------------------------------------
# ● 变更装备后的能力值设置
# new_atk : 变更装备后的攻击力
# new_pdef : 变更装备后的物理防御
# new_mdef : 变更装备后的魔法防御
#--------------------------------------------------------------------------
def set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
if @new_atk != new_atk or @new_pdef !=new_pdef or @new_mdef != new_mdef or @new_eva != new_eva or @new_str != new_str or @new_dex !=new_dex or @new_agi != new_agi or @new_int != new_int
@new_atk = new_atk
@new_pdef = new_pdef
@new_mdef = new_mdef
@new_eva = new_eva
@new_str = new_str
@new_dex = new_dex
@new_agi = new_agi
@new_int = new_int
refresh
end
end
end
#==============================================================================
# ■ Window_EquipItem
#------------------------------------------------------------------------------
# 装备画面、显示浏览变更装备的候补物品的窗口。
#==============================================================================
class Window_EquipItem < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
# equip_type : 装备部位 (0~3)
#--------------------------------------------------------------------------
def initialize(actor, equip_type)
super(272, 320, 368, 160)
@actor = actor
@equip_type = equip_type
@column_max = 1
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# ● 项目的描绘
# index : 项目符号
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
x = 4
y = index * 32
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
self.contents.font.color = normal_color
self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
end
end
class Scene_Equip
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
# 获取角色
@actor = $game_party.actors[@actor_index]
# 生成窗口
@help_window = Window_Help.new
@left_window = Window_EquipLeft.new(@actor)
@right_window = Window_EquipRight.new(@actor)
@item_window1 = Window_EquipItem.new(@actor, 0)
@item_window2 = Window_EquipItem.new(@actor, 1)
@item_window3 = Window_EquipItem.new(@actor, 2)
@item_window4 = Window_EquipItem.new(@actor, 3)
@item_window5 = Window_EquipItem.new(@actor, 4)
@item_window6 = Window_EquipItem.new(@actor, 5)
@item_window7 = Window_EquipItem.new(@actor, 6)
# 关联帮助窗口
@right_window.help_window = @help_window
@item_window1.help_window = @help_window
@item_window2.help_window = @help_window
@item_window3.help_window = @help_window
@item_window4.help_window = @help_window
@item_window5.help_window = @help_window
@item_window6.help_window = @help_window
@item_window7.help_window = @help_window
# 设置光标位置
@right_window.index = @equip_index
refresh
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换的话的就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
@help_window.dispose
@left_window.dispose
@right_window.dispose
@item_window1.dispose
@item_window2.dispose
@item_window3.dispose
@item_window4.dispose
@item_window5.dispose
@item_window6.dispose
@item_window7.dispose
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
# 设置物品窗口的可视状态
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index == 1)
@item_window3.visible = (@right_window.index == 2)
@item_window4.visible = (@right_window.index == 3)
@item_window5.visible = (@right_window.index == 4)
@item_window6.visible = (@right_window.index == 5)
@item_window7.visible = (@right_window.index == 6)
# 获取当前装备中的物品
item1 = @right_window.item
# 设置当前的物品窗口到 @item_window
case @right_window.index
when 0
@item_window = @item_window1
when 1
@item_window = @item_window2
when 2
@item_window = @item_window3
when 3
@item_window = @item_window4
when 4
@item_window = @item_window5
when 5
@item_window = @item_window6
when 6
@item_window = @item_window7
end
# 右窗口被激活的情况下
if @right_window.active
# 删除变更装备后的能力
###############################################################
@left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil)
end
# 物品窗口被激活的情况下
if @item_window.active
# 获取现在选中的物品
item2 = @item_window.item
# 变更装备
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
###############################################################
# 获取变更装备后的能力值
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
new_eva = @actor.eva
new_str = @actor.str
new_dex = @actor.dex
new_agi = @actor.agi
new_int = @actor.int
# 返回到装备
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
# 描画左窗口
###############################################################
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
###############################################################
end
end
end
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
#
# 状态窗口美化,全防具装备栏描绘
#
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
#==============================================================================
# ■ Window_Status
#------------------------------------------------------------------------------
# 显示状态画面、完全规格的状态窗口。
#==============================================================================
class Window_Status < Window_Base
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_graphic(@actor, 40, 112)
draw_actor_name(@actor, 4, 0)
draw_actor_class(@actor, 4 + 144, 0)
draw_actor_level(@actor, 96, 32)
draw_actor_state(@actor, 96, 64)
draw_actor_hp(@actor, 96, 112, 172)
draw_actor_sp(@actor, 96, 144, 172)
draw_actor_parameter(@actor, 96, 192, 0)
draw_actor_parameter(@actor, 96, 224, 1)
draw_actor_parameter(@actor, 96, 256, 2)
draw_actor_parameter(@actor, 96, 304, 3)
draw_actor_parameter(@actor, 96, 336, 4)
draw_actor_parameter(@actor, 96, 368, 5)
draw_actor_parameter(@actor, 96, 400, 6)
self.contents.font.color = system_color
self.contents.draw_text(320, 48, 80, 32, "EXP")
self.contents.draw_text(320, 80, 80, 32, "NEXT")
self.contents.font.color = normal_color
self.contents.draw_text(320 + 80, 48, 84, 32, @actor.exp_s, 2)
self.contents.draw_text(320 + 80, 80, 84, 32, @actor.next_rest_exp_s, 2)
self.contents.font.color = system_color
self.contents.draw_text(320, 160, 96, 32, "装备")
draw_item_name($data_weapons[@actor.weapon_id], 320 + 16, 208)
draw_item_name($data_armors[@actor.armor1_id], 320 + 16, 240)
draw_item_name($data_armors[@actor.armor2_id], 320 + 16, 272)
draw_item_name($data_armors[@actor.armor3_id], 320 + 16, 304)
draw_item_name($data_armors[@actor.armor4_id], 320 + 16, 336)
draw_item_name($data_armors[@actor.armor5_id], 320 + 16, 368)
draw_item_name($data_armors[@actor.armor6_id], 320 + 16, 400)
end
def dummy
self.contents.font.color = system_color
self.contents.draw_text(320, 112, 96, 32, $data_system.words.weapon)
self.contents.draw_text(320, 176, 96, 32, $data_system.words.armor1)
self.contents.draw_text(320, 240, 96, 32, $data_system.words.armor2)
self.contents.draw_text(320, 304, 96, 32, $data_system.words.armor3)
self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor4)
draw_item_name($data_weapons[@actor.weapon_id], 320 + 24, 144)
draw_item_name($data_armors[@actor.armor1_id], 320 + 24, 208)
draw_item_name($data_armors[@actor.armor2_id], 320 + 24, 272)
draw_item_name($data_armors[@actor.armor3_id], 320 + 24, 336)
draw_item_name($data_armors[@actor.armor4_id], 320 + 24, 400)
end
end
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
#
# 商店购买窗口美化,增加对新装备位置的描述
#
# ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
#==============================================================================
# ■ Window_ShopStatus
#------------------------------------------------------------------------------
# 商店画面、显示物品所持数与角色装备的窗口。
#==============================================================================
class Window_ShopStatus < Window_Base
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if @item == nil
return
end
case @item
when RPG::Item
number = $game_party.item_number(@item.id)
when RPG::Weapon
number = $game_party.weapon_number(@item.id)
when RPG::Armor
number = $game_party.armor_number(@item.id)
end
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 200, 32, "所持数")
self.contents.font.color = normal_color
self.contents.draw_text(204, 0, 32, 32, number.to_s, 2)
if @item.is_a?(RPG::Item)
return
end
# 添加装备品信息
for i in 0...$game_party.actors.size
# 获取角色
actor = $game_party.actors[i]
# 可以装备为普通文字颜色、不能装备设置为无效文字颜色
if actor.equippable?(@item)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
# 描绘角色名字
self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name)
# 获取当前的装备品
if @item.is_a?(RPG::Weapon)
item1 = $data_weapons[actor.weapon_id]
elsif @item.kind == 0
item1 = $data_armors[actor.armor1_id]
elsif @item.kind == 1
item1 = $data_armors[actor.armor2_id]
elsif @item.kind == 2
item1 = $data_armors[actor.armor3_id]
elsif @item.kind == 3
item1 = $data_armors[actor.armor4_id]
elsif @item.kind == 4
item1 = $data_armors[actor.armor5_id]
elsif @item.kind == 5
item1 = $data_armors[actor.armor6_id]
end
# 可以装备的情况
if actor.equippable?(@item)
# 武器的情况
if @item.is_a?(RPG::Weapon)
atk1 = item1 != nil ? item1.atk : 0
atk2 = @item != nil ? @item.atk : 0
change = atk2 - atk1
end
# 防具的情况
if @item.is_a?(RPG::Armor)
pdef1 = item1 != nil ? item1.pdef : 0
mdef1 = item1 != nil ? item1.mdef : 0
pdef2 = @item != nil ? @item.pdef : 0
mdef2 = @item != nil ? @item.mdef : 0
change = pdef2 - pdef1 + mdef2 - mdef1
end
# 描绘能力值变化
self.contents.draw_text(124, 64 + 64 * i, 112, 32,
sprintf("%+d", change), 2)
end
# 描绘物品
if item1 != nil
x = 4
y = 64 + 64 * i + 32
bitmap = RPG::Cache.icon(item1.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 212, 32, item1.name)
end
end
end
end
|
最佳答案
查看完整内容
165~176注释掉的when7和when8的那几行:
|