幻想森林

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 2325|回复: 7

[RMVX] 分享&求助  技能加點習得系統 & 物品倉庫問題

[复制链接]

1

主题

6

帖子

63

积分

②入门

积分
63
发表于 2010-1-31 21:07:54 | 显示全部楼层 |阅读模式
以下的就是從日站找來的技能加點習得系統,可是有一個缺點就是會重整MENU,使MENU變成這個腳本設定的,即其他腳本不能使用

有高手可以改一改這個系統,使它不會強行改變MENU,從而使用其他腳本嗎?

還有,就是VX怎樣弄一個存入提取物品,武器,防具的倉庫?有腳本可以提供給我嗎?

謝謝

#==============================================================================
# ○ポイント制スキル習得 Ver1.03
# for RGSS2
# 西瓜 / Space not far
# http://muspell.raindrop.jp/
# レベルアップなどで得たポイントを割り振ることでスキルを習得できるシステムです。
# デフォルトのレベルアップによるスキル習得とも併用可能です。
#==============================================================================
# ■更新履歴
# Ver1.03
# ・キャラ初期化時ポイントが初期化されない不具合を修正。
# ・KGC Softwareの「ヘルプウィンドウ機能拡張」に対応。
# (ソースを一部コピーして改変しただけ)
# Ver1.02
# ・習得条件を満たさないスキルの名前を隠す機能を追加。
# ・その他バグ修正。
# Ver1.01
# ・スキル習得条件として必須スキルの設定を追加。
#==============================================================================

# module SNF 内のLEARNLISTでポイントで習得可能なスキルを設定してください。

# メモ欄に<必要SP:n>と書き込むことで
# 個別に消費するポイントを設定することが出来ます。
# 例:<必要SP:5> => 習得に5ポイントが必要

# また、スキルのメモ欄に
# <必須スキル[必要なスキルその1のID,必要なスキルその2のID]...>という形式で
# 記述することによって、それらをそのスキルの習得条件として
# 設定することが出来ます。
# 例:<必須スキル[1,2]> => 三回攻撃の習得には連続攻撃と二回攻撃の両方が必要

# イベントコマンドのスクリプトでSNF:EARNLIST[アクターID].push(スキルID)と
# 記述することでそのアクターの習得候補リストにスキルIDのスキルを追加できます。
# 例:SNF:EARNLIST[1].push(15) => ラルフのリストに毒の息を追加

# イベントコマンドのスクリプトでsnf_grow_sp(増加値, アクターID)と
# 記述することでそのIDのアクターのポイントを増加値分プラスすることができます。
# アクターIDを0にしたり省略したりした場合、パーティ全員にプラスされます。
# また、増加値にマイナスの値を設定することも可能です。

# ■仕様
# LEARN_MENUCOMMANDをtrueにした場合でも
# 他のシーンからメニューに戻ってきた場合カーソルがズレることがあります。
# 不親切ですがご自分で各シーンのreturn_sceneの引数を変更してください。

module SNF
LEARN_WORD = "スキル習得" # メニューコマンドに表示される項目名
LEARN_SP_WORD = "SP" # 習得時に必要なポイントの名称

LEARNLIST = []

LEARNLIST[1] = [11, 12]
LEARNLIST[2] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
# LEARNLIST[職業orアクターID] = [習得可能スキルIDの配列]
# 習得可能スキルの配列にあるものがスキル習得画面に並びます。
# すでに習得しているものはリストから除外されます。

LEARNSKILL_CLASS_OR_ACTOR = 1 # 0 => 職業ID別の習得 1 => アクターID別の習得
# LEARNLISTで職業とアクターIDどちらを参照するかを設定します。

CAPTION_NEEDSKILL = true
# 習得条件を満たしていない場合、ヘルプに条件スキルを表示するか?(true/false)
CAPTION_SKILL = "必要なスキルを覚えていません" # スキルが足りない場合
CAPTION_SP = "SPが足りません" # SPが足りない場合

LEARN_CONSEAL = true
# 習得条件を満たさないときスキル名を隠すか?(true/false)
LEARN_CONSEALNAME = "×××××"
# スキル名のかわりに表示する文字

DEFAULT_SP = 3 # 各アクターの初期SP
DEFAULT_SPCOST = 1 # 消費SP無設定の場合の消費SP
GLOW_SP = 1 # レベルアップ時に上昇するSP

LEARN_SOUND = RPG::SE.new("Up", 80, 100)
# スキル習得時に再生されるSE。RPG::SE.new(ファイル名, 音量, ピッチ)

LEARN_RETURN = Scene_Menu.new(2) # スキル習得終了時に戻るシーン

LEARN_MENUCOMMAND = true
# メニューコマンドを再定義してスキル習得の項目を付け足すか?(true/false)

LEARN_COST_DISAPPEAR = false # 習得コストを非表示にするか?(true/false)

LEARN_KGC_HelpExtension = false # ヘルプウィンドウ機能拡張を併用しているか?

def self.sp_cost(skill)
return 0 if skill == nil
memo = skill.note.scan(/<必要SP\d+)>/)
memo = memo.flatten
if memo != nil and not memo.empty?
return memo[0].to_i
else
return DEFAULT_SPCOST
end
end
end

class Game_Actor
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :sp
alias snf_learnskill_initialize initialize
def initialize(actor_id)
snf_learnskill_initialize(actor_id)
@sp = SNF:EFAULT_SP
end
#--------------------------------------------------------------------------
# ● セットアップ
# actor_id : アクター ID
#--------------------------------------------------------------------------
alias snf_learnskill_setup setup
def setup(actor_id)
snf_learnskill_setup(actor_id)
@sp = SNF:EFAULT_SP
end
end

class Scene_LearnSkill < Scene_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# actor_index : アクターインデックス
#--------------------------------------------------------------------------
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
def start
super
create_menu_background
@actor = $game_party.members[@actor_index]
@viewport = Viewport.new(0, 0, 544, 416)
@help_window = Window_Help.new
@help_window.viewport = @viewport
@status_window = Window_LearnSkillStatus.new(0, 56, @actor)
@status_window.viewport = @viewport
@skill_window = Window_LearnSkill.new(0, 112, 544, 304, @actor)
@skill_window.viewport = @viewport
@skill_window.help_window = @help_window
end
#--------------------------------------------------------------------------
# ● 終了処理
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@status_window.dispose
@help_window.dispose
@skill_window.dispose
end
#--------------------------------------------------------------------------
# ● 元の画面へ戻る
#--------------------------------------------------------------------------
def return_scene
$scene = SNF:EARN_RETURN
end
#--------------------------------------------------------------------------
# ● 次のアクターの画面に切り替え
#--------------------------------------------------------------------------
def next_actor
@actor_index += 1
@actor_index %= $game_party.members.size
$scene = Scene_LearnSkill.new(@actor_index)
end
#--------------------------------------------------------------------------
# ● 前のアクターの画面に切り替え
#--------------------------------------------------------------------------
def prev_actor
@actor_index += $game_party.members.size - 1
@actor_index %= $game_party.members.size
$scene = Scene_LearnSkill.new(@actor_index)
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
update_menu_background
@status_window.update
@help_window.update
@skill_window.update
if @skill_window.active
update_skill_selection
end
end
#--------------------------------------------------------------------------
# ● スキル選択の更新
#--------------------------------------------------------------------------
def update_skill_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::R)
Sound.play_cursor
next_actor
elsif Input.trigger?(Input:)
Sound.play_cursor
prev_actor
elsif Input.trigger?(Input::C)
@skill = @skill_window.skill
if @skill != nil
@actor.last_skill_id = @skill.id
if @actor.learn_sp_skill?(@skill)
@actor.learn_skill(@skill.id)
@actor.sp -= SNF.sp_cost(@skill)
@skill_window.refresh
@status_window.refresh
SNF:EARN_SOUND.play
else
Sound.play_buzzer
end
else
Sound.play_buzzer
end
end
end
end

class Window_LearnSkill < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# x : ウィンドウの X 座標
# y : ウィンドウの Y 座標
# width : ウィンドウの幅
# height : ウィンドウの高さ
# actor : アクター
#--------------------------------------------------------------------------
def initialize(x, y, width, height, actor)
super(x, y, width, height)
@actor = actor
@column_max = 2
self.index = 0
refresh
end
#--------------------------------------------------------------------------
# ● スキルの取得
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
@data = []
for skill in @actor.learnskills
@data.push(skill)
if skill.id == @actor.last_skill_id
self.index = @data.size - 1
end
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# ● 項目の描画
# index : 項目番号
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
skill = @data[index]
if skill != nil
rect.width -= 4
enabled = @actor.learn_sp_skill?(skill)
cost = (SNF:EARN_COST_DISAPPEAR) ? "" : SNF.sp_cost(skill)
draw_item_name(skill, rect.x, rect.y, enabled)
self.contents.draw_text(rect, cost, 2)
end
end
#--------------------------------------------------------------------------
# ● アイテム名の描画
# item : アイテム (スキル、武器、防具でも可)
# x : 描画先 X 座標
# y : 描画先 Y 座標
# enabled : 有効フラグ。false のとき半透明で描画
#--------------------------------------------------------------------------
def draw_item_name(item, x, y, enabled = true)
if item != nil
draw_icon(item.icon_index, x, y, enabled)
self.contents.font.color = normal_color
self.contents.font.color.alpha = enabled ? 255 : 128
if enabled
name = item.name
else
if @actor.learn_tree_skill?(item)
name = item.name
else
name = SNF:EARN_CONSEAL ? SNF:EARN_CONSEALNAME : item.name
end
end
self.contents.draw_text(x + 24, y, 172, WLH, name)
end
end
#--------------------------------------------------------------------------
# ● ヘルプテキスト更新
#--------------------------------------------------------------------------
def update_help
unless SNF::CAPTION_NEEDSKILL
@help_window.set_text(skill == nil ? "" : skill.description)
else
if @actor.learn_sp_skill?(skill)
@help_window.set_text(skill == nil ? "" : skill.description)
else
if @actor.sp < SNF.sp_cost(skill)
@help_window.set_text(skill == nil ? "" : SNF::CAPTION_SP)
else
@help_window.set_text(skill == nil ? "" : SNF::CAPTION_SKILL)
end
end
end
end
end

class Game_Battler
def learn_sp_skill?(skill)
if self.sp >= SNF.sp_cost(skill) # コストは足りてるか?
return false if skill == nil
return learn_tree_skill?(skill)
else
return false # コストが足りない
end
end

def learn_tree_skill?(skill)
memo = skill.note.scan(/<必須スキル\[(\S+)\]>/)
memo = memo.flatten
if memo != nil and not memo.empty?
tree = memo[0].split(/\s*,\s*/)
tree_ok = true
for tree_id in tree
return false unless self.skill_learn?($data_skills[tree_id.to_i])
end
if tree_ok
return true
else
return false # スキルが足りない
end
else
return true
end
end
end
class Game_Interpreter
#--------------------------------------------------------------------------
# ● SP の増減
#--------------------------------------------------------------------------
def snf_grow_sp(value, actor_id = 0)
iterate_actor_id(actor_id) do |actor|
actor.sp += value
end
return true
end
end

class Window_LearnSkillStatus < Window_Base
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# x : ウィンドウの X 座標
# y : ウィンドウの Y 座標
# actor : アクター
#--------------------------------------------------------------------------
def initialize(x, y, actor)
super(x, y, 544, WLH + 32)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_name(@actor, 4, 0)
self.contents.font.color = system_color
self.contents.draw_text(140, 0, 32, WLH, SNF:EARN_SP_WORD)
self.contents.font.color = normal_color
self.contents.draw_text(172, 0, 48, WLH, @actor.sp, 2)
end
end

class Game_Actor < Game_Battler
alias snf_learnskill_level_up level_up
def level_up
self.sp += SNF::GLOW_SP
snf_learnskill_level_up # メソッド呼び戻し
end
#--------------------------------------------------------------------------
# ● スキルオブジェクトの配列取得
#--------------------------------------------------------------------------
def learnskills
result = []
if SNF:EARNSKILL_CLASS_OR_ACTOR == 0 # 職業ID
skills = (SNF::LEARNLIST[self.class_id] != nil) ? SNF::LEARNLIST[self.class_id] : []
elsif SNF::LEARNSKILL_CLASS_OR_ACTOR == 1 # アクターID
skills = (SNF::LEARNLIST[self.id] != nil) ? SNF::LEARNLIST[self.id] : []
end
for i in skills
next if skill_learn?($data_skills)
result.push($data_skills)
end
return result
end
end

if SNF::LEARN_MENUCOMMAND
# 再定義
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# ● コマンドウィンドウの作成
#--------------------------------------------------------------------------
def create_command_window
s1 = Vocab::item
s2 = Vocab::skill
s3 = Vocab::equip
s4 = Vocab::status
s5 = Vocab::save
s6 = Vocab::game_end
s7 = SNF::LEARN_WORD
@command_window = Window_Command.new(160, [s1, s2, s7, s3, s4, s5, s6])
@command_window.index = @menu_index
if $game_party.members.size == 0 # パーティ人数が 0 人の場合
@command_window.draw_item(0, false) # アイテムを無効化
@command_window.draw_item(1, false) # スキルを無効化
@command_window.draw_item(2, false) # スキル習得を無効化
@command_window.draw_item(3, false) # 装備を無効化
@command_window.draw_item(4, false) # ステータスを無効化
end
if $game_system.save_disabled # セーブ禁止の場合
@command_window.draw_item(5, false) # セーブを無効化
end
end
#--------------------------------------------------------------------------
# ● コマンド選択の更新
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_party.members.size == 0 and @command_window.index < 5
Sound.play_buzzer
return
elsif $game_system.save_disabled and @command_window.index == 5
Sound.play_buzzer
return
end
Sound.play_decision
case @command_window.index
when 0 # アイテム
$scene = Scene_Item.new
when 1,2,3,4 # スキル、スキル習得、装備、ステータス
start_actor_selection
when 5 # セーブ
$scene = Scene_File.new(true, false, false)
when 6 # ゲーム終了
$scene = Scene_End.new
end
end
end
#--------------------------------------------------------------------------
# ● アクター選択の更新
#--------------------------------------------------------------------------
def update_actor_selection
if Input.trigger?(Input::B)
Sound.play_cancel
end_actor_selection
elsif Input.trigger?(Input::C)
$game_party.last_actor_index = @status_window.index
Sound.play_decision
case @command_window.index
when 1 # スキル
$scene = Scene_Skill.new(@status_window.index)
when 2 # スキル習得
$scene = Scene_LearnSkill.new(@status_window.index)
when 3 # 装備
$scene = Scene_Equip.new(@status_window.index)
when 4 # ステータス
$scene = Scene_Status.new(@status_window.index)
end
end
end
end
end
if SNF::LEARN_KGC_HelpExtension
class Scene_LearnSkill < Scene_Base
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
alias start_KGC_HelpExtension start
def start
start_KGC_HelpExtension

adjust_window_size
end
#--------------------------------------------------------------------------
# ● ウィンドウサイズ調整
#--------------------------------------------------------------------------
def adjust_window_size
@help_window.row_max = KGC::HelpExtension::ROW_MAX
@status_window.y = @help_window.height
dy = @help_window.height + @status_window.height
@skill_window.y = dy
@skill_window.height = Graphics.height - dy
@skill_window.refresh
end
end
end
回复

使用道具 举报

15

主题

271

帖子

2198

积分

⑥精研

我要疯狂积累活跃度!

积分
2198
QQ
发表于 2010-2-1 07:09:33 | 显示全部楼层
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
def start
super
create_menu_background
@actor = $game_party.members[@actor_index]
@viewport = Viewport.new(0, 0, 544, 416)
@help_window = Window_Help.new
@help_window.viewport = @viewport
@status_window = Window_LearnSkillStatus.new(0, 56, @actor)
@status_window.viewport = @viewport
@skill_window = Window_LearnSkill.new(0, 112, 544, 304, @actor)
@skill_window.viewport = @viewport
@skill_window.help_window = @help_window
end


先改这里,后面好像也需要动一点手脚,如果要用其他菜单脚本的话需要把那个菜单脚本调用的东西修改成调用这里的东西。所以最好发一下那个脚本,或者自己修改=。=
紫月光流奈河畔, 孤影独行笑苍天。 酆都倒比人间好, 从此慕鬼不羡仙!
回复 支持 反对

使用道具 举报

0

主题

1

帖子

10

积分

②入门

积分
10
发表于 2010-2-1 11:30:03 | 显示全部楼层

Re:分享&求助  技能加點習得系統 &amp

這腳本是[技能加點]還是[屬性加點]?
具體怎麼使用?
回复 支持 反对

使用道具 举报

1

主题

6

帖子

63

积分

②入门

积分
63
 楼主| 发表于 2010-2-1 11:41:48 | 显示全部楼层
謝謝高手幫忙,想不到這麼快就有回覆,很感動

其實我是腳本白痴,所以不懂得改

每次一開那個技能加點習得,我MENU裏的升級加點,任務目錄,魔物圖鑑,技能裝備,隊伍編成就會通通消失,真可惡

還有找了很久,也看不到有腳本是盃一個物品倉庫,高手們知道如何做嗎?

我其他腳本如下:

升級加點

#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#==============================================================================

# 脚本使用设定:

LEVEL_UP_POINT = 1  # 每升一级所增加的点数
LEVEL_UP_VARIABLE = 100  # 储存角色点数的变量编号与角色id编号的差值
                         # 默认情况 = 100,
                         # 则是数据库里1号角色的加点数存于101号变量
                         # 3号角色的加点数存于103号变量。
                         # 你可以直接操作变量赠与角色可分配点数

# 每增加一次点数,各项能力值的变化:357-410行
                        
# 使用方法介绍:

# 本脚本不会取代原来的升级自动加点 也就是说,默认的升级还在,但可以用这个功能手动追加点数。
# 如果你想纯粹使用手动加点(而升级不提升能力),只要把数据库中角色升级能力,
# 1-99级全部等于一个相同数值就行了。

# 呼唤加点场景的方法:$scene = Scene_Lvup.new(角色编号,返回菜单编号)。
# 默认都是0号

# 加点场景中,page up,page down换人,如果想加点完毕后返回地图,
# 464行$scene = Scene_Menu.new(0)改为$scene = Scene_Map.new

# 推荐脚本搭配:魔法商店脚本,两者结合,制作自由型RPG

#==============================================================================
# ■ Window_Command
#------------------------------------------------------------------------------
#  一般的命令选择行窗口。(追加定义)
#==============================================================================
class Window_Command < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 项目有效化
  #     index : 项目编号
  #--------------------------------------------------------------------------
  def able_item(index)
    draw_item(index, normal_color)
  end
end
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
#  处理角色的类。(再定义)
#==============================================================================

class Game_Actor < Game_Battler
  def level_up
    @level += 1
    $game_variables[self.id + LEVEL_UP_VARIABLE] += LEVEL_UP_POINT
    for learning in self.class.learnings
      learn_skill(learning.skill_id) if learning.level == @level
    end
  end
end
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
#  游戏中全部窗口的超级类(追加定义)
#==============================================================================
class Window_Base < Window
  #--------------------------------------------------------------------------
  # ● 描绘 HP
  #     actor : 角色
  #     x     : 描画目标 X 坐标
  #     y     : 描画目标 Y 坐标
  #     width : 描画目标的宽
  #--------------------------------------------------------------------------
  def draw_actor_hp_lvup(actor, x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x , y, 96, 32, "最大" + Vocab::hp)
    if $temp_hp == 0
      self.contents.font.color = normal_color
      self.contents.draw_text(x + 120 , y, 48, 32, actor.maxhp.to_s, 2)
    else
      maxhp = actor.maxhp + $temp_hp
      self.contents.font.color = Color.new(255, 128, 128, 255)
      self.contents.draw_text(x + 120 , y, 48, 32, maxhp.to_s ,2)
      self.contents.font.color = normal_color      
      self.contents.draw_text(x + 155, y, 36, 32, "( ", 2)
      if $temp_hp >=0
        self.contents.font.color = Color.new(255, 128, 128, 255)
        self.contents.draw_text(x + 155, y, 36, 32, " +",2)
      else
        self.contents.font.color = Color.new(255,255,0,255)
        self.contents.draw_text(x + 155, y, 36, 32, " -",2)
      end
      self.contents.draw_text(x + 200, y, 36, 32, $temp_hp.to_s, 2)
      self.contents.font.color = normal_color
      self.contents.draw_text(x + 215, y, 36, 32, ")", 2)
    end
  end
  #--------------------------------------------------------------------------
  # ● 描绘 MP
  #     actor : 角色
  #     x     : 描画目标 X 坐标
  #     y     : 描画目标 Y 坐标
  #     width : 描画目标的宽
  #--------------------------------------------------------------------------
  def draw_actor_mp_lvup(actor, x, y)
    self.contents.font.color = system_color
    self.contents.draw_text(x , y, 96, 32, "最大" + Vocab::mp)
    if $temp_mp == 0
      self.contents.font.color = normal_color
      self.contents.draw_text(x + 120 , y, 48, 32, actor.maxmp.to_s, 2)
    else
      maxmp = actor.maxmp + $temp_mp
      self.contents.font.color = Color.new(255, 128, 128, 255)
      self.contents.draw_text(x + 120 , y, 48, 32, maxmp.to_s ,2)
      self.contents.font.color = normal_color      
      self.contents.draw_text(x + 155, y, 36, 32, "( ", 2)
      if $temp_mp >=0
        self.contents.font.color = Color.new(255, 128, 128, 255)
        self.contents.draw_text(x + 155, y, 36, 32, " +",2)
      else
        self.contents.font.color = Color.new(255,255,0,255)
        self.contents.draw_text(x + 155, y, 36, 32, " -",2)
      end
      self.contents.draw_text(x + 200, y, 36, 32, $temp_mp.to_s, 2)
      self.contents.font.color = normal_color
      self.contents.draw_text(x + 215, y, 36, 32, ")", 2)
    end
  end
  #--------------------------------------------------------------------------
  # ● 描绘能力值
  #     actor : 角色
  #     x     : 描画目标 X 坐标
  #     y     : 描画目标 Y 坐标
  #     type  : 能力值种类 (0~4)
  #--------------------------------------------------------------------------
  def draw_actor_lvup(actor, x, y, type)   
    # 定义数字颜色
    lvup = normal_color
    upcolor = Color.new(255, 128, 128, 255)
    self.contents.font.color = normal_color   
    case type
    when 0
      parameter_name = Vocab::atk
      parameter_value = actor.atk
      parameter_value_temp = parameter_value + $temp_atk
      if $temp_atk != 0
        lvup = upcolor
        self.contents.draw_text(x + 256, y, 16, 32, "(")
        if $temp_atk >= 0
          self.contents.font.color = lvup
          self.contents.draw_text(x + 272, y, 80, 32, "+",0)
        else
          self.contents.font.color = Color.new(255,255,0,255)
          self.contents.draw_text(x + 272, y, 80, 32, "-",0)
        end        
        self.contents.draw_text(x + 272, y, 80, 32, $temp_atk.abs.to_s,1)
        self.contents.font.color = normal_color
        self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
      end
    when 1
      parameter_name = Vocab::def
      parameter_value = actor.def
      parameter_value_temp = parameter_value + $temp_def
      if $temp_def != 0
        lvup = upcolor
        self.contents.draw_text(x + 256, y, 16, 32, "(")
        if $temp_def >= 0
          self.contents.font.color = lvup
          self.contents.draw_text(x + 272, y, 80, 32, "+",0)
        else
          self.contents.font.color = Color.new(255,255,0,255)
          self.contents.draw_text(x + 272, y, 80, 32, "-",0)
        end        
        self.contents.draw_text(x + 272, y, 80, 32, $temp_def.abs.to_s,1)
        self.contents.font.color = normal_color
        self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
      end
    when 2
      parameter_name = Vocab::agi
      parameter_value = actor.agi
      parameter_value_temp = parameter_value + $temp_agi
      if $temp_agi != 0
        lvup = upcolor
        self.contents.draw_text(x + 256, y, 16, 32, "(")
        if $temp_agi >= 0
          self.contents.font.color = lvup
          self.contents.draw_text(x + 272, y, 80, 32, "+",0)
        else
          self.contents.font.color = Color.new(255,255,0,255)
          self.contents.draw_text(x + 272, y, 80, 32, "-",0)
        end        
        self.contents.draw_text(x + 272, y, 80, 32, $temp_agi.abs.to_s,1)
        self.contents.font.color = normal_color
        self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
      end
    when 3
      parameter_name = Vocab::spi
      parameter_value = actor.spi
      parameter_value_temp = parameter_value + $temp_spi
      if $temp_spi != 0
        lvup = upcolor
        self.contents.draw_text(x + 256, y, 16, 32, "(")
        if $temp_spi >= 0
          self.contents.font.color = lvup
          self.contents.draw_text(x + 272, y, 80, 32, "+",0)
        else
          self.contents.font.color = Color.new(255,255,0,255)
          self.contents.draw_text(x + 272, y, 80, 32, "-",0)
        end        
        self.contents.draw_text(x + 272, y, 80, 32, $temp_spi.abs.to_s,1)
        self.contents.font.color = normal_color
        self.contents.draw_text(x + 272, y, 80, 32, ")", 2)
      end
    when 4
      parameter_name = "剩餘點數"
      parameter_value = $point
      if $point != 0
        lvup = upcolor
      end
    end   
    self.contents.font.size = 16 if type == 4
    self.contents.font.color = system_color
    if type != 4 then
      self.contents.draw_text(x, y, 120, 32, parameter_name)
    else
      self.contents.draw_text(x, y, 120, 24, parameter_name)
    end
    self.contents.font.color = normal_color
    if type != 4
      self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s)   
    else
      self.contents.draw_text(x + 68, y, 36, 24, parameter_value.to_s)   
    end
    if type != 4
      self.contents.draw_text(x + 150, y, 36, 32, "→")
    end  
    self.contents.font.color = lvup
    self.contents.draw_text(x + 180, y, 60, 32, parameter_value_temp.to_s)
    self.contents.font.color = normal_color        
  end
end

class Window_Lvpoint < Window_Base
  def initialize
    super(0,198,128,58)
    refresh
  end
  def refresh
    self.contents.clear
    draw_actor_lvup(@actor, 0, 0, 4)
  end
end
#==============================================================================
# ■ Window_lvup
#------------------------------------------------------------------------------
#  显示升级状态窗口。
#==============================================================================
class Window_Lvup < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #     actor : 角色
  #--------------------------------------------------------------------------
  def initialize(actor)
    super(0, 0, 416, 256)
    self.contents = Bitmap.new(width - 32, height - 32)
    @actor = actor
    refresh
  end  
  #--------------------------------------------------------------------------
  # ● 刷新
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_actor_graphic(@actor, 30, 80)
    draw_actor_name(@actor, 4, 0)
    draw_actor_class(@actor, 96, 0)
    draw_actor_level(@actor, 224, 0)
    draw_actor_state(@actor, 96, 32)   
    draw_actor_hp_lvup(@actor, 96, 32)
    draw_actor_mp_lvup(@actor, 96, 64)
    draw_actor_lvup(@actor, 4, 96, 0)
    draw_actor_lvup(@actor, 4, 128, 1)
    draw_actor_lvup(@actor, 4, 160, 2)
    draw_actor_lvup(@actor, 4, 192, 3)
  end
end
#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
#  特技及物品的说明、角色的状态显示的窗口。
#==============================================================================
class Window_Lvup_Help < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #--------------------------------------------------------------------------
  def initialize
    super(0, 256, 544, 160)
    self.contents = Bitmap.new(width - 32, height - 32)
    @test = "" #——这个东西用来检测,节约内存专用
  end  
  #--------------------------------------------------------------------------
  # ● 设置文本
  #--------------------------------------------------------------------------
  def lvup_text(text1, text2 = nil, text3 = nil, text4 = nil)
    if @test != text1
      @test = text1
    else
      return
    end   
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 0, self.width - 40, 32, text1)
    if text2 != nil
      self.contents.draw_text(4 , 32, self.width - 40, 32, text2)
    end
    self.contents.font.size -= 4
    if text3 != nil
      self.contents.draw_text(4 , 64, self.width - 40, 32, text3)
    end
    if text4 != nil
      self.contents.draw_text(4 , 96, self.width - 40, 32, text4)
    end
    self.contents.font.size += 4
  end
end
#==============================================================================
# ■ Scene_lvup
#------------------------------------------------------------------------------
#  处理升级画面的类。
#==============================================================================
class Scene_Lvup
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #     actor_index : 角色索引
  #     menu_index : 选项起始位置
  #--------------------------------------------------------------------------
  def initialize(actor_index = 0 , menu_index = 0)
    @actor_index = actor_index
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # ● 主处理
  #--------------------------------------------------------------------------
  def main
    s1 = "+體力"
    s2 = "+"+Vocab::atk
    s3 = "+"+Vocab::def
    s4 = "+"+Vocab::agi
    s5 = "+"+Vocab::spi
    s6 = "確認加點"
    s7 = "點數重置"
    @command_window = Window_Command.new(128, [s1, s2, s3, s4, s5, s6, s7])
    @command_window.index = @menu_index
    # 获取角色
    @actor = $game_party.members[@actor_index]
    # 将角色的剩余点数带入
    $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
    # 初始化临时量
    $temp_atk = 0
    $temp_def = 0
    $temp_agi = 0
    $temp_spi = 0
    $temp_hp = 0
    $temp_mp = 0
    #=========================================================================
    # 特别提示:这些设置也可以使用小数,但是可能出现0值意外错误
    #  (各种编程语言都有这种意外),建议还是使用整数,正负不限
    #=========================================================================
    # 每提升一次力量,提升多少附加能力
    #=========================================================================
    @atk_hp = 2     # 每提升一次力量附加提升多少HP
    @atk_mp = 0     # 每提升一次力量附加提升多少MP
    @atk_def = 0    # 每提升一次力量附加提升多少灵巧
    @atk_agi = 0    # 每提升一次力量附加提升多少速度
    @atk_spi = 0    # 每提升一次力量附加提升多少魔力
    @atk_atk = 3    # 每提升一次力量附加提升多少力量
    #=========================================================================
    # 每提升一次灵巧,提升多少附加能力
    #=========================================================================
    @def_hp = 1     # 每提升一次灵巧附加提升多少HP
    @def_mp = 0     # 每提升一次灵巧附加提升多少MP
    @def_atk = 0    # 每提升一次灵巧附加提升多少力量
    @def_agi = 0    # 每提升一次灵巧附加提升多少速度
    @def_spi = 0    # 每提升一次灵巧附加提升多少魔力
    @def_def = 3    # 每提升一次灵巧附加提升多少灵巧
    #=========================================================================
    # 每提升一次速度,提升多少附加能力
    #=========================================================================
    @agi_hp = 1     # 每提升一次速度附加提升多少HP
    @agi_mp = 0     # 每提升一次速度附加提升多少MP
    @agi_atk = 0    # 每提升一次速度附加提升多少力量
    @agi_def = 0    # 每提升一次速度附加提升多少灵巧
    @agi_spi = 0    # 每提升一次速度附加提升多少魔力
    @agi_agi = 3    # 每提升一次速度附加提升多少速度
    #=========================================================================
    # 每提升一次魔力,提升多少附加能力
    #=========================================================================
    @spi_hp = 0     # 每提升一次魔力附加提升多少HP
    @spi_mp = 3    # 每提升一次魔力附加提升多少MP
    @spi_atk = 0   # 每提升一次魔力附加提升多少力量
    @spi_def = 0   # 每提升一次魔力附加提升多少灵巧
    @spi_agi = 0   # 每提升一次魔力附加提升多少速度
    @spi_spi = 3   # 每提升一次魔力附加提升多少魔力
    #=========================================================================
    # 每提升一次体力,提升多少附加能力
    #=========================================================================
    @hp = 6       # 每提升一次体力提升多少HP
    @mp = 1       # 每提升一次体力提升多少MP
    @hp_atk = 0   # 每提升一次体力提升多少力量
    @hp_def = 0   # 每提升一次体力提升多少速度
    @hp_agi = 0   # 每提升一次体力提升多少灵巧
    @hp_spi = 0   # 每提升一次体力提升多少魔力   
    # 定义说明文字
    @text_hp_sc = "體力可以增加生存的能力!"
    @text_atk_sc = Vocab::atk + "可以增加物理攻擊和物理技能的威力!"
    @text_def_sc = Vocab::def + "可以提高攻擊的命中率和必殺!"
    @text_agi_sc = Vocab::agi + "可以提高回避、命中、逃跑成功率!"
    @text_spi_sc = Vocab::spi + "可以提高魔法的效果,可以增加1點魔法!"
    @text_save = "保存分配情況並返回遊戲"
    @text_reset= "重新分配能力點數"
    @text_2 = "每增加一次此項能力值,可以提升能力值"
    @text_hp = "最大" + Vocab::hp + "值"
    @text_mp = "最大" + Vocab::mp + "值"
    @text_atk = "最大" + Vocab::atk + "值"
    @text_def = "最大" + Vocab::def + "值"
    @text_agi = "最大" + Vocab::agi + "值"
    @text_spi = "最大" + Vocab::spi + "值"
    s_disable
    # 生成状态窗口
    @lvup_window = Window_Lvup.new(@actor)
    @lvup_window.x = 128
    @lvup_window.y = 0   
    @lvpoint_window = Window_Lvpoint.new
    # 生成帮助窗口并初始化帮助文本
    @help_window = Window_Lvup_Help.new   
    # 执行过渡
    Graphics.transition
    # 主循环
    loop do
      # 刷新游戏画面
      Graphics.update
      # 刷新输入信息
      Input.update
      # 刷新画面
      update
      # 如果切换画面就中断循环
      if $scene != self
        break
      end
    end
    # 准备过渡
    Graphics.freeze
    # 释放窗口
    @lvpoint_window.dispose
    @command_window.dispose
    @lvup_window.dispose
    @help_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● 刷新画面
  #--------------------------------------------------------------------------
  def update
    # 刷新窗口
    @command_window.update
    # 选项明暗判断(因为太消耗资源,所以屏蔽掉了)
    s_disable
    @lvup_window.update
    #=============================================================
    # 按下 B 键的情况下
    #=============================================================
    if Input.trigger?(Input::B)
      # 演奏取消 SE
      Sound.play_cancel
      # 切换到地图画面
      $scene = Scene_Menu.new(6)
      return
    end
    #=============================================================
    # 按下 C 键的情况下
    #=============================================================
    if Input.trigger?(Input::C)      
      if @command_window.index == 5
          # 演奏确定 SE
        Sound.play_decision
        # 将角色的剩余点数带回
        $game_variables[@actor.id + LEVEL_UP_VARIABLE] = $point
        # 将角色点数实际加上
        @actor.atk += $temp_atk
        @actor.def += $temp_def
        @actor.agi += $temp_agi
        @actor.spi += $temp_spi
        @actor.maxhp += $temp_hp
        @actor.maxmp += $temp_mp
        # 切换到地图画面
        $scene = Scene_Menu.new(6)
        return
      end
      if @command_window.index == 6
          # 演奏确定 SE
        Sound.play_decision
          # 将角色的剩余点数带入
        $point = $game_variables[@actor.id + LEVEL_UP_VARIABLE]   
          # 初始化临时量
        $temp_atk = 0
        $temp_def = 0
        $temp_agi = 0
        $temp_spi = 0
        $temp_hp = 0
        $temp_mp = 0
        @lvup_window.refresh
        @lvpoint_window.refresh
        return
      end
      if $point == 0
        # 演奏冻结 SE
        Sound.play_buzzer
        return
      end
      case @command_window.index
      when 0
        # 演奏确定 SE
        Sound.play_decision
        $temp_hp += @hp
        $temp_mp += @mp
        $temp_atk += @hp_atk
        $temp_def += @hp_def
        $temp_agi += @hp_agi
        $temp_spi += @hp_spi
        $point -= 1
        @lvup_window.refresh
        @lvpoint_window.refresh
        s_disable
        return
      when 1
        # 演奏确定 SE
        Sound.play_decision
        $temp_atk += @atk_atk
        $temp_hp += @atk_hp
        $temp_mp += @atk_mp
        $temp_def += @atk_def
        $temp_agi += @atk_agi
        $temp_spi += @atk_spi
        $point -= 1
        @lvup_window.refresh
        @lvpoint_window.refresh
        s_disable
        return
      when 2
        # 演奏确定 SE
        Sound.play_decision
        $temp_def += @def_def
        $temp_hp += @def_hp
        $temp_mp += @def_mp
        $temp_atk += @def_atk
        $temp_agi += @def_agi
        $temp_spi += @def_spi
        $point -= 1
        @lvup_window.refresh
        @lvpoint_window.refresh
        s_disable
        return
      when 3
        # 演奏确定 SE
        Sound.play_decision
        $temp_agi += @agi_agi
        $temp_hp += @agi_hp
        $temp_mp += @agi_mp
        $temp_atk += @agi_atk
        $temp_def += @agi_def
        $temp_spi += @agi_spi
        $point -= 1
        @lvup_window.refresh
        @lvpoint_window.refresh
        s_disable
        return
      when 4
        # 演奏确定 SE
        Sound.play_decision
        $temp_spi += @spi_spi
        $temp_hp += @spi_hp
        $temp_mp += @spi_mp
        $temp_atk += @spi_atk
        $temp_def += @spi_def
        $temp_agi += @spi_agi
        $point -= 1
        @lvup_window.refresh
        @lvpoint_window.refresh
        s_disable
        return
      end
    end
    #=============================================================
    # 什么都没有按下的情况
    #=============================================================
    case @command_window.index   
    when 0  # 增加体力
      temptext1 = @text_hp + @hp.to_s + "點   " + @text_atk + @hp_atk.to_s + "點   " + @text_def + @hp_def.to_s + "點"
      temptext2 = @text_mp + @mp.to_s + "點   " + @text_agi + @hp_agi.to_s + "點   " + @text_spi + @hp_spi.to_s + "點"
      @help_window.lvup_text(@text_hp_sc , @text_2 , temptext1 , temptext2)
    when 1  # 增加力量
      temptext1 = @text_hp + @atk_hp.to_s + "點   " + @text_atk + @atk_atk.to_s + "點   " + @text_def + @atk_def.to_s + "點"
      temptext2 = @text_mp + @atk_mp.to_s + "點   " + @text_agi + @atk_agi.to_s + "點   " + @text_spi + @atk_spi.to_s + "點"
      @help_window.lvup_text(@text_atk_sc , @text_2 , temptext1 , temptext2)
    when 2  # 增加灵巧
      temptext1 = @text_hp + @def_hp.to_s + "點   " + @text_atk + @def_agi.to_s + "點   " + @text_def + @def_def.to_s + "點"
      temptext2 = @text_mp + @def_mp.to_s + "點   " + @text_agi + @def_agi.to_s + "點   " + @text_spi + @def_spi.to_s + "點"
      @help_window.lvup_text(@text_def_sc , @text_2 , temptext1 , temptext2)
    when 3  # 增加速度
      temptext1 = @text_hp + @agi_hp.to_s + "點   " + @text_atk + @agi_atk.to_s + "點   " + @text_def + @agi_def.to_s + "點"
      temptext2 = @text_mp + @agi_mp.to_s + "點   " + @text_agi + @agi_agi.to_s + "點   " + @text_spi + @agi_spi.to_s + "點"
      @help_window.lvup_text(@text_agi_sc , @text_2 , temptext1 , temptext2)
    when 4  # 增加魔力
      temptext1 = @text_hp + @spi_hp.to_s + "點   " + @text_atk + @spi_atk.to_s + "點   " + @text_def + @spi_def.to_s + "點"
      temptext2 = @text_mp + @spi_mp.to_s + "點   " + @text_agi + @spi_agi.to_s + "點   " + @text_spi + @spi_spi.to_s + "點"
      @help_window.lvup_text(@text_spi_sc , @text_2 , temptext1 , temptext2)
    when 5 # 保存设定
      @help_window.lvup_text(@text_save)
    when 6 # 点数重置
      @help_window.lvup_text(@text_reset)     
    end
    #=============================================================
    # 按下R与L换人的情况
    #=============================================================      
    if Input.trigger?(Input::R)
      # 演奏光标 SE
      Sound.play_cursor
      # 移至下一位角色
      @actor_index += 1
      @actor_index %= $game_party.members.size
      # 切换到别的状态画面
      $scene = Scene_Lvup.new(@actor_index , @command_window.index)
      return
    end
    # 按下 L 键的情况下
    if Input.trigger?(Input:)
      # 演奏光标 SE
      Sound.play_cursor
      # 移至上一位角色
      @actor_index += $game_party.members.size - 1
      @actor_index %= $game_party.members.size
      # 切换到别的状态画面
      $scene = Scene_Lvup.new(@actor_index , @command_window.index)
      return
    end
  end  
  #--------------------------------------------------------------------------
  # ● 选项明暗判断
  #--------------------------------------------------------------------------
  def s_disable
    # 判断剩余点数是否为0,如果为0,那么增加选项表示为暗色
    if $point == 0
      enabled = false
    else
      enabled = true
    end
      @command_window.draw_item(0,enabled)
      @command_window.draw_item(1,enabled)
      @command_window.draw_item(2,enabled)
      @command_window.draw_item(3,enabled)
      @command_window.draw_item(4,enabled)
  end
end
回复 支持 反对

使用道具 举报

1

主题

6

帖子

63

积分

②入门

积分
63
 楼主| 发表于 2010-2-1 11:44:12 | 显示全部楼层
魔物圖鑑

#******************************************************************************
#
#    * モンスター図鑑 #2
#
#  --------------------------------------------------------------------------
#    バージョン :  1.0.2
#      対  応   :  RPGツクールVX : RGSS2
#     制 作 者  :  CACAO
#     配 布 元  :  http://cacaosoft.web.fc2.com/
#     連 絡 先  :  cacao_soft@yahoo.co.jp
#  --------------------------------------------------------------------------
#   == 概要 ==
#
#    : モンスター図鑑の機能を追加します。
#
#  --------------------------------------------------------------------------
#   == 注意事項 ==
#
#    ※ 別途、コメントを定義する必要があります。サイトの説明をご覧ください。
#    ※ このスクリプトの使用には、基本的なRGSS2の知識が必要となります。
#
#  --------------------------------------------------------------------------
#   == 使用方法 ==
#
#    ★ 図鑑の起動
#     $game_temp.next_scene = "mbook"
#
#    ★ メニューからの起動
#     start_mbook
#
#    ★ 閲覧可能範囲の変更
#     $game_system.mbook[n].entry = value
#       n = エネミーのID
#       value = 0:閲覧不可, 1:遭遇, 2:勝利, 3:解析
#
#    ★ 閲覧の可否の変更
#     $game_system.mbook[n].hidden = value
#       n = エネミーのID
#       value = true:閲覧不可, false:閲覧可能
#
#    ★ 初期登録
#     エネミーのメモ欄に <MB:初期登録○> と記述
#       ○ = 初期登録時の閲覧可能範囲。半角数字で記述
#
#    ★ 初期閲覧不可
#     エネミーのメモ欄に <MB:閲覧禁止> と記述
#
#    ★ 完全非表示
#     エネミーのメモ欄に <MB:図鑑除外> と記述
#
#  --------------------------------------------------------------------------
#   == 画像規格 ==
#
#    ★ 有効度の詳細画像
#     属性・ステートアイコンの上に表示します。有効度を見分けるための画像です。
#     144 x 48 の画像(WeakIcon)を "Graphics/System" にご用意ください。
#
#    ★ 図鑑背景画像
#     図鑑全体の画像です。
#     544 x 416 の画像(BackMBook)を "Graphics/System" にご用意ください。
#     ※ ステータス背景を使用する場合は、ステータス部分を透過してください。
#
#    ★ ステータス背景画像
#     ステータス部分の背景です。
#     左からコメント、ステータス、属性・ステート画面となっています。
#     896 x 272 の画像(BackMBookS)を "Graphics/System" にご用意ください。
#
#    ※ 詳細はサイトの説明をご覧ください。
#       また、画像を使用しない設定の場合は、必要ありません。
#       ユーザー設定で個別に設定できます。
#
#
#******************************************************************************


#==============================================================================
# ◆ ユーザー設定
#==============================================================================

module CAO
module MB
  #--------------------------------------------------------------------------
  # ◇ 閲覧可能にする情報(閲覧可能範囲、閲覧レベル)
  #     (:name, :graphics, :params1, :drop, :params2, :weak, :come)
  #--------------------------------------------------------------------------
  ACCESS_PERMIT = [ [], # <= 消さないように注意!
    # 遭遇  Lv 1
    [:name, :graphics],
    # 勝利  Lv 2
    [:name, :graphics, :params1, :drop],
    # 解析  Lv 3
    [:name, :graphics, :params1, :drop, :params2, :weak, :come]
  ]
  #--------------------------------------------------------------------------
  # ◇ 図鑑完成率の算出方法(閲覧レベルで指定)
  #--------------------------------------------------------------------------
  COMPLETE_NUMBER = nil
  #--------------------------------------------------------------------------
  # ◇ 図鑑完成率の色変え(100%時)
  #--------------------------------------------------------------------------
  COMPLETE_COLOR = true
  #--------------------------------------------------------------------------
  # ◇ 自動登録する
  #--------------------------------------------------------------------------
  AUTO_ENTRY = true
    #--------------------------------------------------------------------------
    # ◇ 敗北しても登録する
    #     true    : 戦闘で負けても、倒した敵の加算と図鑑登録を行います。
    #     false   : 戦闘に負けた場合は、何も行いません。
    #--------------------------------------------------------------------------
    AUTO_ENTRY_LOSE = false
    #--------------------------------------------------------------------------
    # ◇ 倒した敵のみ自動登録する
    #     true    : 敵を倒すと閲覧レベル1
    #     false   : 遭遇でレベル1、倒すとレベル2
    #--------------------------------------------------------------------------
    AUTO_ENTRY_DEFEATED = false
  #--------------------------------------------------------------------------
  # ◇ 表示するステート
  #--------------------------------------------------------------------------
  ACTIVE_STATE = [2, 3, 4, 5, 6, 7, 8]
  #--------------------------------------------------------------------------
  # ◇ 表示する属性
  #--------------------------------------------------------------------------
  ACTIVE_ELEMENT = [7, 8, 9, 10, 11, 12, 13, 14]
  #--------------------------------------------------------------------------
  # ◇ 属性を1文字で表示する
  #     true      : 属性の最初の1文字のみを表示する。
  #     false     : 指定されたアイコンで表示する。
  #--------------------------------------------------------------------------
  ONE_NAME_ELEMENT = false
    #--------------------------------------------------------------------------
    # ◇ 属性のアイコン
    #--------------------------------------------------------------------------
    ICON_ELEMENT = [104, 105, 106, 107, 108, 109, 110, 111]
  #--------------------------------------------------------------------------
  # ◇ 耐性表示の色分けをする
  #     true      : 有効度の画像を使用します。
  #     false     : アイコンのみを表示します。
  #--------------------------------------------------------------------------
  WEAK_PONIT_COLOR = false
  #--------------------------------------------------------------------------
  # ◇ ウィンドウを消す
  #--------------------------------------------------------------------------
  NO_WINDOW_GRAPHICS = false
  #--------------------------------------------------------------------------
  # ◇ システム文字を非表示にする
  #--------------------------------------------------------------------------
  NO_SYSTEM_FONT = false
  #--------------------------------------------------------------------------
  # ◇ パラメータの項目
  #     HP, MP, ATK, DEF, SPI, AGI, HIT, EVA, EXP, GOLD, DROPITEM
  #--------------------------------------------------------------------------
  TEXT_STATUS = ["H P", "M P", "攻擊力", "防禦力", "意志力", "敏捷度",
                  "命中率", "迴避率", "經驗值", "女神幣", "掉落物品"]
  #--------------------------------------------------------------------------
  # ◇ 耐性の項目
  #     有効属性、有効ステート、耐性属性、耐性ステート
  #--------------------------------------------------------------------------
  TEXT_WEAK_POINT = ["懼怕屬性", "懼怕狀態", "耐性屬性", "耐性狀態"]
end
end


#/////////////////////////////////////////////////////////////////////////////#
#                                                                             #
#                下記のスクリプトを変更する必要はありません。                 #
#                                                                             #
#/////////////////////////////////////////////////////////////////////////////#


module CAO
class MonsterBook
  attr_accessor :entry
  attr_accessor :hidden
  attr_accessor :unread
  attr_accessor :defeat
  attr_accessor :encounter
  attr_reader   :id
  def initialize(id)
    @id = id
    @entry = 0
    @hidden = false
    @unread = true
    @defeat = 0
    @encounter = false
  end
  def data
    return $data_enemies[@id]
  end
end
end
class Game_System
  attr_accessor :mbook
end
class Scene_Title < Scene_Base
  alias :_cao_command_new_game_mbook :command_new_game
  def command_new_game
    _cao_command_new_game_mbook
    CAO::MB::Commands.reset_mbook
  end
end
class Scene_Map < Scene_Base
  alias :_cao_update_scene_change_mbook :update_scene_change
  def update_scene_change
    return if $game_player.moving?
    if $game_temp.next_scene == "mbook"
      $game_temp.next_scene = nil
      $scene = Scene_MonsterBook.new
    end
    _cao_update_scene_change_mbook
  end
end
class Scene_Menu < Scene_Base
  def start_mbook
    $scene = Scene_MonsterBook.new(@command_window.index)
  end
end
module CAO::MB::Commands
  module_function
  def unrestraint_array
    return $game_system.mbook.compact
  end
  def unrestraint_number
    return unrestraint_array.size
  end
  def unrestraint_enemy(data_id)
    for enemy in unrestraint_array
      return enemy if enemy.id == data_id
    end
  end
  def reset_mbook
    $game_system.mbook = []
    for i in 1...$data_enemies.size
      unless /^<MB:圖鑑除外>/ =~ $data_enemies.note
        $game_system.mbook = CAO::MonsterBook.new($data_enemies.id)
      end
    end
    reset_entry
    reset_hidden
    reset_unread
    reset_defeat
  end
  def reset_entry
    for i in 1...$data_enemies.size
      next if $game_system.mbook == nil
      if /^<MB:初期登錄(\\d)>/ =~ $data_enemies.note
        $game_system.mbook.entry = $1.to_i
      else
        $game_system.mbook.entry = 0
      end
    end
  end
  def reset_hidden
    for i in 1...$data_enemies.size
      next if $game_system.mbook == nil
      if /^<MB:閱讀禁止>/ =~ $data_enemies.note
        $game_system.mbook.hidden = true
      else
        $game_system.mbook.hidden = false
      end
    end
  end
  def reset_unread
    for i in 1...$data_enemies.size
      next if $game_system.mbook == nil
      $game_system.mbook.unread = true
    end
  end
  def reset_defeat
    for i in 1...$data_enemies.size
      next if $game_system.mbook == nil
      $game_system.mbook.unread = 0
    end
  end
  def change_entry(id, val)
    $game_system.mbook[id].entry = val
  end
  def get_encounter_number
    count = 0
    for enemy in unrestraint_array
      count += 1 if enemy.encounter
    end
    return count
  end
  def get_encounter_percent
    return cget_encounter_number * 100 / unrestraint_number
  end
  def get_entry_number(entry_type = nil)
    count = 0
    if entry_type
      for enemy in unrestraint_array
        count += 1 if enemy.entry >= entry_type
      end
    else
      for enemy in unrestraint_array
        count += enemy.entry
      end
      count /= 3
    end
    return count
  end
  def get_entry_percent(entry_type = nil)
    return get_entry_number(entry_type) * 100 / unrestraint_number
  end
  def complete_entry(entry_type)
    for enemy in unrestraint_array
      enemy.entry = entry_type
    end
  end
  def clear_entry
    for enemy in unrestraint_array
      enemy.entry = 0
    end
  end
end
class Window_MbookCommand < Window_Selectable
  def initialize
    super(8, 72, 200, 272)
    self.opacity = CAO::MB::NO_WINDOW_GRAPHICS ? 0 : 255
    @enemy = CAO::MB::Commands.unrestraint_array
    @item_max = CAO::MB::Commands.unrestraint_number
    refresh
    self.index = 0
  end
  def create_contents
    self.contents.dispose
    h = [height - 32, $game_system.mbook.size * WLH].max
    self.contents = Bitmap.new(width - 32, h)
  end
  def refresh
    self.contents.clear
    for i in 0...@item_max
      draw_item(i)
    end
  end
  def draw_item(index)
    rect = item_rect(index)
    rect.x += 4
    rect.width -= 8
    self.contents.clear_rect(rect)
    self.contents.font.color = normal_color
    self.contents.draw_text(rect, sprintf("%03d", index + 1))
    if @enemy[index].hidden || @enemy[index].entry == 0
      self.contents.draw_text(rect, "????????????", 2)
    else
      rect.x = 32
      rect.width -= 28
      self.contents.font.color = Color.new(102,204,64) if @enemy[index].unread
      self.contents.draw_text(rect, @enemy[index].data.name, 2)
    end
  end
end
class Window_MbookStatus < Window_Base
  SLIDE_SPEED = 36
  def initialize
    super(216, 72, 320, 272)
    @enemy = CAO::MB::Commands.unrestraint_array[0]
    self.opacity = CAO::MB::NO_WINDOW_GRAPHICS ? 0 : 255
    self.ox = 288
    @page = 1
    @slide_left = false
    @slide_right = false
    refresh
  end
  def create_contents
    self.contents.dispose
    self.contents = Bitmap.new((width - 32) * 3, height - 32)
    if CAO::MB::NO_SYSTEM_FONT
      @back_sprite = Sprite.new
      @back_sprite.bitmap = Cache.system("BackMBookS")
      @back_sprite.x = 216
      @back_sprite.y = 72
      @back_sprite.z = 0
      @back_sprite.ox = 288
    end
  end
  def refresh
    @enemy.unread = false if @enemy.entry > 0
    self.contents.clear_rect(288 * @page, 0, 288, 240)
    case @page
    when 0
      draw_comments
    when 1
      x = 288
      self.contents.font.color = normal_color
      if CAO::MB::ACCESS_PERMIT[@enemy.entry].include?(:name)
        self.contents.draw_text(x + 4, 0, 280, WLH, @enemy.data.name)
      else
        self.contents.draw_text(x + 4, 0, 280, WLH, "????????")
      end
      draw_enemy_parameter(x, 33)
      unless CAO::MB::NO_SYSTEM_FONT
        self.contents.font.color = system_color
        self.contents.draw_text(x, 168, 160, WLH, CAO::MB::TEXT_STATUS[10])
      end
      draw_drop_item(@enemy.data.drop_item1, x + 24, 192)
      draw_drop_item(@enemy.data.drop_item2, x + 24, 216)
    when 2
      draw_weak_point(576)
    end
  end
  def draw_comments
    return unless CAO::MB::ACCESS_PERMIT[@enemy.entry].include?(:come)
    if CAO::MB::COMMENT.has_key?(@enemy.data.id)
      self.contents.font.color = normal_color
      come = CAO::MB::COMMENT[@enemy.data.id]
      for i in 0...come.size
        update_message(come.clone, WLH * i)
      end
    end
  end
  def update_message(text, y)
    text.gsub!(/\\\\V\\[([0-9]+)\\]/i) { $game_variables[$1.to_i] }
    text.gsub!(/\\\\N\\[([0-9]+)\\]/i) { $game_actors[$1.to_i].name }
    text.gsub!(/\\\\C\\[([0-9]+)\\]/i) { "\\x01[#{$1}]" }
    text.gsub!(/\\\\\\\\/)             { "\\\\" }
    x = 0
    loop do
      c = text.slice!(/./m)
      case c
      when nil
        break
      when "\\x01"
        text.sub!(/\\[([0-9]+)\\]/, "")
        contents.font.color = text_color($1.to_i)
        next
      else
        contents.draw_text(x, y, 40, WLH, c)
        x += contents.text_size(c).width
      end
    end
  end
  def draw_enemy_parameter(x, y)
    params = [  @enemy.data.maxhp, @enemy.data.maxmp,
                 @enemy.data.atk,@enemy.data.def, @enemy.data.spi,
                @enemy.data.agi, @enemy.data.hit, @enemy.data.eva,  ]
    for i in 0...8
      xx = x + i % 2 * 152
      yy = y + i / 2 * WLH
      unless CAO::MB::NO_SYSTEM_FONT
        self.contents.font.color = system_color
        self.contents.draw_text(xx, yy, 60, WLH, CAO::MB::TEXT_STATUS)
      end
      self.contents.font.color = normal_color
      if CAO::MB::ACCESS_PERMIT[@enemy.entry].include?(:params1)
        self.contents.draw_text(xx + 60, yy, 72, WLH, params, 2)
      else
        self.contents.draw_text(xx + 60, yy, 72, WLH, "???", 2)
      end
    end
    unless CAO::MB::NO_SYSTEM_FONT
      self.contents.font.color = system_color
      self.contents.draw_text(x, 135, 60, WLH, CAO::MB::TEXT_STATUS[8])
      self.contents.draw_text(x + 152, 135, 60, WLH, CAO::MB::TEXT_STATUS[9])
    end
    self.contents.font.color = normal_color
    if CAO::MB::ACCESS_PERMIT[@enemy.entry].include?(:params2)
      self.contents.draw_text(x + 60, 135, 72, WLH, @enemy.data.exp, 2)
      self.contents.draw_text(x + 212, 135, 72, WLH, @enemy.data.gold, 2)
    else
      self.contents.draw_text(x + 60, 135, 72, WLH, "??????", 2)
      self.contents.draw_text(x + 212, 135, 72, WLH, "??????", 2)
    end
  end
  def draw_drop_item(drop_item, x, y)
    case drop_item.kind
    when 0
      item = nil
    when 1
      item = $data_items[drop_item.item_id]
    when 2
      item = $data_weapons[drop_item.weapon_id]
    when 3
      item = $data_armors[drop_item.armor_id]
    end
    self.contents.font.color = normal_color
    if CAO::MB::ACCESS_PERMIT[@enemy.entry].include?(:drop)
       if item == nil
        self.contents.draw_text(x + 2, y, 230, WLH, "× --------------")
      else
        draw_icon(item.icon_index, x, y)
        self.contents.draw_text(x + 26, y, 230, WLH, item.name)
      end
    else
      self.contents.draw_text(x, y, 230, WLH, "? --------------")
    end
  end
  def draw_weak_point(x)
    unless CAO::MB::NO_SYSTEM_FONT
      self.contents.font.color = system_color
      for i in 0...4
        self.contents.draw_text(x+4, 60*i, 280, WLH, CAO::MB::TEXT_WEAK_POINT)
      end
    end
    if CAO::MB::ACCESS_PERMIT[@enemy.entry].include?(:weak)
      draw_element_icon(x + 28, 24)
      draw_state_icon(x + 28, 84)
    else
      self.contents.font.color = normal_color
      for i in 0...4
        self.contents.draw_text(x+36, 60*i+24, 240, WLH, "? ? ? ? ? ? ?")
      end
    end
  end
  def draw_element_icon(x, y)
    count = 0
    for i in 0...CAO::MB::ACTIVE_ELEMENT.size
      if @enemy.data.element_ranks[CAO::MB::ACTIVE_ELEMENT] < 3
        if CAO::MB::ONE_NAME_ELEMENT
          rank = @enemy.data.element_ranks[CAO::MB::ACTIVE_ELEMENT]
          text = $data_system.elements[CAO::MB::ACTIVE_ELEMENT][/./]
          draw_weak_icon(text, x + 26 * count, y, rank)
        else
          icon_index = CAO::MB::ICON_ELEMENT
          rank = @enemy.data.element_ranks[CAO::MB::ACTIVE_ELEMENT]
          draw_weak_icon(icon_index, x + 26 * count, y, rank)
        end
        count += 1
      end
    end
    count = 0
    for i in 0...CAO::MB::ACTIVE_ELEMENT.size
      if @enemy.data.element_ranks[CAO::MB::ACTIVE_ELEMENT] > 3
        if CAO::MB::ONE_NAME_ELEMENT
          rank = @enemy.data.element_ranks[CAO::MB::ACTIVE_ELEMENT]
          text = $data_system.elements[CAO::MB::ACTIVE_ELEMENT][/./]
          draw_weak_icon(text, x + 26 * count, y + 120, rank)
        else
          icon_index = CAO::MB::ICON_ELEMENT
          rank = @enemy.data.element_ranks[CAO::MB::ACTIVE_ELEMENT]
          draw_weak_icon(icon_index, x + 26 * count, y + 120, rank)
        end
        count += 1
      end
    end
  end
  def draw_state_icon(x, y)
    weak_ranks = []
    strong_ranks = []
    for en in CAO::MB::ACTIVE_STATE
      if @enemy.data.state_ranks[en] < 3
        weak_ranks << en
      elsif @enemy.data.state_ranks[en] > 3
        strong_ranks << en
      end
    end
    self.contents.font.color = normal_color
    for i in 0...weak_ranks.size
      icon_index = $data_states[weak_ranks].icon_index
      rank = @enemy.data.state_ranks[weak_ranks] + 6
      draw_weak_icon(icon_index, x + 26 * i, y, rank)
    end
    for i in 0...strong_ranks.size
      icon_index = $data_states[strong_ranks].icon_index
      rank = @enemy.data.state_ranks[strong_ranks] + 6
      draw_weak_icon(icon_index, x + 26 * i, y + 120, rank)
    end
  end
  def draw_weak_icon(icon_index, x, y, rank = 0)
    if icon_index.class == String
      case rank
      when 1
        self.contents.font.color = Color.new(240, 32, 8)
      when 5
        self.contents.font.color = Color.new(48, 128, 248)
      when 6
        self.contents.font.color = Color.new(200, 64, 200)
      else
        self.contents.font.color = normal_color
      end
      self.contents.draw_text(x, y, 24, WLH, icon_index, 1)
    else
      bitmap = Cache.system("Iconset")
      rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
      self.contents.blt(x, y, bitmap, rect)
      if CAO::MB::WEAK_PONIT_COLOR
        rect.set((rank - 1) % 6 * 24, (rank - 1) / 6 * 24, 24, 24)
        self.contents.blt(x, y, Cache.system("WeakIcon"), rect)
      end
    end
  end
  def enemy=(enemy_id)
    @enemy = CAO::MB::Commands.unrestraint_array[enemy_id]
    refresh
  end
  def terminate
    super
    @back_sprite.dispose if CAO::MB::NO_SYSTEM_FONT
  end
  def update
    super
    unless @slide_left && @slide_right
      last_index = @page
      if Input.trigger?(Input::RIGHT)
        @page = [@page + 1, 2].min
        @slide_right = @page != last_index
      end
      if Input.trigger?(Input:EFT)
        @page = [@page - 1, 0].max
        @slide_left = @page != last_index
      end
      if @page != last_index
        Sound.play_cursor
        refresh
      end
    end
    update_page
  end
  def update_page
    if @slide_left
      self.ox -= SLIDE_SPEED
      @back_sprite.ox -= SLIDE_SPEED if CAO::MB::NO_SYSTEM_FONT
      @slide_left = !(self.ox == (288 * @page))
    end
    if @slide_right
      self.ox += SLIDE_SPEED
      @back_sprite.ox += SLIDE_SPEED if CAO::MB::NO_SYSTEM_FONT
      @slide_right = !(self.ox == (288 * @page))
    end
  end
end
class Window_MBookHelp < Window_Base
  include CAO::MB::Commands
  def initialize
    super(8, 352, 528, 56)
    self.opacity = CAO::MB::NO_WINDOW_GRAPHICS ? 0 : 255
    @enemy = unrestraint_array
    @item_max = unrestraint_number
    refresh
  end
  def refresh
    self.contents.clear
    unless CAO::MB::NO_SYSTEM_FONT
      self.contents.font.color = system_color
      self.contents.draw_text(7, 0, 100, WLH, "擊敗數")
      self.contents.draw_text(147, 0, 30, WLH, "體", 2)
      self.contents.draw_text(193, 0, 70, WLH, "遭遇率")
      self.contents.draw_text(303, 0, 30, WLH, "%", 2)
      self.contents.draw_text(349, 0, 70, WLH, "完成率")
      self.contents.draw_text(459, 0, 30, WLH, "%", 2)
    end
    self.contents.font.color = normal_color
    draw_defeated_number(107, 0, 40, WLH, 1)
    self.contents.draw_text(263, 0, 40, WLH, get_encounter_number, 2)
    text = get_entry_percent(CAO::MB::COMPLETE_NUMBER)
    if text == 100 && CAO::MB::COMPLETE_COLOR
      self.contents.font.color.set(240, 36, 12)
    end
    self.contents.draw_text(419, 0, 40, WLH, text, 2)
  end
  def draw_defeated_number(x, y, w, h, enemy_id)
    self.contents.clear_rect(x, y, w, h)
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, w, h, @enemy[enemy_id].defeat, 2)
  end
end
class Scene_MonsterBook < Scene_Base
  def initialize(menu_index = -1)
    @menu_index = menu_index
  end
  def start
    super
    create_menu_background
    create_title_window
    create_command_window
    create_graphic_sprite
    @status_window = Window_MbookStatus.new
    @help_window = Window_MBookHelp.new
  end
  def terminate
    super
    dispose_menu_background
    @command_window.dispose
    @title_window.dispose
    @status_window.dispose
    @help_window.dispose
    @graphic_sprite.dispose
  end
  def update
    super
    if Input.trigger?(Input::C)
      Sound.play_decision
      draw_enemy_graphics
      @graphic_sprite.visible ^= true
      @command_window.active ^= true
    end
    return unless @command_window.active
    current_id = @command_window.index
    @command_window.update
    @status_window.update
    if Input.trigger?(Input::B)
      Sound.play_cancel
      $scene = @menu_index < 0 ? Scene_Map.new : Scene_Menu.new(@menu_index)
    end
    if @command_window.index != current_id
      @status_window.enemy = @command_window.index
      @help_window.draw_defeated_number(107, 0, 40, 24, @command_window.index)
    end
  end
if CAO::MB::NO_WINDOW_GRAPHICS
  def create_menu_background
    @menuback_sprite = Sprite.new
    @menuback_sprite.bitmap = Cache.system("BackMBook")
    @menuback_sprite.z = 1
    update_menu_background
  end
end
  def create_title_window
    @title_window = Window_Base.new(0, 8, 180, 56)
    @title_window.opacity = CAO::MB::NO_WINDOW_GRAPHICS ? 0 : 255
    unless CAO::MB::NO_SYSTEM_FONT
      @title_window.contents.font.color = @title_window.normal_color
      @title_window.contents.draw_text(0, 0, 148, 24, "魔物圖鑑", 1)
    end
  end
  def create_command_window
    @command_window = Window_MbookCommand.new
    @command_window.index = 0
  end
  def create_graphic_sprite
    @graphic_sprite = Sprite.new
    @graphic_sprite.visible = false
    @graphic_sprite.bitmap = Bitmap.new(512, 384)
    @graphic_sprite.x = 16
    @graphic_sprite.y = 16
    @graphic_sprite.z = 200
  end
  def draw_enemy_graphics
    enemy = CAO::MB::Commands.unrestraint_array[@command_window.index]
    @graphic_sprite.bitmap.clear
    @graphic_sprite.bitmap.fill_rect(0, 0, 512, 384, Color.new(0, 0, 0, 128))
    bitmap = Cache.battler(enemy.data.battler_name, 0)
    if CAO::MB::ACCESS_PERMIT[enemy.entry].include?(:graphics)
      @graphic_sprite.color = Color.new(0, 0, 0, 0)
    else
      @graphic_sprite.color = Color.new(0, 0, 0)
    end
    x = (512 - bitmap.width) / 2
    y = (384 - bitmap.height) / 2
    @graphic_sprite.bitmap.blt( x, y, bitmap, bitmap.rect)
  end
end
class Scene_Battle < Scene_Base
  alias :_cao_battle_end_mbook :battle_end
  def battle_end(result)
    if result != 2 || CAO::MB::AUTO_ENTRY_LOSE
      for en in $game_troop.members
        enemy = CAO::MB::Commands.unrestraint_enemy(en.enemy_id)
        enemy.defeat += 1 if en.dead?
        if CAO::MB::AUTO_ENTRY && enemy.entry < 2
          if CAO::MB::AUTO_ENTRY_DEFEATED
            enemy.entry = 1 if en.dead?
          else
            enemy.entry = en.dead? ? 2 : 1
          end
        end
      end
    end
    _cao_battle_end_mbook(result)
  end
  alias :_cao_display_action_effects_mbook :display_action_effects
  def display_action_effects(target, obj = nil)
    if obj && /^<MB:解析>/ =~ obj.note
      unless target.skipped
        line_number = @message_window.line_number
        wait(5)
        display_critical(target, obj)
        display_damage(target, obj)
        display_state_changes(target, obj)
        if line_number == @message_window.line_number
          $game_system.mbook[target.enemy_id].entry = 3
          @message_window.add_instant_text("#{target.name}を解析した。")
        end
        if line_number != @message_window.line_number
          wait(30)
        end
        @message_window.back_to(line_number)
      end
    else
      _cao_display_action_effects_mbook(target, obj)
    end
  end
end
回复 支持 反对

使用道具 举报

1

主题

6

帖子

63

积分

②入门

积分
63
 楼主| 发表于 2010-2-1 12:06:37 | 显示全部楼层
字元太多,附件...

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 支持 反对

使用道具 举报

1

主题

6

帖子

63

积分

②入门

积分
63
 楼主| 发表于 2010-2-1 20:47:07 | 显示全部楼层
我斬掉了隊伍編成的上半部份,請見諒


# ■ Window_Command
class Window_Command < Window_Selectable
  unless method_defined?(:add_command)
  #--------------------------------------------------------------------------
  # ○ ?????追加
  #    追加??位置?返?
  #--------------------------------------------------------------------------
  def add_command(command)
    @commands << command
    @item_max = @commands.size
    item_index = @item_max - 1
    refresh_command
    draw_item(item_index)
    return item_index
  end
  #--------------------------------------------------------------------------
  # ○ ???????????
  #--------------------------------------------------------------------------
  def refresh_command
    buf = self.contents.clone
    self.height = [self.height, row_max * WLH + 32].max
    create_contents
    self.contents.blt(0, 0, buf, buf.rect)
    buf.dispose
  end
  #--------------------------------------------------------------------------
  # ○ ??????入
  #--------------------------------------------------------------------------
  def insert_command(index, command)
    @commands.insert(index, command)
    @item_max = @commands.size
    refresh_command
    refresh
  end
  #--------------------------------------------------------------------------
  # ○ ?????削除
  #--------------------------------------------------------------------------
  def remove_command(command)
    @commands.delete(command)
    @item_max = @commands.size
    refresh
  end
  end
end

# ■ Window_MenuStatus
class Window_MenuStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 定?
  #--------------------------------------------------------------------------
  STATUS_HEIGHT = 96  # ?????一人分?高?
  #--------------------------------------------------------------------------
  # ● ??????容?作成
  #--------------------------------------------------------------------------
  def create_contents
    self.contents.dispose
    self.contents = Bitmap.new(width - 32,
      [height - 32, row_max * STATUS_HEIGHT].max)
  end
  #--------------------------------------------------------------------------
  # ● 先頭?行?取得
  #--------------------------------------------------------------------------
  def top_row
    return self.oy / STATUS_HEIGHT
  end
  #--------------------------------------------------------------------------
  # ● 先頭?行?設定
  #     row : 先頭?表示??行
  #--------------------------------------------------------------------------
  def top_row=(row)
    super(row)
    self.oy = self.oy / WLH * STATUS_HEIGHT
  end
  #--------------------------------------------------------------------------
  # ● 1 ????表示???行??取得
  #--------------------------------------------------------------------------
  def page_row_max
    return (self.height - 32) / STATUS_HEIGHT
  end
  #--------------------------------------------------------------------------
  # ● 項目?描???矩形?取得
  #     index : 項目番?
  #--------------------------------------------------------------------------
  def item_rect(index)
    rect = super(index)
    rect.height = STATUS_HEIGHT
    rect.y = index / @column_max * STATUS_HEIGHT
    return rect
  end
  #--------------------------------------------------------------------------
  # ● ??????
  #--------------------------------------------------------------------------
  def refresh
    @item_max = $game_party.members.size
    create_contents
    fill_stand_by_background
    draw_member
  end
  #--------------------------------------------------------------------------
  # ○ ????????描?
  #--------------------------------------------------------------------------
  def draw_member
    for actor in $game_party.members
      draw_actor_face(actor, 2, actor.party_index * 96 + 2, 92)
      x = 104
      y = actor.party_index * 96 + WLH / 2
      draw_actor_name(actor, x, y)
      draw_actor_class(actor, x + 120, y)
      draw_actor_level(actor, x, y + WLH * 1)
      draw_actor_state(actor, x, y + WLH * 2)
      draw_actor_hp(actor, x + 120, y + WLH * 1)
      draw_actor_mp(actor, x + 120, y + WLH * 2)
    end
  end
  #--------------------------------------------------------------------------
  # ○ 待機?????背景色?塗?
  #--------------------------------------------------------------------------
  def fill_stand_by_background
    color = KGC:argeParty::STAND_BY_COLOR
    dy = STATUS_HEIGHT * $game_party.battle_members.size
    dh = STATUS_HEIGHT * $game_party.stand_by_members.size
    if dh > 0
      self.contents.fill_rect(0, dy, self.width - 32, dh, color)
    end
  end
  #--------------------------------------------------------------------------
  # ● ?????更新
  #--------------------------------------------------------------------------
  def update_cursor
    if @index < 0               # ??????
      self.cursor_rect.empty
    elsif @index < @item_max    # 通常
      super
    elsif @index >= 100         # 自分
      self.cursor_rect.set(0, (@index - 100) * STATUS_HEIGHT,
        contents.width, STATUS_HEIGHT)
    else                        # 全体
      self.cursor_rect.set(0, 0, contents.width, @item_max * STATUS_HEIGHT)
    end
  end
end

# ■ Window_ShopStatus
class Window_ShopStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● ??????容?作成
  #--------------------------------------------------------------------------
  def create_contents
    self.contents.dispose
    self.contents = Bitmap.new(width - 32,
      WLH * ($game_party.members.size + 1) * 2)
  end
end

# ■ Window_BattleStatus
class Window_BattleStatus < Window_Selectable
  #--------------------------------------------------------------------------
  # ● ??????容?作成
  #--------------------------------------------------------------------------
  def create_contents
    self.contents.dispose
    self.contents = Bitmap.new(width - 32,
      [WLH * $game_party.members.size, height - 32].max)
  end
  #--------------------------------------------------------------------------
  # ● ??????
  #--------------------------------------------------------------------------
  alias refresh_KGC_LargeParty refresh
  def refresh
    create_contents

    refresh_KGC_LargeParty
  end
end

# □ Window_PartyFormCaption
class Window_PartyFormCaption < Window_Base
  #--------------------------------------------------------------------------
  # ● ??????初期化
  #     caption : 表示????????
  #--------------------------------------------------------------------------
  def initialize(caption = "")
    super(0, 0, KGC:argeParty::CAPTION_WINDOW_WIDTH, WLH + 32)
    @caption = caption
    refresh
  end
  #--------------------------------------------------------------------------
  # ● ??????
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.draw_text(0, 0, width - 32, WLH, @caption)
  end
end

# □ Window_PartyFormMember
class Window_PartyFormMember < Window_Selectable
  #--------------------------------------------------------------------------
  # ○ 定?
  #--------------------------------------------------------------------------
  DRAW_SIZE = KGC:argeParty:ARTY_FORM_CHARACTER_SIZE
  #--------------------------------------------------------------------------
  # ● 公開????????
  #--------------------------------------------------------------------------
  attr_accessor :selected_index           # 選?????????
  #--------------------------------------------------------------------------
  # ● ??????初期化
  #     x       : ?????? X 座標
  #     y       : ?????? Y 座標
  #     width   : ??????幅
  #     height  : ??????高?
  #     spacing : ??項目?並????空白?幅
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height, spacing = 8)
    super(x, y, width, height, spacing)
  end
  #--------------------------------------------------------------------------
  # ● ??????容?作成
  #--------------------------------------------------------------------------
  def create_contents
    self.contents.dispose
    self.contents = Bitmap.new(width - 32,
      [height - 32, row_max * DRAW_SIZE[1]].max)
  end
  #--------------------------------------------------------------------------
  # ● 先頭?行?取得
  #--------------------------------------------------------------------------
  def top_row
    return self.oy / DRAW_SIZE[1]
  end
  #--------------------------------------------------------------------------
  # ● 先頭?行?設定
  #     row : 先頭?表示??行
  #--------------------------------------------------------------------------
  def top_row=(row)
    super(row)
    self.oy = self.oy / WLH * DRAW_SIZE[1]
  end
  #--------------------------------------------------------------------------
  # ● 1 ????表示???行??取得
  #--------------------------------------------------------------------------
  def page_row_max
    return (self.height - 32) / DRAW_SIZE[1]
  end
  #--------------------------------------------------------------------------
  # ● 項目?描???矩形?取得
  #     index : 項目番?
  #--------------------------------------------------------------------------
  def item_rect(index)
    rect = super(index)
    rect.width = DRAW_SIZE[0]
    rect.height = DRAW_SIZE[1]
    rect.y = index / @column_max * DRAW_SIZE[1]
    return rect
  end
  #--------------------------------------------------------------------------
  # ○ 選?????取得
  #--------------------------------------------------------------------------
  def actor
    return @actors[self.index]
  end
  #--------------------------------------------------------------------------
  # ● ??????
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    restore_member_list
    draw_member
  end
  #--------------------------------------------------------------------------
  # ○ ???????修復
  #--------------------------------------------------------------------------
  def restore_member_list
    # ?承先?定義
  end
  #--------------------------------------------------------------------------
  # ○ ????描?
  #--------------------------------------------------------------------------
  def draw_member
    # ?承先?定義
  end
  #--------------------------------------------------------------------------
  # ○ 空欄????描?
  #     index : 項目番?
  #--------------------------------------------------------------------------
  def draw_empty_actor(index)
    # ?承先?定義
  end
  #--------------------------------------------------------------------------
  # ○ 固定???背景描?
  #     index : 項目番?
  #--------------------------------------------------------------------------
  def draw_fixed_back(index)
    rect = item_rect(index)
    self.contents.fill_rect(rect, KGC:argeParty::FIXED_COLOR)
  end
  #--------------------------------------------------------------------------
  # ○ 選?中???背景描?
  #     index : 項目番?
  #--------------------------------------------------------------------------
  def draw_selected_back(index)
    rect = item_rect(index)
    self.contents.fill_rect(rect, KGC:argeParty::SELECTED_COLOR)
  end
end

# □ Window_PartyFormBattleMember
class Window_PartyFormBattleMember < Window_PartyFormMember
  #--------------------------------------------------------------------------
  # ● 公開????????
  #--------------------------------------------------------------------------
  attr_accessor :selected_index           # 選?????????
  #--------------------------------------------------------------------------
  # ● ??????初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 64, DRAW_SIZE[1] + 32)
    column_width = DRAW_SIZE[0] + @spacing
    nw = [column_width * $game_party.max_battle_member_count + 32,
      Graphics.width].min
    self.width = nw

    @item_max = $game_party.max_battle_member_count
    @column_max = width / column_width
    @selected_index = nil
    create_contents
    refresh
    self.active = true
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # ○ ???????修復
  #--------------------------------------------------------------------------
  def restore_member_list
    @actors = $game_party.battle_members
  end
  #--------------------------------------------------------------------------
  # ○ ????描?
  #--------------------------------------------------------------------------
  def draw_member
    @item_max.times { |i|
      actor = @actors
      if actor == nil
        draw_empty_actor(i)
      else
        if i == @selected_index
          draw_selected_back(i)
        elsif $game_party.actor_fixed?(actor.id)
          draw_fixed_back(i)
        end
        rect = item_rect(i)
        draw_actor_graphic(actor,
          rect.x + DRAW_SIZE[0] / 2,
          rect.y + DRAW_SIZE[1] - 4)
      end
    }
  end
  #--------------------------------------------------------------------------
  # ○ 空欄????描?
  #     index : 項目番?
  #--------------------------------------------------------------------------
  def draw_empty_actor(index)
    rect = item_rect(index)
    self.contents.font.color = system_color
    self.contents.draw_text(rect, KGC:argeParty::BATTLE_MEMBER_BLANK_TEXT, 1)
    self.contents.font.color = normal_color
  end
end

# □ Window_PartyFormAllMember
class Window_PartyFormAllMember < Window_PartyFormMember
  #--------------------------------------------------------------------------
  # ● ??????初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 64, 64)
    restore_member_list
    @item_max = $game_party.all_members.size

    # 各種???計算
    column_width = DRAW_SIZE[0] + @spacing
    sw = [@item_max * column_width + 32, Graphics.width].min
    @column_max = (sw - 32) / column_width
    sh = ([@item_max - 1, 0].max / @column_max + 1) * DRAW_SIZE[1] + 32
    sh = [sh, DRAW_SIZE[1] * KGC:argeParty:ARTY_MEMBER_WINDOW_ROW_MAX + 32].min

    # 座標????調整
    self.y += DRAW_SIZE[1] + 32
    self.width = sw
    self.height = sh

    create_contents
    refresh
    self.active = false
    self.index = 0
  end
  #--------------------------------------------------------------------------
  # ○ 選????????????????取得
  #--------------------------------------------------------------------------
  def actor_index
    return @index_offset + self.index
  end
  #--------------------------------------------------------------------------
  # ○ ???????修復
  #--------------------------------------------------------------------------
  def restore_member_list
    if KGC:argeParty::SHOW_BATTLE_MEMBER_IN_PARTY
      @actors = $game_party.all_members
      @index_offset = 0
    else
      @actors = $game_party.stand_by_members
      @index_offset = $game_party.battle_members.size
    end
  end
  #--------------------------------------------------------------------------
  # ○ ????描?
  #--------------------------------------------------------------------------
  def draw_member
    @item_max.times { |i|
      actor = @actors
      if actor == nil
        draw_empty_actor(i)
        next
      end

      if $game_party.actor_fixed?(actor.id)
        draw_fixed_back(i)
      end
      rect = item_rect(i)
      opacity = ($game_party.battle_members.include?(actor) ? 96 : 255)
      draw_actor_graphic(actor,
        rect.x + DRAW_SIZE[0] / 2,
        rect.y + DRAW_SIZE[1] - 4,
        opacity)
    }
  end
  #--------------------------------------------------------------------------
  # ● ??????行??????描?
  #     actor   : ????
  #     x       : 描?先 X 座標
  #     y       : 描?先 Y 座標
  #     opacity : 不透明度
  #--------------------------------------------------------------------------
  def draw_actor_graphic(actor, x, y, opacity = 255)
    draw_character(actor.character_name, actor.character_index, x, y, opacity)
  end
  #--------------------------------------------------------------------------
  # ● ?行???????描?
  #     character_name  : ?行?????? ????名
  #     character_index : ?行?????? ??????
  #     x               : 描?先 X 座標
  #     y               : 描?先 Y 座標
  #     opacity         : 不透明度
  #--------------------------------------------------------------------------
  def draw_character(character_name, character_index, x, y, opacity = 255)
    return if character_name == nil
    bitmap = Cache.character(character_name)
    sign = character_name[/^[\\!\\$]./]
    if sign != nil and sign.include?('$')
      cw = bitmap.width / 3
      ch = bitmap.height / 4
    else
      cw = bitmap.width / 12
      ch = bitmap.height / 8
    end
    n = character_index
    src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, cw, ch)
    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect, opacity)
  end
  #--------------------------------------------------------------------------
  # ○ 空欄????描?
  #     index : 項目番?
  #--------------------------------------------------------------------------
  def draw_empty_actor(index)
    rect = item_rect(index)
    self.contents.font.color = system_color
    self.contents.draw_text(rect, KGC:argeParty:ARTY_MEMBER_BLANK_TEXT, 1)
    self.contents.font.color = normal_color
  end
end

# □ Window_PartyFormStatus
class Window_PartyFormStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● ??????初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 384, 128)
    self.z = 1000
    @actor = nil
    refresh
  end
  #--------------------------------------------------------------------------
  # ○ ????設定
  #--------------------------------------------------------------------------
  def set_actor(actor)
    if @actor != actor
      @actor = actor
      refresh
    end
  end
  #--------------------------------------------------------------------------
  # ● ??????
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    if @actor == nil
      return
    end

    draw_actor_face(@actor, 0, 0)
    dx = 104
    draw_actor_name(@actor, dx, 0)
    draw_actor_level(@actor, dx, WLH * 1)
    draw_actor_hp(@actor, dx, WLH * 2)
    draw_actor_mp(@actor, dx, WLH * 3)
    4.times { |i|
      draw_actor_parameter(@actor, dx + 128, WLH * i, i, 120)
    }
  end
  #--------------------------------------------------------------------------
  # ● 能力??描?
  #     actor : ????
  #     x     : 描?先 X 座標
  #     y     : 描?先 Y 座標
  #     type  : 能力??種類 (0~3)
  #     width : 描?幅
  #--------------------------------------------------------------------------
  def draw_actor_parameter(actor, x, y, type, width = 156)
    case type
    when 0
      parameter_name = Vocab::atk
      parameter_value = actor.atk
    when 1
      parameter_name = Vocab::def
      parameter_value = actor.def
    when 2
      parameter_name = Vocab::spi
      parameter_value = actor.spi
    when 3
      parameter_name = Vocab::agi
      parameter_value = actor.agi
    end
    nw = width - 36
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, nw, WLH, parameter_name)
    self.contents.font.color = normal_color
    self.contents.draw_text(x + nw, y, 36, WLH, parameter_value, 2)
  end
end

# □ Window_PartyFormControl
class Window_PartyFormControl < Window_Base
  #--------------------------------------------------------------------------
  # ○ 定?
  #--------------------------------------------------------------------------
  MODE_BATTLE_MEMBER = 0
  MODE_SHIFT_CHANGE  = 1
  MODE_PARTY_MEMBER  = 2
  #--------------------------------------------------------------------------
  # ● ??????初期化
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, Graphics.width - 384, 128)
    self.z = 1000
    @mode = MODE_BATTLE_MEMBER
    refresh
  end
  #--------------------------------------------------------------------------
  # ○ ????更
  #--------------------------------------------------------------------------
  def mode=(value)
    @mode = value
    refresh
  end
  #--------------------------------------------------------------------------
  # ● ??????
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    case @mode
    when MODE_BATTLE_MEMBER  # ??????
      buttons = [
        "Shift:外移",
        "X鍵 :結束",
        "Z鍵 :選擇",
        "A鍵 :替換"
      ]
    when MODE_SHIFT_CHANGE   # 並?替?
      buttons = [
        "B鍵 :取消",
        "Z鍵 :選擇",
        "B鍵 :確認"
      ]
    when MODE_PARTY_MEMBER   # ????????
      buttons = [
        "X鍵 :取消",
        "Z鍵 :確認"
      ]
    else
      return
    end

    buttons.each_with_index { |c, i|
      self.contents.draw_text(0, WLH * i, width - 32, WLH, c)
    }
  end
end

# ■ Scene_Title
class Scene_Title < Scene_Base
  #--------------------------------------------------------------------------
  # ● 各種??????????作成
  #--------------------------------------------------------------------------
  alias create_game_objects_KGC_LargeParty create_game_objects
  def create_game_objects
    create_game_objects_KGC_LargeParty

    if KGC:argeParty:EFAULT_PARTYFORM_ENABLED
      $game_switches[KGC::LargeParty:ARTYFORM_SWITCH] = true
      $game_switches[KGC::LargeParty::BATTLE_PARTYFORM_SWITCH] = true
    end
  end
end

# ■ Scene_Map
class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # ● ?面切?替???行
  #--------------------------------------------------------------------------
  alias update_scene_change_KGC_LargeParty update_scene_change
  def update_scene_change
    return if $game_player.moving?    # ??????移動中?

    if $game_temp.next_scene == :partyform
      call_partyform
      return
    end

    update_scene_change_KGC_LargeParty
  end
  #--------------------------------------------------------------------------
  # ○ ????編成?面??切?替?
  #--------------------------------------------------------------------------
  def call_partyform
    $game_temp.next_scene = nil
    $scene = Scene_PartyForm.new(0, Scene_PartyForm::HOST_MAP)
  end
end

# ■ Scene_Menu
class Scene_Menu < Scene_Base
  if KGC::LargeParty::USE_MENU_PARTYFORM_COMMAND
  #--------------------------------------------------------------------------
  # ● ??????????作成
  #--------------------------------------------------------------------------
  alias create_command_window_KGC_LargeParty create_command_window
  def create_command_window
    create_command_window_KGC_LargeParty

    return if $imported["CustomMenuCommand"]

    @__command_partyform_index =
      @command_window.add_command(Vocab.partyform)
    @command_window.draw_item(@__command_partyform_index,
      $game_party.partyform_enable?)
    if @command_window.oy > 0
      @command_window.oy -= Window_Base::WLH
    end
    @command_window.index = @menu_index
  end
  end
  #--------------------------------------------------------------------------
  # ● ????選??更新
  #--------------------------------------------------------------------------
  alias update_command_selection_KGC_LargeParty update_command_selection
  def update_command_selection
    current_menu_index = @__command_partyform_index
    call_partyform_flag = false

    if Input.trigger?(Input::C)
      case @command_window.index
      when @__command_partyform_index  # ????編成
        call_partyform_flag = true
      end
    # ????編成???押下
    elsif KGC::LargeParty::MENU_PARTYFORM_BUTTON != nil &&
        Input.trigger?(KGC::LargeParty::MENU_PARTYFORM_BUTTON)
      call_partyform_flag = true
      current_menu_index = @command_window.index if current_menu_index == nil
    end

    # ????編成?面?移行
    if call_partyform_flag
      if $game_party.members.size == 0 || !$game_party.partyform_enable?
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      $scene = Scene_PartyForm.new(current_menu_index)
      return
    end

    update_command_selection_KGC_LargeParty
  end
end

# ■ Scene_Shop
unless $imported["HelpExtension"]
class Scene_Shop < Scene_Base
  #--------------------------------------------------------------------------
  # ● ????更新
  #--------------------------------------------------------------------------
  alias udpate_KGC_LargeParty update
  def update
    # ?????判定
    if !@command_window.active &&
        KGC::LargeParty::SHOP_STATUS_SCROLL_BUTTON != nil &&
        Input.press?(KGC::LargeParty::SHOP_STATUS_SCROLL_BUTTON)
      super
      update_menu_background
      update_scroll_status
      return
    else
      @status_window.cursor_rect.empty
    end

    udpate_KGC_LargeParty
  end
  #--------------------------------------------------------------------------
  # ○ ?????????????????理
  #--------------------------------------------------------------------------
  def update_scroll_status
    # ????????????????表示
    @status_window.cursor_rect.width = @status_window.contents.width
    @status_window.cursor_rect.height = @status_window.height - 32
    @status_window.update

    if Input.press?(Input::UP)
      @status_window.oy = [@status_window.oy - 4, 0].max
    elsif Input.press?(Input:OWN)
      max_pos = [@status_window.contents.height -
        (@status_window.height - 32), 0].max
      @status_window.oy = [@status_window.oy + 4, max_pos].min
    end
  end
end
end

# □ Scene_PartyForm
class Scene_PartyForm < Scene_Base
  #--------------------------------------------------------------------------
  # ○ 定?
  #--------------------------------------------------------------------------
  CAPTION_OFFSET = 40  # ????????????位置補正
  HOST_MENU   = 0      # 呼?出?元 : ????
  HOST_MAP    = 1      # 呼?出?元 : ???
  HOST_BATTLE = 2      # 呼?出?元 : ??
  #--------------------------------------------------------------------------
  # ● ??????初期化
  #     menu_index : ?????????初期位置
  #     host_scene : 呼?出?元 (0..????  1..???  2..??)
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0, host_scene = HOST_MENU)
    @menu_index = menu_index
    @host_scene = host_scene
  end
  #--------------------------------------------------------------------------
  # ● 開始?理
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background

    create_windows
    create_confirm_window
    adjust_window_location

    # 編成前??????保存
    @battle_actors = $game_party.battle_members.dup
    @party_actors  = $game_party.all_members.dup
  end
  #--------------------------------------------------------------------------
  # ○ ??????作成
  #--------------------------------------------------------------------------
  def create_windows
    # 編成用??????作成
    @battle_member_window = Window_PartyFormBattleMember.new
    @party_member_window  = Window_PartyFormAllMember.new
    @status_window        = Window_PartyFormStatus.new
    @status_window.set_actor(@battle_member_window.actor)

    # ??他???????作成
    @battle_member_caption_window =
      Window_PartyFormCaption.new(KGC::LargeParty::BATTLE_MEMBER_CAPTION)
    @party_member_caption_window =
      Window_PartyFormCaption.new(KGC::LargeParty:ARTY_MEMBER_CAPTION)
    @control_window = Window_PartyFormControl.new
  end
  #--------------------------------------------------------------------------
  # ○ 確認??????作成
  #--------------------------------------------------------------------------
  def create_confirm_window
    commands = KGC::LargeParty::CONFIRM_WINDOW_COMMANDS
    @confirm_window =
      Window_Command.new(KGC::LargeParty::CONFIRM_WINDOW_WIDTH, commands)
    @confirm_window.index    = 0
    @confirm_window.openness = 0
    @confirm_window.active   = false
  end
  #--------------------------------------------------------------------------
  # ○ ??????座標調整
  #--------------------------------------------------------------------------
  def adjust_window_location
    # 基準座標?計算
    base_x = [@battle_member_window.width, @party_member_window.width].max
    base_x = [(Graphics.width - base_x) / 2, 0].max
    base_y = @battle_member_window.height + @party_member_window.height +
      @status_window.height + CAPTION_OFFSET * 2
    base_y = [(Graphics.height - base_y) / 2, 0].max
    base_z = @menuback_sprite.z + 1000

    # 編成用??????座標????
    @battle_member_window.x = base_x
    @battle_member_window.y = base_y + CAPTION_OFFSET
    @battle_member_window.z = base_z
    @party_member_window.x = base_x
    @party_member_window.y = @battle_member_window.y +
      @battle_member_window.height + CAPTION_OFFSET
    @party_member_window.z = base_z
    @status_window.x = 0
    @status_window.y = @party_member_window.y + @party_member_window.height
    @status_window.z = base_z

    # ??他???????座標????
    @battle_member_caption_window.x = [base_x - 16, 0].max
    @battle_member_caption_window.y = @battle_member_window.y - CAPTION_OFFSET
    @battle_member_caption_window.z = base_z + 500
    @party_member_caption_window.x = [base_x - 16, 0].max
    @party_member_caption_window.y = @party_member_window.y - CAPTION_OFFSET
    @party_member_caption_window.z = base_z + 500
    @control_window.x = @status_window.width
    @control_window.y = @status_window.y
    @control_window.z = base_z

    @confirm_window.x = (Graphics.width - @confirm_window.width) / 2
    @confirm_window.y = (Graphics.height - @confirm_window.height) / 2
    @confirm_window.z = base_z + 1000
  end
  #--------------------------------------------------------------------------
  # ● 終了?理
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @battle_member_window.dispose
    @party_member_window.dispose
    @status_window.dispose
    @battle_member_caption_window.dispose
    @party_member_caption_window.dispose
    @control_window.dispose
    @confirm_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● ?????面系?背景作成
  #--------------------------------------------------------------------------
  def create_menu_background
    super
    @menuback_sprite.z = 20000
  end
  #--------------------------------------------------------------------------
  # ● 元??面???
  #--------------------------------------------------------------------------
  def return_scene
    case @host_scene
    when HOST_MENU
      $scene = Scene_Menu.new(@menu_index)
    when HOST_MAP
      $scene = Scene_Map.new
    when HOST_BATTLE
      $scene = Scene_Battle.new
    end
    $game_player.refresh
  end
  #--------------------------------------------------------------------------
  # ● ????更新
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    update_window
    if @battle_member_window.active
      update_battle_member
    elsif @party_member_window.active
      update_party_member
    elsif @confirm_window.active
      update_confirm
    end
  end
  #--------------------------------------------------------------------------
  # ○ ?????更新
  #--------------------------------------------------------------------------
  def update_window
    @battle_member_window.update
    @party_member_window.update
    @status_window.update
    @battle_member_caption_window.update
    @party_member_caption_window.update
    @control_window.update
    @confirm_window.update
  end
  #--------------------------------------------------------------------------
  # ○ ?????再描?
  #--------------------------------------------------------------------------
  def refresh_window
    @battle_member_window.refresh
    @party_member_window.refresh
  end
  #--------------------------------------------------------------------------
  # ○ ????更新 (??????????????????場合)
  #--------------------------------------------------------------------------
  def update_battle_member
    @status_window.set_actor(@battle_member_window.actor)
    if Input.trigger?(Input::A)
      if @battle_member_window.selected_index == nil  # 並?替?中???
        actor = @battle_member_window.actor
        # ?????外???場合
        if actor == nil || $game_party.actor_fixed?(actor.id)
          Sound.play_buzzer
          return
        end
        # ?????外?
        Sound.play_decision
        actors = $game_party.battle_members
        actors.delete_at(@battle_member_window.index)
        $game_party.set_battle_member(actors)
        refresh_window
      end
    elsif Input.trigger?(Input::B)
      if @battle_member_window.selected_index == nil  # 並?替?中???
        # 確認??????切?替?
        Sound.play_cancel
        show_confirm_window
      else                                            # 並?替?中
        # 並?替?解除
        Sound.play_cancel
        @battle_member_window.selected_index = nil
        @battle_member_window.refresh
        @control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
      end
    elsif Input.trigger?(Input::C)
      if @battle_member_window.selected_index == nil  # 並?替?中???
        actor = @battle_member_window.actor
        # ?????外???場合
        if actor != nil && $game_party.actor_fixed?(actor.id)
          Sound.play_buzzer
          return
        end
        # ??????????????切?替?
        Sound.play_decision
        @battle_member_window.active = false
        @party_member_window.active = true
        @control_window.mode = Window_PartyFormControl::MODE_PARTY_MEMBER
      else                                            # 並?替?中
        unless can_change_shift?(@battle_member_window.actor)
          Sound.play_buzzer
          return
        end
        # 並?替??行
        Sound.play_decision
        index1 = @battle_member_window.selected_index
        index2 = @battle_member_window.index
        change_shift(index1, index2)
        @control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
      end
    elsif Input.trigger?(Input::X)
      # 並?替?不可能?場合
      unless can_change_shift?(@battle_member_window.actor)
        Sound.play_buzzer
        return
      end
      if @battle_member_window.selected_index == nil  # 並?替?中???
        # 並?替?開始
        Sound.play_decision
        @battle_member_window.selected_index = @battle_member_window.index
        @battle_member_window.refresh
        @control_window.mode = Window_PartyFormControl::MODE_SHIFT_CHANGE
      else                                            # 並?替?中
        # 並?替??行
        Sound.play_decision
        index1 = @battle_member_window.selected_index
        index2 = @battle_member_window.index
        change_shift(index1, index2)
        @control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
      end
    end
  end
  #--------------------------------------------------------------------------
  # ○ 並?替?可否判定
  #--------------------------------------------------------------------------
  def can_change_shift?(actor)
    # 選????????存在???、???並?替?不能?場合
    if actor == nil ||
        (KGC::LargeParty::FORBID_CHANGE_SHIFT_FIXED &&
         $game_party.actor_fixed?(actor.id))
      return false
    end
    return true
  end
  #--------------------------------------------------------------------------
  # ○ 並?替?
  #--------------------------------------------------------------------------
  def change_shift(index1, index2)
    # 位置?入?替?
    $game_party.change_shift(index1, index2)
    # 選?????????????
    @battle_member_window.selected_index = nil
    refresh_window
  end
  #--------------------------------------------------------------------------
  # ○ ????更新 (????????????????場合)
  #--------------------------------------------------------------------------
  def update_party_member
    @status_window.set_actor(@party_member_window.actor)
    if Input.trigger?(Input::B)
      Sound.play_cancel
      # ????????????切?替?
      @battle_member_window.active = true
      @party_member_window.active = false
        @control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
    elsif Input.trigger?(Input::C)
      actor = @party_member_window.actor
      # ????????????含???場合
      if $game_party.battle_members.include?(actor)
        Sound.play_buzzer
        return
      end
      # ?????入?替?
      Sound.play_decision
      actors = $game_party.all_members
      battle_actors = $game_party.battle_members
      if @battle_member_window.actor != nil
        actors[@party_member_window.actor_index] = @battle_member_window.actor
        actors[@battle_member_window.index] = actor
        $game_party.set_member(actors.compact)
      end
      battle_actors[@battle_member_window.index] = actor
      $game_party.set_battle_member(battle_actors.compact)
      refresh_window
      # ????????????切?替?
      @battle_member_window.active = true
      @party_member_window.active = false
      @control_window.mode = Window_PartyFormControl::MODE_BATTLE_MEMBER
    end
  end
  #--------------------------------------------------------------------------
  # ○ ????更新 (確認????????????場合)
  #--------------------------------------------------------------------------
  def update_confirm
    if Input.trigger?(Input::B)
      Sound.play_cancel
      hide_confirm_window
    elsif Input.trigger?(Input::C)
      case @confirm_window.index
      when 0  # 編成完了
        # ?????無??場合
        unless battle_member_valid?
          Sound.play_buzzer
          return
        end
        Sound.play_decision
        return_scene
      when 1  # 編成中?
        Sound.play_decision
        # ?????編成前??態???
        $game_party.set_member(@party_actors)
        $game_party.set_battle_member(@battle_actors)
        return_scene
      when 2  # ?????
        Sound.play_cancel
        hide_confirm_window
      end
    end
  end
  #--------------------------------------------------------------------------
  # ○ ??????有?判定
  #--------------------------------------------------------------------------
  def battle_member_valid?
    return false if $game_party.battle_members.size == 0  # ???????空
    $game_party.battle_members.each { |actor|
      return true if actor.exist?  # 生存者????OK
    }
    return false
  end
  #--------------------------------------------------------------------------
  # ○ 確認??????表示
  #--------------------------------------------------------------------------
  def show_confirm_window
    if @battle_member_window.active
      @last_active_window = @battle_member_window
    else
      @last_active_window = @party_member_window
    end
    @battle_member_window.active = false
    @party_member_window.active = false

    @confirm_window.draw_item(0, battle_member_valid?)
    @confirm_window.open
    @confirm_window.active = true
  end
  #--------------------------------------------------------------------------
  # ○ 確認??????非表示
  #--------------------------------------------------------------------------
  def hide_confirm_window
    @confirm_window.active = false
    @confirm_window.close
    @last_active_window.active = true
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Battle
#==============================================================================

class Scene_Battle < Scene_Base
  #--------------------------------------------------------------------------
  # ● ?????表示?終????????
  #--------------------------------------------------------------------------
  alias wait_for_message_KGC_LargeParty wait_for_message
  def wait_for_message
    return if @ignore_wait_for_message  # ?????終了????????無視

    wait_for_message_KGC_LargeParty
  end
  #--------------------------------------------------------------------------
  # ● ???????表示
  #--------------------------------------------------------------------------
  alias display_level_up_KGC_LargeParty display_level_up
  def display_level_up
    @ignore_wait_for_message = true

    display_level_up_KGC_LargeParty

    exp = $game_troop.exp_total * KGC::LargeParty::STAND_BY_EXP_RATE / 1000
    $game_party.stand_by_members.each { |actor|
      if actor.exist?
        actor.gain_exp(exp, KGC::LargeParty::SHOW_STAND_BY_LEVEL_UP)
      end
    }
    @ignore_wait_for_message = false
    wait_for_message
  end
  #--------------------------------------------------------------------------
  # ● ????????選??開始
  #--------------------------------------------------------------------------
  alias start_party_command_selection_KGC_LargeParty start_party_command_selection
  def start_party_command_selection
    if $game_temp.in_battle
      @status_window.index = 0
    end

    start_party_command_selection_KGC_LargeParty
  end

  if KGC::LargeParty::USE_BATTLE_PARTYFORM
  #--------------------------------------------------------------------------
  # ● 情報表示???????作成
  #--------------------------------------------------------------------------
  alias create_info_viewport_KGC_LargeParty create_info_viewport
  def create_info_viewport
    create_info_viewport_KGC_LargeParty

    @__command_partyform_index =
      @party_command_window.add_command(Vocab.partyform_battle)
    @party_command_window.draw_item(@__command_partyform_index,
      $game_party.battle_partyform_enable?)
  end
  #--------------------------------------------------------------------------
  # ● ????????選??更新
  #--------------------------------------------------------------------------
  alias update_party_command_selection_KGC_LargeParty update_party_command_selection
  def update_party_command_selection
    if Input.trigger?(Input::C)
      case @party_command_window.index
      when @__command_partyform_index  # ????編成
        unless $game_party.battle_partyform_enable?
          Sound.play_buzzer
          return
        end
        Sound.play_decision
        process_partyform
        return
      end
    end

    update_party_command_selection_KGC_LargeParty
  end
  #--------------------------------------------------------------------------
  # ○ ????編成??理
  #--------------------------------------------------------------------------
  def process_partyform
    Graphics.freeze
    snapshot_for_background
    $scene = Scene_PartyForm.new(0, Scene_PartyForm::HOST_BATTLE)
    $scene.main
    $scene = self
    @status_window.refresh
    perform_transition
  end
  end
end
回复 支持 反对

使用道具 举报

1

主题

6

帖子

63

积分

②入门

积分
63
 楼主| 发表于 2010-2-1 20:57:31 | 显示全部楼层
技能裝備

#==============================================================================
# ★ ??????項目 - Customize ★
#==============================================================================
module KGC
module SkillCPSystem
  # ◆ 登????最大?
  MAX_SKILLS = 6
  # ◆ CP ?名?
  VOCAB_CP   = "CP"
  # ◆ CP ?名? (略)
  VOCAB_CP_A = "C"
  # ◆ ??????面? CP ?表示??
  SHOW_STATUS_CP = true

  # ◆ 消費 CP 既定?
  #  消費 CP 未指定?????使用。
  DEFAULT_CP_COST = 1
  # ◆ CP 上限
  #  (固有 CP ???除??) 素??態?? CP 上限。
  CP_MAX = 15
  # ◆ CP 下限
  CP_MIN = 1
  # ◆ 補正後? CP 上限
  #  固有 CP ??備品????動?含??上限。
  REVISED_CP_MAX = 20
  # ◆ 補正後? CP 下限
  REVISED_CP_MIN = 0
  # ◆ 最大 CP 算出式
  #   level..現在????
  #  自動的?整??換????、結果?小??????OK。
  CP_CALC_EXP = "level * 0.45 + 1.0"
  # ◆ ??????最大 CP 算出式
  PERSONAL_CP_CALC_EXP = []
  #  ????下?、???????最大 CP ?
  #   PERSONAL_CP_CALC_EXP[???? ID] = "計算式"
  #  ???書式?指定。
  #  計算式? CP_CALC_EXP ?同??書式。
  #  指定?????????? CP_CALC_EXP ?使用。
  #   <例> ?????優遇
  # PERSONAL_CP_CALC_EXP[1] = "level * 0.8 + 2.0"

  # ◆ ?????時?無?化
  #  true  : ?????時?全????使用可能。
  #  false : ?????時? (??????限?) 使用不可。
  DISABLE_IN_BATTLETEST  = true
  # ◆ 使用不可???????可能
  SHOW_UNUSABLE_SKILL    = true
  # ◆ 消費 CP 0 ?????????????使用可能
  USABLE_COST_ZERO_SKILL = true
  # ◆ ????????????????果??
  #  ????????? 導入時??有?。
  PASSIVE_NEED_TO_SET    = true
  # ◆ 新規習得????自動的????
  #  true  : 習得??????空?????????。
  #           ※ ????習得?備? ?習得??????無?。
  #  false : 習得????????????? (手動????)。
  AUTO_SET_NEW_SKILL     = true
  # ◆ 消費 CP 0 ?場合?消費 CP ?表示??
  #  true  : 消費 CP 0 ??表示
  #  false : 消費 CP 1 以上?場合??表示
  SHOW_ZERO_COST         = false

  # ◆ CP ????色
  #  ??  : \\C[n] ?同?色。
  #  Color : 指定??色。 ( Color.new(255, 128, 128) ?? )
  GAUGE_START_COLOR = 13  # 開始色
  GAUGE_END_COLOR   =  5  # 終了色

  # ◆ CP ????汎用????使用??
  #  ?汎用???描?? 導入時??有?。
  ENABLE_GENERIC_GAUGE = true
  # ◆ CP ???設定
  #  ?像? "Graphics/System" ??????。
  GAUGE_IMAGE  = "GaugeCP"  # ?像
  GAUGE_OFFSET = [-23, -2]  # 位置補正 [x, y]
  GAUGE_LENGTH = -4         # 長?補正
  GAUGE_SLOPE  = 30         # 傾? (-89 ~ 89)

  # ◆ ?????面?「???設定」?????追加??
  #  追加??場所?、?????????最下部??。
  #  他?部分?追加?????、?????????????? ??利用????。
  USE_MENU_SET_SKILL_COMMAND = true
  # ◆ ?????面?「???設定」?????名?
  VOCAB_MENU_SET_SKILL       = "技能設定"

  # ◆ 未設定項目?表示文字列
  BLANK_TEXT   = "-  EMPTY  -"
  # ◆ 設定解除?表示文字列
  RELEASE_TEXT = "( 設定解除 )"
end
end

$imported = {} if $imported == nil
$imported["SkillCPSystem"] = true

module KGC::SkillCPSystem
  module Regexp
    module BaseItem
      # 最大 CP
      MAXCP_PLUS = /<(?:MAX|最大)CP\\s*([\\-\\+]?\\d+)>/
      # 登?????
      BATTLE_SKILL_MAX = /<(?:BATTLE_SKILL_MAX|登?????)\\s*([\\-\\+]?\\d+)>/i
    end

    module Skill
      # 消費 CP
      CP_COST = /<CP\\s*(\\d+)>/i
      # 同時???不可
      EXCLUDE = /<(?:EXCLUDE|同時???不可)\\s*(\\d+(?:\\s*,\\s*\\d+)*)>/
    end
  end
end

# □ KGC::Commands

module KGC
module Commands
  module_function
  #--------------------------------------------------------------------------
  # ○ MaxCP 補正??取得
  #     actor_id    : ???? ID
  #     variable_id : 取得????代入????? ID
  #--------------------------------------------------------------------------
  def get_actor_own_cp(actor_id, variable_id = 0)
    value = $game_actors[actor_id].maxcp_plus
    $game_variables[variable_id] = value if variable_id > 0
    return value
  end
  alias get_own_cp get_actor_own_cp
  #--------------------------------------------------------------------------
  # ○ MaxCP 補正???更
  #     actor_id : ???? ID
  #     value    : MaxCP 補正?
  #--------------------------------------------------------------------------
  def set_actor_own_cp(actor_id, value)
    $game_actors[actor_id].maxcp_plus = value
  end
  alias set_own_cp set_actor_own_cp
  #--------------------------------------------------------------------------
  # ○ ????? MaxCP 補正???加
  #     actor_id : ???? ID
  #     value    : ?加量
  #--------------------------------------------------------------------------
  def gain_actor_cp(actor_id, value)
    $game_actors[actor_id].maxcp_plus += value
  end
  #--------------------------------------------------------------------------
  # ○ 登????最大??取得
  #     actor_id : ???? ID
  #     variable_id : 取得????代入????? ID
  #--------------------------------------------------------------------------
  def get_battle_skill_max(actor_id, variable_id = 0)
    value = $game_actors[actor_id].battle_skill_max
    $game_variables[variable_id] = value if variable_id > 0
    return value
  end
  #--------------------------------------------------------------------------
  # ○ 登????最大???更
  #     actor_id : ???? ID
  #     value    : 登?可能?
  #--------------------------------------------------------------------------
  def set_battle_skill_max(actor_id, value = -1)
    $game_actors[actor_id].battle_skill_max = value
  end
  #--------------------------------------------------------------------------
  # ○ ????登???????
  #     actor_id : ???? ID
  #     skill_id : 確認????? ID
  #--------------------------------------------------------------------------
  def battle_skill_set?(actor_id, skill_id)
    return $game_actors[actor_id].battle_skill_ids.include?(skill_id)
  end
  #--------------------------------------------------------------------------
  # ○ ????登?
  #     actor_id : ???? ID
  #     index    : 登?箇所
  #     skill_id : 登?????? ID (nil ?解除)
  #--------------------------------------------------------------------------
  def set_battle_skill(actor_id, index, skill_id = nil)
    actor = $game_actors[actor_id]
    if skill_id.is_a?(Integer)
      # 登?
      skill = $data_skills[skill_id]
      return unless actor.battle_skill_settable?(index, skill)  # ???不可

      actor.set_battle_skill(index, skill)
      actor.restore_battle_skill
    else
      # 解除
      actor.remove_battle_skill(index)
    end
  end
  #--------------------------------------------------------------------------
  # ○ ????追加登?
  #     actor_id : ???? ID
  #     skill_id : 登?????? ID
  #--------------------------------------------------------------------------
  def add_battle_skill(actor_id, skill_id)
    actor = $game_actors[actor_id]
    skill = $data_skills[skill_id]
    return if actor == nil || skill == nil

    actor.add_battle_skill(skill)
  end
  #--------------------------------------------------------------------------
  # ○ ????全解除
  #     actor_id : ???? ID
  #--------------------------------------------------------------------------
  def clear_battle_skill(actor_id)
    $game_actors[actor_id].clear_battle_skill
  end
  #--------------------------------------------------------------------------
  # ○ ???設定?面?呼?出?
  #     actor_index : ??????????
  #--------------------------------------------------------------------------
  def call_set_battle_skill(actor_index = 0)
    return if $game_temp.in_battle
    $game_temp.next_scene = :set_battle_skill
    $game_temp.next_scene_actor_index = actor_index
  end
end
end

class Game_Interpreter
  include KGC::Commands
end

# ■ Vocab

module Vocab
  # CP
  def self.cp
    return KGC::SkillCPSystem::VOCAB_CP
  end

  # CP (略)
  def self.cp_a
    return KGC::SkillCPSystem::VOCAB_CP_A
  end

  # ???設定
  def self.set_battle_skill
    return KGC::SkillCPSystem::VOCAB_MENU_SET_SKILL
  end
end

# ■ RPG::BaseItem

class RPG::BaseItem
  #--------------------------------------------------------------------------
  # ○ ???CP制???????生成
  #--------------------------------------------------------------------------
  def create_skill_cp_system_cache
    @__maxcp_plus = 0
    @__battle_skill_max_plus = 0

    self.note.each_line { |line|
      case line
      when KGC::SkillCPSystem::Regexp::BaseItem::MAXCP_PLUS
        # 最大 CP
        @__maxcp_plus += $1.to_i
      when KGC::SkillCPSystem::Regexp::BaseItem::BATTLE_SKILL_MAX
        # 登?????
        @__battle_skill_max_plus += $1.to_i
      end
    }
  end
  #--------------------------------------------------------------------------
  # ○ 最大 CP 補正
  #--------------------------------------------------------------------------
  def maxcp_plus
    create_skill_cp_system_cache if @__maxcp_plus == nil
    return @__maxcp_plus
  end
  #--------------------------------------------------------------------------
  # ○ 登?????補正
  #--------------------------------------------------------------------------
  def battle_skill_max_plus
    create_skill_cp_system_cache if @__battle_skill_max_plus == nil
    return @__battle_skill_max_plus
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ RPG::Skill
#==============================================================================

class RPG::Skill < RPG::UsableItem
  #--------------------------------------------------------------------------
  # ○ ???CP制???????生成
  #--------------------------------------------------------------------------
  def create_skill_cp_system_cache
    @__cp_cost = KGC::SkillCPSystem:EFAULT_CP_COST
    @__excluded_skills = []

    self.note.each_line { |line|
      case line
      when KGC::SkillCPSystem::Regexp::Skill::CP_COST
        # 消費 CP
        @__cp_cost = $1.to_i
      when KGC::SkillCPSystem::Regexp::Skill::EXCLUDE
        # 同時???不可
        $1.scan(/\\d+/).each { |num| @__excluded_skills << num.to_i }
        @__excluded_skills.uniq!
      end
    }
  end
  #--------------------------------------------------------------------------
  # ○ 消費 CP
  #--------------------------------------------------------------------------
  def cp_cost
    create_skill_cp_system_cache if @__cp_cost == nil
    return @__cp_cost
  end
  #--------------------------------------------------------------------------
  # ○ 同時???不可
  #--------------------------------------------------------------------------
  def excluded_skills
    create_skill_cp_system_cache if @__excluded_skills == nil
    return @__excluded_skills
  end
end

# ■ Game_Battler

class Game_Battler
  #--------------------------------------------------------------------------
  # ○ ??用????????判定
  #     skill : ???
  #--------------------------------------------------------------------------
  def battle_skill_set?(skill)
    return true
  end
end

# ■ Game_Actor

class Game_Actor < Game_Battler
  #--------------------------------------------------------------------------
  # ● 公開????????
  #--------------------------------------------------------------------------
  attr_writer   :maxcp_plus               # MaxCP 補正?
  #--------------------------------------------------------------------------
  # ○ MaxCP 取得
  #--------------------------------------------------------------------------
  def maxcp
    calc_exp = KGC::SkillCPSystem:ERSONAL_CP_CALC_EXP[self.id]
    if calc_exp == nil
      calc_exp = KGC::SkillCPSystem::CP_CALC_EXP
    end
    n = Integer(eval(calc_exp))
    n = [[n, cp_limit].min, KGC::SkillCPSystem::CP_MIN].max
    n += maxcp_plus + maxcp_plus_equip
    return [[n, revised_cp_limit].min, KGC::SkillCPSystem::REVISED_CP_MIN].max
  end
  #--------------------------------------------------------------------------
  # ○ CP 取得
  #--------------------------------------------------------------------------
  def cp
    return [maxcp - consumed_cp, 0].max
  end
  #--------------------------------------------------------------------------
  # ○ CP 消費量取得
  #--------------------------------------------------------------------------
  def consumed_cp
    n = 0
    battle_skills.compact.each { |skill| n += skill.cp_cost }
    return n
  end
  #--------------------------------------------------------------------------
  # ○ CP 上限取得
  #--------------------------------------------------------------------------
  def cp_limit
    return KGC::SkillCPSystem::CP_MAX
  end
  #--------------------------------------------------------------------------
  # ○ 補正後? CP 上限取得
  #--------------------------------------------------------------------------
  def revised_cp_limit
    return KGC::SkillCPSystem::REVISED_CP_MAX
  end
  #--------------------------------------------------------------------------
  # ○ MaxCP 補正?取得
  #--------------------------------------------------------------------------
  def maxcp_plus
    if @maxcp_plus == nil
      if @own_cp != nil
        @maxcp_plus = @own_cp
        @own_cp = nil
      else
        @maxcp_plus = 0
      end
    end
    return @maxcp_plus
  end
  #--------------------------------------------------------------------------
  # ○ ?備品??? MaxCP 補正?取得
  #--------------------------------------------------------------------------
  def maxcp_plus_equip
    n = 0
    equips.compact.each { |item| n += item.maxcp_plus }
    return n
  end
  #--------------------------------------------------------------------------
  # ● ???取得
  #--------------------------------------------------------------------------
  alias skills_KGC_SkillCPSystem skills
  def skills
    return (skill_cp_restrict? ? restricted_skills : skills_KGC_SkillCPSystem)
  end
  #--------------------------------------------------------------------------
  # ○ ????制限???
  #--------------------------------------------------------------------------
  def skill_cp_restrict?
    if $game_temp.in_battle
      # ?????????、???????制限??場合
      return true unless $BTEST && KGC::SkillCPSystem:ISABLE_IN_BATTLETEST
    end

    return false
  end
  #--------------------------------------------------------------------------
  # ○ ????制限
  #--------------------------------------------------------------------------
  def restricted_skills
    result = all_skills
    result.each_with_index { |skill, i|
      # 消費 CP > 0 ?????除外
      if !KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL || skill.cp_cost > 0
        result = nil
      end
      # ????????除外
      if $imported["assiveSkill"] && KGC::SkillCPSystem:ASSIVE_NEED_TO_SET
        if skill.passive &&
            (!KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL || skill.cp_cost > 0)
          result = nil
        end
      end
    }
    result.compact!
    # ??????追加
    result |= battle_skills
    result.sort! { |a, b| a.id <=> b.id }
    return result
  end
  #--------------------------------------------------------------------------
  # ○ 全???取得
  #--------------------------------------------------------------------------
  def all_skills
    # 一時的?非??中???
    last_in_battle = $game_temp.in_battle
    $game_temp.in_battle = false

    result = skills_KGC_SkillCPSystem
    if $imported["EquipLearnSkill"]
      result |= (equipment_skills | full_ap_skills)
      result.sort! { |a, b| a.id <=> b.id }
    end

    # ??中??????
    $game_temp.in_battle = last_in_battle

    return result
  end
  #--------------------------------------------------------------------------
  # ○ 登????最大?取得
  #--------------------------------------------------------------------------
  def battle_skill_max
    @battle_skill_max = -1 if @battle_skill_max == nil
    n = (@battle_skill_max < 0 ?
      KGC::SkillCPSystem::MAX_SKILLS : @battle_skill_max)
    n += equipment_battle_skill_max_plus
    return [n, 0].max
  end
  #--------------------------------------------------------------------------
  # ○ ?備品???登?????補正
  #--------------------------------------------------------------------------
  def equipment_battle_skill_max_plus
    n = 0
    equips.compact.each { |item| n += item.battle_skill_max_plus }
    return n
  end
  #--------------------------------------------------------------------------
  # ○ 登????最大?設定
  #--------------------------------------------------------------------------
  def battle_skill_max=(value)
    @battle_skill_max = value
    if @battle_skills == nil
      @battle_skills = []
    else
      @battle_skills = @battle_skills[0...value]
    end
    restore_passive_rev if $imported["assiveSkill"]
  end
  #--------------------------------------------------------------------------
  # ○ ??用??? ID 取得
  #--------------------------------------------------------------------------
  def battle_skill_ids
    @battle_skills = [] if @battle_skills == nil
    return @battle_skills
  end
  #--------------------------------------------------------------------------
  # ○ ??用???取得
  #--------------------------------------------------------------------------
  def battle_skills
    result = []
    battle_skill_ids.each { |i|
      next if i == nil           # 無??????無視
      result << $data_skills
    }
    return result
  end
  #--------------------------------------------------------------------------
  # ○ ??用???登?
  #     index : 位置
  #     skill : ??? (nil ?解除)
  #--------------------------------------------------------------------------
  def set_battle_skill(index, skill)
    if skill == nil
      @battle_skills[index] = nil
    else
      return unless skill.is_a?(RPG::Skill)  # ???以外
      return if cp < skill.cp_cost           # CP 不足
      return if KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL && skill.cp_cost == 0

      @battle_skills[index] = skill.id
    end
    restore_passive_rev if $imported["assiveSkill"]
  end
  #--------------------------------------------------------------------------
  # ○ ??用???追加登?
  #     skill : ???
  #--------------------------------------------------------------------------
  def add_battle_skill(skill)
    return unless skill.is_a?(RPG::Skill)  # ???以外
    skills = battle_skill_ids
    return if skills.include?(skill.id)    # 登???
    return if cp < skill.cp_cost           # CP 不足
    return if KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL && skill.cp_cost == 0

    battle_skill_max.times { |i|
      # 空?????登?
      if skills == nil
        set_battle_skill(i, skill)
        break
      end
    }
    restore_battle_skill
  end
  #--------------------------------------------------------------------------
  # ○ ??用???解除
  #     index : 位置
  #--------------------------------------------------------------------------
  def remove_battle_skill(index)
    @battle_skills[index] = nil
    restore_passive_rev if $imported["assiveSkill"]
  end
  #--------------------------------------------------------------------------
  # ○ ??用???全解除
  #--------------------------------------------------------------------------
  def clear_battle_skill
    @battle_skills = []
    restore_passive_rev if $imported["assiveSkill"]
  end
  #--------------------------------------------------------------------------
  # ○ ??用??????可否判定
  #     index : 位置
  #     skill : ???
  #--------------------------------------------------------------------------
  def battle_skill_settable?(index, skill)
    return false if battle_skill_max <= index  # 範?外
    return true  if skill == nil               # nil ?解除??? OK

    return false if battle_skill_ids.include?(skill.id)  # ?????

    curr_skill_id = battle_skill_ids[index]
    curr_skill    = (curr_skill_id != nil ? $data_skills[curr_skill_id] : nil)

    # 同時???不可
    excluded  = excluded_battle_skill_ids
    excluded -= curr_skill.excluded_skills if curr_skill != nil
    return false if excluded.include?(skill.id)

    offset = (curr_skill != nil ? curr_skill.cp_cost : 0)
    return false if self.cp < (skill.cp_cost - offset)  # CP 不足

    return true
  end
  #--------------------------------------------------------------------------
  # ○ Exclude ??? ID 取得
  #--------------------------------------------------------------------------
  def excluded_battle_skill_ids
    result = []
    battle_skills.each { |skill| result |= skill.excluded_skills }
    return result
  end
  #--------------------------------------------------------------------------
  # ○ ??用????修復
  #--------------------------------------------------------------------------
  def restore_battle_skill
    result = battle_skill_ids.clone
    usable_skills = all_skills

    result.each_with_index { |n, i|
      next if n == nil
      # 未修得?場合?解除
      if (usable_skills.find { |s| s.id == n }) == nil
        result = nil
      end
    }
    @battle_skills = result[0...battle_skill_max]
    # CP 不足?????下??順?外?
    (battle_skill_max - 1).downto(0) { |i|
      @battle_skills = nil if maxcp - consumed_cp < 0
    }
  end
  #--------------------------------------------------------------------------
  # ● ?備??更 (???????指定)
  #     equip_type : ?備部位 (0..4)
  #     item       : 武器 or 防具 (nil ???備解除)
  #     test       : ?????? (?????、????備?面??一時?備)
  #--------------------------------------------------------------------------
  alias change_equip_KGC_SkillCPSystem change_equip
  def change_equip(equip_type, item, test = false)
    change_equip_KGC_SkillCPSystem(equip_type, item, test)

    unless test
      restore_battle_skill
      restore_passive_rev if $imported["assiveSkill"]
    end
  end
  #--------------------------------------------------------------------------
  # ● ?備?破棄
  #     item : 破棄??武器 or 防具
  #    武器/防具??減?「?備品?含??」???使用??。
  #--------------------------------------------------------------------------
  alias discard_equip_KGC_SkillCPSystem discard_equip
  def discard_equip(item)
    discard_equip_KGC_SkillCPSystem(item)

    restore_battle_skill
    restore_passive_rev if $imported["assiveSkill"]
  end
  #--------------------------------------------------------------------------
  # ● ?????更
  #     exp  : 新?????
  #     show : ??????表示???
  #--------------------------------------------------------------------------
  alias change_exp_KGC_SkillCPSystem change_exp
  def change_exp(exp, show)
    # 習得??????表示????、??中????一時的?解除
    last_in_battle = $game_temp.in_battle
    $game_temp.in_battle = false

    change_exp_KGC_SkillCPSystem(exp, show)

    $game_temp.in_battle = last_in_battle
  end

  if KGC::SkillCPSystem::AUTO_SET_NEW_SKILL
  #--------------------------------------------------------------------------
  # ● ???????
  #     skill_id : ??? ID
  #--------------------------------------------------------------------------
  alias learn_skill_KGC_SkillCPSystem learn_skill
  def learn_skill(skill_id)
    learn_skill_KGC_SkillCPSystem(skill_id)

    add_battle_skill($data_skills[skill_id])
  end
  end  # <- if KGC::SkillCPSystem::AUTO_SET_NEW_SKILL

  #--------------------------------------------------------------------------
  # ● ????忘??
  #     skill_id : ??? ID
  #--------------------------------------------------------------------------
  alias forget_skill_KGC_SkillCPSystem forget_skill
  def forget_skill(skill_id)
    # 忘????????用?????削除
    battle_skill_ids.each_with_index { |s, i|
      remove_battle_skill(i) if s == skill_id
    }

    forget_skill_KGC_SkillCPSystem(skill_id)
  end
  #--------------------------------------------------------------------------
  # ○ ??用????????判定
  #     skill : ???
  #--------------------------------------------------------------------------
  def battle_skill_set?(skill)
    return false unless skill.is_a?(RPG::Skill)  # ???以外

    return battle_skill_ids.include?(skill.id)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_Base
#==============================================================================

class Window_Base < Window
  #--------------------------------------------------------------------------
  # ○ CP ?文字色?取得
  #     actor : ????
  #--------------------------------------------------------------------------
  def cp_color(actor)
    return knockout_color if actor.maxcp > 0 && actor.cp == 0
    return normal_color
  end
  #--------------------------------------------------------------------------
  # ○ CP ????色 1 ?取得
  #--------------------------------------------------------------------------
  def cp_gauge_color1
    color = KGC::SkillCPSystem::GAUGE_START_COLOR
    return (color.is_a?(Integer) ? text_color(color) : color)
  end
  #--------------------------------------------------------------------------
  # ○ CP ????色 2 ?取得
  #--------------------------------------------------------------------------
  def cp_gauge_color2
    color = KGC::SkillCPSystem::GAUGE_END_COLOR
    return (color.is_a?(Integer) ? text_color(color) : color)
  end
  #--------------------------------------------------------------------------
  # ○ CP ?描?
  #     actor : ????
  #     x     : 描?先 X 座標
  #     y     : 描?先 Y 座標
  #     width : 幅
  #--------------------------------------------------------------------------
  def draw_actor_cp(actor, x, y, width = 120)
    draw_actor_cp_gauge(actor, x, y, width)
    self.contents.font.color = system_color
    self.contents.draw_text(x, y, 30, WLH, Vocab::cp_a)
    self.contents.font.color = cp_color(actor)
    xr = x + width
    if width < 120
      self.contents.draw_text(xr - 40, y, 40, WLH, actor.cp, 2)
    else
      self.contents.draw_text(xr - 90, y, 40, WLH, actor.cp, 2)
      self.contents.font.color = normal_color
      self.contents.draw_text(xr - 50, y, 10, WLH, "/", 2)
      self.contents.draw_text(xr - 40, y, 40, WLH, actor.maxcp, 2)
    end
    self.contents.font.color = normal_color
  end
  #--------------------------------------------------------------------------
  # ○ CP ????描?
  #     actor : ????
  #     x     : 描?先 X 座標
  #     y     : 描?先 Y 座標
  #     width : 幅
  #--------------------------------------------------------------------------
  def draw_actor_cp_gauge(actor, x, y, width = 120)
    if KGC::SkillCPSystem::ENABLE_GENERIC_GAUGE && $imported["GenericGauge"]
      # 汎用???
      draw_gauge(KGC::SkillCPSystem::GAUGE_IMAGE,
        x, y, width, actor.cp, [actor.maxcp, 1].max,
        KGC::SkillCPSystem::GAUGE_OFFSET,
        KGC::SkillCPSystem::GAUGE_LENGTH,
        KGC::SkillCPSystem::GAUGE_SLOPE)
    else
      # ????????
      gw = width * actor.cp / [actor.maxcp, 1].max
      gc1 = cp_gauge_color1
      gc2 = cp_gauge_color2
      self.contents.fill_rect(x, y + WLH - 8, width, 6, gauge_back_color)
      self.contents.gradient_fill_rect(x, y + WLH - 8, gw, 6, gc1, gc2)
    end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_Command
#==============================================================================

class Window_Command < Window_Selectable
  unless method_defined?(:add_command)
  #--------------------------------------------------------------------------
  # ○ ?????追加
  #    追加??位置?返?
  #--------------------------------------------------------------------------
  def add_command(command)
    @commands << command
    @item_max = @commands.size
    item_index = @item_max - 1
    refresh_command
    draw_item(item_index)
    return item_index
  end
  #--------------------------------------------------------------------------
  # ○ ???????????
  #--------------------------------------------------------------------------
  def refresh_command
    buf = self.contents.clone
    self.height = [self.height, row_max * WLH + 32].max
    create_contents
    self.contents.blt(0, 0, buf, buf.rect)
    buf.dispose
  end
  #--------------------------------------------------------------------------
  # ○ ??????入
  #--------------------------------------------------------------------------
  def insert_command(index, command)
    @commands.insert(index, command)
    @item_max = @commands.size
    refresh_command
    refresh
  end
  #--------------------------------------------------------------------------
  # ○ ?????削除
  #--------------------------------------------------------------------------
  def remove_command(command)
    @commands.delete(command)
    @item_max = @commands.size
    refresh
  end
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Window_Status
#==============================================================================

if KGC::SkillCPSystem::SHOW_STATUS_CP
class Window_Status < Window_Base
  #--------------------------------------------------------------------------
  # ● 基本情報?描?
  #     x : 描?先 X 座標
  #     y : 描?先 Y 座標
  #--------------------------------------------------------------------------
  alias draw_basic_info_KGC_SkillCPSystem draw_basic_info
  def draw_basic_info(x, y)
    draw_basic_info_KGC_SkillCPSystem(x, y)

    draw_actor_cp(@actor, x, y + WLH * 4)
  end
end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# □ Window_BattleSkillStatus
#------------------------------------------------------------------------------
#   ?????設定?面?、設定者???????表示?????????。
#==============================================================================

class Window_BattleSkillStatus < Window_Base
  #--------------------------------------------------------------------------
  # ● ??????初期化
  #     x     : ?????? X 座標
  #     y     : ?????? Y 座標
  #     actor : ????
  #--------------------------------------------------------------------------
  def initialize(x, y, actor)
    super(x, y, Graphics.width, WLH + 32)
    @actor = actor
    refresh
  end
  #--------------------------------------------------------------------------
  # ● ??????
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    draw_actor_name(@actor, 4, 0)
    draw_actor_level(@actor, 140, 0)
    draw_actor_cp(@actor, 240, 0)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# □ Window_BattleSkillSlot
#------------------------------------------------------------------------------
#   ?????選??面?、設定??????一??表示?????????。
#==============================================================================

class Window_BattleSkillSlot < Window_Selectable
  #--------------------------------------------------------------------------
  # ● ??????初期化
  #     x      : ?????? X 座標
  #     y      : ?????? Y 座標
  #     width  : ??????幅
  #     height : ??????高?
  #     actor  : ????
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height, actor)
    super(x, y, width, height)
    @actor = actor
    self.index = 0
    self.active = false
    refresh
  end
  #--------------------------------------------------------------------------
  # ○ ????取得
  #--------------------------------------------------------------------------
  def skill
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # ● ??????
  #--------------------------------------------------------------------------
  def refresh
    @data = []
    skill_ids = @actor.battle_skill_ids
    @actor.battle_skill_max.times { |i|
      if skill_ids != nil
        @data << $data_skills[skill_ids]
      else
        @data << nil
      end
    }
    @item_max = @data.size
    create_contents
    @item_max.times { |i| draw_item(i) }
  end
  #--------------------------------------------------------------------------
  # ○ 消費 CP 描?判定
  #--------------------------------------------------------------------------
  def cp_cost_show?(skill)
    return true if KGC::SkillCPSystem::SHOW_ZERO_COST

    return (skill.cp_cost > 0)
  end
  #--------------------------------------------------------------------------
  # ○ 項目?描?
  #     index : 項目番?
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    skill = @data[index]
    if skill != nil
      rect.width -= 4
      draw_item_name(skill, rect.x, rect.y)
      self.contents.draw_text(rect, skill.cp_cost, 2) if cp_cost_show?(skill)
    else
      self.contents.draw_text(rect, KGC::SkillCPSystem::BLANK_TEXT, 1)
    end
  end
  #--------------------------------------------------------------------------
  # ● ????? 1 ???後??移動
  #--------------------------------------------------------------------------
  def cursor_pagedown
    return if Input.repeat?(Input::R)
    super
  end
  #--------------------------------------------------------------------------
  # ● ????? 1 ???前?移動
  #--------------------------------------------------------------------------
  def cursor_pageup
    return if Input.repeat?(Input:)
    super
  end
  #--------------------------------------------------------------------------
  # ● ????更新
  #--------------------------------------------------------------------------
  def update
    super
    return unless self.active

    if Input.repeat?(Input::RIGHT)
      Sound.play_cursor
      cursor_pagedown
    elsif Input.repeat?(Input:EFT)
      Sound.play_cursor
      cursor_pageup
    end
  end
  #--------------------------------------------------------------------------
  # ● ???????更新
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(skill == nil ? "" : skill.description)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# □ Window_BattleSkillList
#------------------------------------------------------------------------------
#   ?????選??面?、設定???????一??表示?????????。
#==============================================================================

class Window_BattleSkillList < Window_Selectable
  #--------------------------------------------------------------------------
  # ● 公開????????
  #--------------------------------------------------------------------------
  attr_accessor :slot_index               # ????番?
  #--------------------------------------------------------------------------
  # ● ??????初期化
  #     x      : ?????? X 座標
  #     y      : ?????? Y 座標
  #     width  : ??????幅
  #     height : ??????高?
  #     actor  : ????
  #--------------------------------------------------------------------------
  def initialize(x, y, width, height, actor)
    super(x, y, width, height)
    @actor = actor
    @slot_index = 0
    self.index = 0
    self.active = false
    refresh
  end
  #--------------------------------------------------------------------------
  # ○ ????取得
  #--------------------------------------------------------------------------
  def skill
    return @data[self.index]
  end
  #--------------------------------------------------------------------------
  # ● ??????
  #--------------------------------------------------------------------------
  def refresh
    @data = [nil]
    # 選?可能???????取得
    @actor.all_skills.each { |skill|
      @data.push(skill) if selectable?(skill)
    }

    @item_max = @data.size
    create_contents
    @item_max.times { |i| draw_item(i) }
  end
  #--------------------------------------------------------------------------
  # ○ ???選?可否判定
  #     skill : ???
  #--------------------------------------------------------------------------
  def selectable?(skill)
    return false if skill == nil

    # 消費 CP 0 ??常?使用可能?場合
    if KGC::SkillCPSystem::USABLE_COST_ZERO_SKILL && skill.cp_cost == 0
      return false
    end
    # ??時?使用可能??OK
    return true if skill.battle_ok?
    # 使用不可?????可能?場合
    if KGC::SkillCPSystem::SHOW_UNUSABLE_SKILL && skill.occasion == 3
      return true
    end

    return false
  end
  #--------------------------------------------------------------------------
  # ○ 消費 CP 描?判定
  #--------------------------------------------------------------------------
  def cp_cost_show?(skill)
    return true if KGC::SkillCPSystem::SHOW_ZERO_COST

    return (skill.cp_cost > 0)
  end
  #--------------------------------------------------------------------------
  # ○ 項目?描?
  #     index : 項目番?
  #--------------------------------------------------------------------------
  def draw_item(index)
    rect = item_rect(index)
    self.contents.clear_rect(rect)
    skill = @data[index]
    if skill != nil
      rect.width -= 4
      enabled = @actor.battle_skill_settable?(@slot_index, skill)
      draw_item_name(skill, rect.x, rect.y, enabled)
      self.contents.draw_text(rect, skill.cp_cost, 2) if cp_cost_show?(skill)
    else
      self.contents.draw_text(rect, KGC::SkillCPSystem::RELEASE_TEXT, 1)
    end
  end
  #--------------------------------------------------------------------------
  # ● ????更新
  #--------------------------------------------------------------------------
  def update
    super
    return unless self.active

    if Input.repeat?(Input::RIGHT)
      cursor_pagedown
    elsif Input.repeat?(Input:EFT)
      cursor_pageup
    end
  end
  #--------------------------------------------------------------------------
  # ● ???????更新
  #--------------------------------------------------------------------------
  def update_help
    @help_window.set_text(skill == nil ? "" : skill.description)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Map
#==============================================================================

class Scene_Map < Scene_Base
  #--------------------------------------------------------------------------
  # ● ?面切?替???行
  #--------------------------------------------------------------------------
  alias update_scene_change_KGC_SkillCPSystem update_scene_change
  def update_scene_change
    return if $game_player.moving?    # ??????移動中?

    if $game_temp.next_scene == :set_battle_skill
      call_set_battle_skill
      return
    end

    update_scene_change_KGC_SkillCPSystem
  end
  #--------------------------------------------------------------------------
  # ○ ???設定?面??切?替?
  #--------------------------------------------------------------------------
  def call_set_battle_skill
    $game_temp.next_scene = nil
    $scene = Scene_SetBattleSkill.new(
      $game_temp.next_scene_actor_index,
      0,
      Scene_SetBattleSkill::HOST_MAP)
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# ■ Scene_Menu
#==============================================================================

class Scene_Menu < Scene_Base
  if KGC::SkillCPSystem::USE_MENU_SET_SKILL_COMMAND
  #--------------------------------------------------------------------------
  # ● ??????????作成
  #--------------------------------------------------------------------------
  alias create_command_window_KGC_SkillCPSystem create_command_window
  def create_command_window
    create_command_window_KGC_SkillCPSystem

    return if $imported["CustomMenuCommand"]

    @__command_set_battle_skill_index =
      @command_window.add_command(Vocab.set_battle_skill)
    if @command_window.oy > 0
      @command_window.oy -= Window_Base::WLH
    end
    @command_window.index = @menu_index
  end
  end
  #--------------------------------------------------------------------------
  # ● ????選??更新
  #--------------------------------------------------------------------------
  alias update_command_selection_KGC_SkillCPSystem update_command_selection
  def update_command_selection
    call_set_battle_skill_flag = false
    if Input.trigger?(Input::C)
      case @command_window.index
      when @__command_set_battle_skill_index  # ???設定
        call_set_battle_skill_flag = true
      end
    end

    # ???設定?面?移行
    if call_set_battle_skill_flag
      if $game_party.members.size == 0
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      start_actor_selection
      return
    end

    update_command_selection_KGC_SkillCPSystem
  end
  #--------------------------------------------------------------------------
  # ● ????選??更新
  #--------------------------------------------------------------------------
  alias update_actor_selection_KGC_SkillCPSystem update_actor_selection
  def update_actor_selection
    if Input.trigger?(Input::C)
      $game_party.last_actor_index = @status_window.index
      Sound.play_decision
      case @command_window.index
      when @__command_set_battle_skill_index  # ???設定
        $scene = Scene_SetBattleSkill.new(
          @status_window.index,
          @__command_set_battle_skill_index,
          Scene_SetBattleSkill::HOST_MENU)
        return
      end
    end

    update_actor_selection_KGC_SkillCPSystem
  end
end

#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

#==============================================================================
# □ Scene_SetBattleSkill
#------------------------------------------------------------------------------
#   ?????設定?面??理?行??????。
#==============================================================================

class Scene_SetBattleSkill < Scene_Base
  #--------------------------------------------------------------------------
  # ○ 定?
  #--------------------------------------------------------------------------
  HOST_MENU   = 0  # 呼?出?元 : ????
  HOST_MAP    = 1  # 呼?出?元 : ???
  #--------------------------------------------------------------------------
  # ● ??????初期化
  #     actor_index : ??????????
  #     menu_index  : ?????????初期位置
  #     host_scene  : 呼?出?元 (0..????  1..???)
  #--------------------------------------------------------------------------
  def initialize(actor_index = 0, menu_index = 0, host_scene = HOST_MENU)
    @actor_index = actor_index
    @menu_index = menu_index
    @host_scene = host_scene
  end
  #--------------------------------------------------------------------------
  # ● 開始?理
  #--------------------------------------------------------------------------
  def start
    super
    create_menu_background

    @actor = $game_party.members[@actor_index]
    create_windows
  end
  #--------------------------------------------------------------------------
  # ○ ?????作成
  #--------------------------------------------------------------------------
  def create_windows
    @help_window = Window_Help.new
    if $imported["HelpExtension"]
      @help_window.row_max = KGC::HelpExtension::ROW_MAX
    end

    dy = @help_window.height
    @status_window = Window_BattleSkillStatus.new(0, dy, @actor)

    dy += @status_window.height
    @slot_window = Window_BattleSkillSlot.new(
      0,
      dy,
      Graphics.width / 2,
      Graphics.height - dy,
      @actor)
    @slot_window.active = true
    @slot_window.help_window = @help_window

    @list_window = Window_BattleSkillList.new(
      Graphics.width - @slot_window.width,
      dy,
      Graphics.width - @slot_window.width,
      Graphics.height - dy,
      @actor)
    @list_window.help_window = @help_window
  end
  #--------------------------------------------------------------------------
  # ● 終了?理
  #--------------------------------------------------------------------------
  def terminate
    super
    dispose_menu_background
    @help_window.dispose
    @status_window.dispose
    @slot_window.dispose
    @list_window.dispose
  end
  #--------------------------------------------------------------------------
  # ○ 元??面???
  #--------------------------------------------------------------------------
  def return_scene
    case @host_scene
    when HOST_MENU
      $scene = Scene_Menu.new(@menu_index)
    when HOST_MAP
      $scene = Scene_Map.new
    end
  end
  #--------------------------------------------------------------------------
  # ● ????更新
  #--------------------------------------------------------------------------
  def update
    super
    update_menu_background
    update_window
    if @slot_window.active
      update_slot
    elsif @list_window.active
      update_list
    end
  end
  #--------------------------------------------------------------------------
  # ○ ?????更新
  #--------------------------------------------------------------------------
  def update_window
    @help_window.update
    @status_window.update
    @slot_window.update
    @list_window.update
  end
  #--------------------------------------------------------------------------
  # ○ ?????再描?
  #--------------------------------------------------------------------------
  def refresh_window
    @status_window.refresh
    @slot_window.refresh
    @list_window.refresh
  end
  #--------------------------------------------------------------------------
  # ○ 次???????面?切?替?
  #--------------------------------------------------------------------------
  def next_actor
    @actor_index += 1
    @actor_index %= $game_party.members.size
    $scene = Scene_SetBattleSkill.new(@actor_index, @menu_index, @host_scene)
  end
  #--------------------------------------------------------------------------
  # ○ 前???????面?切?替?
  #--------------------------------------------------------------------------
  def prev_actor
    @actor_index += $game_party.members.size - 1
    @actor_index %= $game_party.members.size
    $scene = Scene_SetBattleSkill.new(@actor_index, @menu_index, @host_scene)
  end
  #--------------------------------------------------------------------------
  # ○ ????更新 (????????????????場合)
  #--------------------------------------------------------------------------
  def update_slot
    # 選?項目??化??場合
    if @last_slot_index != @slot_window.index
      @list_window.slot_index = @slot_window.index
      @list_window.refresh
      @last_slot_index = @slot_window.index
    end

    if Input.trigger?(Input::A)
      Sound.play_decision
      # 選?????????外?
      @actor.remove_battle_skill(@slot_window.index)
      refresh_window
    elsif Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    elsif Input.trigger?(Input::C)
      Sound.play_decision
      # ?????????切?替?
      @slot_window.active = false
      @list_window.active = true
    elsif Input.trigger?(Input::R)
      Sound.play_cursor
      next_actor
    elsif Input.trigger?(Input:)
      Sound.play_cursor
      prev_actor
    end
  end
  #--------------------------------------------------------------------------
  # ○ ????更新 (???????????????場合)
  #--------------------------------------------------------------------------
  def update_list
    if Input.trigger?(Input::B)
      Sound.play_cancel
      # ??????????切?替?
      @slot_window.active = true
      @list_window.active = false
    elsif Input.trigger?(Input::C)
      skill = @list_window.skill
      # ???????場合
      unless @actor.battle_skill_settable?(@slot_window.index, skill)
        Sound.play_buzzer
        return
      end
      Sound.play_decision
      set_skill(@slot_window.index, skill)
      # ??????????切?替?
      @slot_window.active = true
      @list_window.active = false
    end
  end
  #--------------------------------------------------------------------------
  # ○ ???設定
  #     index : 設定??場所
  #     skill : 設定?????
  #--------------------------------------------------------------------------
  def set_skill(index, skill)
    @actor.remove_battle_skill(index)
    if skill != nil
      @actor.set_battle_skill(index, skill)
    end
    refresh_window
  end
end
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|幻想森林

GMT+8, 2024-5-15 20:50 , Processed in 0.044425 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表