◆◇◆◇◆ エタメモ風CTBスクリプトVX ver 1.10 ◇◆◇◆◇ # サポート掲示板 http://www2.ezbbs.net/21/minto-aaa/ # by みんと =begin ■ 更新履歴 ○ ver 1.10(2012/09/27) 戦闘終了で解除されるステート状態のまま 戦闘が終わると落ちるミスを修正 ○ ver 1.09(2012/09/15) 制約で行動できない状況でも、 スキルが発動するミスを修正 ○ ver 1.08(2011/09/03) 自然解除が実行されないミスを修正 ○ ver 1.07(2011/09/03) 全体スキル選択で落ちるミスを修正 ○ ver 1.06(2011/09/03) ターゲットが固定されるミスを修正 ○ ver 1.05(2011/09/03) エネミーがスキルを使うと落ちるミスを修正 ○ ver 1.04(2011/09/03) イニシアティブが同じだと落ちるミスを修正 ○ ver 1.03(2011/09/03) 機構の入れ忘れを修正 ○ ver 1.02(2011/09/03) 細かい挙動を修正 ○ ver 1.01(2011/09/03) 行動速度の表示をこっそり追加 ○ ver 1.00(2011/09/03) 公開 ■ 説明 エターナルメモリー風の(?)CTBスクリプトです。 ゲージが溜まっていき、溜まった人から行動するのではなく、 カウントが溜まった人から次々に行動します。 この「カウント」が溜まるまでの演出は省略されるので、 いわゆるATBとは違い、すぐに次の人の行動になります。 ● 行動の概念 各キャラクターに行動速度(spd)と言うパラメータが追加されます。 この行動速度分カウントしていき、100になった人から行動します。 すなわち、行動速度が10の人と20の人がいた場合、 20の人は10の人が行動するまでに2回行動できるということを意味します。 行動したらカウントは行動別にマイナスされ、 100以上だった場合は、あまりを次のカウントに持ち越します。 行動速度の設定はアクターの場合はソース下記を参照してください。 エネミーの場合はメモ欄を使用します。 例 SPD6 この様に記載された場合、行動速度は6になります。 省略した場合は6になります。 ※ 注意点 カウントが100になった人から行動するので、 極端に高い数値は推奨できません。 高くても20台前半程度にしておきましょう。 ○消費するCTカウント 防御 50 何もしない 25 それ以外 100 ● 行動速度が変動するステート 各ステートには行動速度が変動する倍率を設定できます。 設定にはメモ欄を使用します。 例 SPD130 この様に記載された場合、行動速度は1.3倍になります。 省略した場合は変動値はありません。 ● 詠唱の概念 各スキルには詠唱値を設定できます。 設定にはメモ欄を使います。 例 SPD20 この様に記載された場合、詠唱値は20になります。 概念は行動速度と同じで、100になるまで数値分カウントしていき、 100になったら発動します。 省略した場合は100になります。 強力なスキルほど低めの数値にするといいでしょう。 ● 詠唱速度が変動するステート 各ステートには詠唱速度が変動するオプションが設定できます。 設定にはステート名を以下の名前にします。 ショートチャージ ・詠唱が半分になります。 ノンチャージ ・詠唱が0になります。 ● スキルの反動 各スキルには消費するCT、すなわち反動が設定できます。 設定にはメモ欄を使用します。 例 WAI20 この様に記載された場合、20になります。 この数値分スキル実行後にマイナスされるので、 威力は低いが次の行動にすぐ移れるスキルなどが作れます。 省略した場合は100になります。 ● スキルのオプション 各スキルにはメモ欄に以下の記述を記載する事で、 特別なオプションが設定できます。 CTチャージ ・CTを100にして即行動可能にする。 詠唱中の場合は即発動する。 (対象よりも行動速度が高く、カウントが100の場合はそちらが優先) 連続行動 ・設定値分連続で行動する。 連続行動8なら8回連続行動になる。 (強制的に設定値分連続で行動できる) ● スキルの発動ターンの確認 スキル選択中にAキーを押す事で発動ターンを確認できます。 ● ターンの概念 存在するアクター、エネミーの総数分の行動が行われたら1ターン経過します。 すなわち、アクター2人、エネミー1体の場合、 3回行動が経過したら1ターン経過します。 ● オプション「ターン内先制」 武器のオプションにターン内先制がある場合、 1ターンに一度、CTを100にして即行動できるようにします。 ターンが切り替わる度に、エフェクトは一回だけ発動します。 ● 仕様 行動予測は全員が「通常攻撃」を行った場合のものです。 詠唱や防御などで予測は変動します。 行動速度の最小値は3、最大値は50です。 =end #============================================================================== # ☆ MINTO #------------------------------------------------------------------------------ # 様々なフラグを扱うメインモジュールです。 #============================================================================== module MINTO # エタメモ風CTBスクリプトVXを有効化 ( true で有効 / false で無効 ) RGSS["エタメモ風CTBスクリプトVX"] = true Alphabets = [ "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", ",", " "] Alphabet_Size = [ 12, 12, 12, 13, 12, 11, 13, 15, 7, 9, 13, 11, 17, 14, 13, 11, 13, 13, 10, 11, 14, 12, 18, 13, 12, 11, 9, 10, 8, 10, 9, 6, 9, 11, 5, 6, 10, 5, 16, 11, 10, 10, 10, 7, 8, 6, 11, 9, 13, 13, 9, 9, 8, 5] end # エタメモ風CTBスクリプトVXが有効な場合に以降の処理を実行する if MINTO::RGSS["エタメモ風CTBスクリプトVX"] == true then #============================================================================== # ☆ カスタマイズ #------------------------------------------------------------------------------ # 機能のカスタマイズをここで行います。 #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ● 基本行動速度の取得 #-------------------------------------------------------------------------- def base_spd # クラスIDに応じて分岐 case @class_id # クラスID 1 when 1 # 基本行動速度を設定 spd = 50 # クラスID 2 when 2 # 基本行動速度を設定 spd = 50 # それ以外のクラス else # 基本行動速度を設定 spd = 50 end # メソッドを返す return spd + self.plus_spd end #-------------------------------------------------------------------------- # ● 成長行動速度の取得 # 設定値 × レベル 分、基本行動速度にプラスされます(小数点以下無視) #-------------------------------------------------------------------------- def plus_spd # クラスIDに応じて分岐 case @class_id # クラスID 1 when 1 # 成長行動速度を設定 spd = 0.10 # クラスID 2 when 2 # 成長行動速度を設定 spd = 0.10 # それ以外のクラス else # 成長行動速度を設定 spd = 0.10 end # メソッドを返す return (spd * self.level).to_i end end #============================================================================== # ■ Object #------------------------------------------------------------------------------ #  全てのクラスのスーパークラス。オブジェクトの一般的な振舞いを定義します。 #============================================================================== class Object #-------------------------------------------------------------------------- # ● 深い複製の作成 #-------------------------------------------------------------------------- def dec # Marshalモジュールを経由して、完全な複製を作成 return Marshal.load(Marshal.dump(self)) end end #============================================================================== # ■ Bitmap #------------------------------------------------------------------------------ #  画像そのものを扱う組み込みクラスです。 #============================================================================== class Bitmap #-------------------------------------------------------------------------- # ● キーアイコンの描写 # x : 描写先 X 座標 # y : 描写先 Y 座標 # key : 描写キー #-------------------------------------------------------------------------- def draw_key2(x, y, key) # キーアイコンを読み込む icon = Cache.picture("Keys") # キーに応じて分岐 case key when "A" then rect = Rect.new(24 * 0, 24 * 0, 24, 24) when "B" then rect = Rect.new(24 * 1, 24 * 0, 24, 24) when "C" then rect = Rect.new(24 * 2, 24 * 0, 24, 24) when "X" then rect = Rect.new(24 * 0, 24 * 1, 24, 24) when "Y" then rect = Rect.new(24 * 1, 24 * 1, 24, 24) when "Z" then rect = Rect.new(24 * 2, 24 * 1, 24, 24) when "L" then rect = Rect.new(24 * 0, 24 * 2, 24, 24) when "R" then rect = Rect.new(24 * 1, 24 * 2, 24, 24) end # キーボード表記の場合 # 転送座標をずらす rect.x += 24 * 3 # 描写範囲を消す self.rect_clear(x, y, 24, 24) # アイコンを描写 self.blt(x, y, icon, rect) end #-------------------------------------------------------------------------- # ● 指定範囲のクリア #-------------------------------------------------------------------------- def rect_clear(x, y, width, height) # 対象の範囲を消す rect = Rect.new(x, y, width, height) self.fill_rect(rect, Color.new(0, 0, 0, 0)) end end #============================================================================== # ■ Numeric #------------------------------------------------------------------------------ #  数値全般を扱う組み込みクラスです。 #============================================================================== class Numeric #-------------------------------------------------------------------------- # ● 最大値の設定 # max : 求められた最大の数値 #-------------------------------------------------------------------------- def to_max(min, max) if self > max return max elsif self < min return min else return self end end #-------------------------------------------------------------------------- # ● 最大値の設定 # max : 求められた最大の数値 #-------------------------------------------------------------------------- def to_m(max) if self > max return max else return self end end #-------------------------------------------------------------------------- # ● 最小値の設定 # min : 求められた最小の数値 #-------------------------------------------------------------------------- def to_min(min) if self < min return min else return self end end end #============================================================================== # ■ RPG::Skill #------------------------------------------------------------------------------ #  スキルのデータクラスです。 # $data_skillsとして参照されます。 #============================================================================== module RPG class Skill < UsableItem #-------------------------------------------------------------------------- # ● CTチャージ判定の取得 #-------------------------------------------------------------------------- def charge? return self.note.include?("CTチャージ") end #-------------------------------------------------------------------------- # ● 連続行動判定の取得 #-------------------------------------------------------------------------- def multi_attack return self.note.split(/\連続行動/)[1].to_i end #-------------------------------------------------------------------------- # ● 詠唱値の取得 #-------------------------------------------------------------------------- def spell spd = self.note.split(/SPD/)[1].to_i if spd.zero? spd = 100 end return spd end #-------------------------------------------------------------------------- # ● 消費CTの取得 #-------------------------------------------------------------------------- def wait wait = self.note.split(/WAI/)[1].to_i if wait.zero? wait = 100 end return wait end end end #============================================================================== # ☆ Data_States #============================================================================== module Data_States #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def self.initialize(in_battle = false) if in_battle data_states = load_data("Data/BT_States.rvdata") else data_states = load_data("Data/States.rvdata") end @name = [""] for state in data_states next if state == nil @name.push(state.name) end end #-------------------------------------------------------------------------- # ● ステートネーム #-------------------------------------------------------------------------- def self.name return @name end end #============================================================================== # ■ Game_Battler #------------------------------------------------------------------------------ #  バトラーを扱うクラスです。このクラスは Game_Actor クラスと Game_Enemy クラ # スのスーパークラスとして使用されます。 #============================================================================== class Game_Battler #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :ct # 現在CT attr_accessor :at # 現在AT attr_accessor :ct2 # 計算用CT attr_accessor :at2 # 計算用AT attr_accessor :initiative # 行動優先度 attr_accessor :action_skill # 保存用のスキル #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias mint_ctb_initialize initialize def initialize # 元の処理を実行 mint_ctb_initialize @ct = 0 @at = 0 @ct2 = 0 @at2 = 0 @initiative = 0 end #-------------------------------------------------------------------------- # ● CTの変更 #-------------------------------------------------------------------------- def ct=(n) @ct = n @ct = @ct.to_max(-1000, 1000) end #-------------------------------------------------------------------------- # ● 行動速度の取得 #-------------------------------------------------------------------------- def spd # ループ処理(ステート) for state in states do # 行動速度上昇値を取得 spd_rate = state.note.split(/SPD/)[1].to_i.to_min(0) # 数値未設定の場合 if spd_rate.zero? # 100として扱う spd_rate = 100 end # 行動速度上昇計算 @spd *= spd_rate @spd /= 100 end # メソッドを返す return @spd.to_max(3, 50) end #-------------------------------------------------------------------------- # ● コマンド入力可能判定 #-------------------------------------------------------------------------- alias mint_ctb_inputable? inputable? def inputable? # 元の処理を実行 bool = mint_ctb_inputable? # 先頭バトラー以外なら終了 if $scene.active_battlers[0] != self return false end # CTが100未満なら終了 if @ct < 100 return false end # 保存用のスキルがあるなら終了 unless @action_skill.nil? return false end # フラグを返す return bool end #-------------------------------------------------------------------------- # ● ステートの検査 #-------------------------------------------------------------------------- def state_include?(state) if state.is_a?(String) id = Data_States.name.index(state) else id = state end # 該当するステートが付加されていれば true を返す return self.states.include?(id) end #-------------------------------------------------------------------------- # ● スキルのクリア #-------------------------------------------------------------------------- def action_skillclear @at = 0 @action_skill = nil end end #============================================================================== # ■ Game_BattleAction #------------------------------------------------------------------------------ #  戦闘行動を扱うクラスです。このクラスは Game_Battler クラスの内部で使用され # ます。 #============================================================================== class Game_BattleAction #-------------------------------------------------------------------------- # ● アクションのクリア #-------------------------------------------------------------------------- def action_clear @kind = 0 @basic = -1 @skill_id = 0 @item_id = 0 end end #============================================================================== # ■ Game_Actor #------------------------------------------------------------------------------ #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors) # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。 #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :command_call # コマンド選択フラグ #-------------------------------------------------------------------------- # ● 所属判定の取得 #-------------------------------------------------------------------------- def belong # 制約が [味方を通常攻撃する] の場合 if self.restriction == 3 then # 識別信号を反転 return 1 end return 0 end #-------------------------------------------------------------------------- # ● 行動速度の取得 #-------------------------------------------------------------------------- def spd # 基本行動速度を取得 @spd = base_spd # スーパークラスの処理へ移行 super # メソッドを返す return @spd end end #============================================================================== # ■ Game_Enemy #------------------------------------------------------------------------------ #  敵キャラを扱うクラスです。このクラスは Game_Troop クラス ($game_troop) の # 内部で使用されます。 #============================================================================== class Game_Enemy < Game_Battler #-------------------------------------------------------------------------- # ● 所属判定の取得 #-------------------------------------------------------------------------- def belong # 制約が [味方を通常攻撃する] の場合 if self.restriction == 3 then # 識別信号を反転 return 0 end return 1 end #-------------------------------------------------------------------------- # ● 行動速度の取得 #-------------------------------------------------------------------------- def spd @spd = self.enemy.note.split(/SPD/)[1].to_i.to_min(6) # スーパークラスの処理へ移行 super # メソッドを返す return @spd end #-------------------------------------------------------------------------- # ● 戦闘行動の作成 #-------------------------------------------------------------------------- alias mint_ctb_make_action make_action def make_action # 先頭バトラー以外なら終了 #if $scene.active_battlers[0] != self # return #end # CTが100未満なら終了 if @ct < 100 return false end # 保存用のスキルがあるなら終了 unless @action_skill.nil? return end # 元の処理を実行 mint_ctb_make_action end end #============================================================================== # ■ Game_Troop #------------------------------------------------------------------------------ #  敵グループおよび戦闘に関するデータを扱うクラスです。バトルイベントの処理も # 行います。このクラスのインスタンスは $game_troop で参照されます。 #============================================================================== class Game_Troop < Game_Unit #-------------------------------------------------------------------------- # ● クリア #-------------------------------------------------------------------------- alias mint_ctb_clear clear def clear # 元の処理を実行 mint_ctb_clear # 総合カウントを初期化 @total_count = 0 end #-------------------------------------------------------------------------- # ● ターンの増加 #-------------------------------------------------------------------------- def increase_turn # 総合カウントを加算 @total_count += 1 # 総合カウントが存在するバトラーと並んだ場合 if @total_count >= exist_battlers # 総合カウントを初期化 @total_count = 0 # ターン増加 @turn_count += 1 # ターンの終了 $scene.turn_end # ループ処理(全メンバー) for battler in $game_party.members + self.members # 無効なバトラーの場合 if battler.nil? # 次へ next end # 戦闘中の場合 if $game_temp.in_battle == true # ステートの自然解除 $scene.remove_states_auto(battler) end end end end #-------------------------------------------------------------------------- # ● 存在するバトラーの取得 #-------------------------------------------------------------------------- def exist_battlers exist = 0 # ループ処理(全メンバー) for battler in $game_party.members + self.members # 無効なバトラーの場合 if battler.nil? # 次へ next end # バトラーが存在する場合 if battler.exist? # 存在カウント加算 exist += 1 end end # 存在カウントを返す return exist end end #============================================================================== # ■ Game_Interpreter #------------------------------------------------------------------------------ #  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、 # Game_Troop クラス、Game_Event クラスの内部で使用されます。 #============================================================================== class Game_Interpreter #-------------------------------------------------------------------------- # ● メンバーの入れ替え #-------------------------------------------------------------------------- def command_129 # 入れ替えを行うアクターを取得 actor = $game_actors[@params[0]] # アクターが存在する場合 unless actor.nil? # 加える場合 if @params[1].zero? # 初期化する場合 if @params[2] == 1 # アクターを初期化 $game_actors[@params[0]].setup(@params[0]) end # パーティーに加える $game_party.add_actor(@params[0]) # 外す場合 else # パーティーから除外 $game_party.remove_actor(@params[0]) end # 戦闘中の場合 if $game_temp.in_battle == true # メンバーを更新 $scene.member_update end # マップをリフレッシュ $game_map.need_refresh = true end # リザルトを返す return true end end #============================================================================== # ■ Spriteset_Battle #------------------------------------------------------------------------------ #  バトル画面のスプライトをまとめたクラスです。このクラスは Scene_Battle クラ # スの内部で使用されます。 #============================================================================== class Spriteset_Battle #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :viewport1 # エネミー側のビューポート end #============================================================================== # ■ Window_Base #------------------------------------------------------------------------------ #  ゲーム中のすべてのウィンドウのスーパークラスです。 #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # ● 能力値の描画 # actor : アクター # x : 描画先 X 座標 # y : 描画先 Y 座標 # type : 能力値の種類 (0〜3) #-------------------------------------------------------------------------- alias mint_ctb_draw_actor_parameter draw_actor_parameter def draw_actor_parameter(actor, x, y, type) # 最大Y座標設定 @max_y = y # 行動速度描写の場合 if type == 255 parameter_name = "行速" parameter_value = actor.spd self.contents.font.color = system_color self.contents.draw_text(x, y, 120, WLH, parameter_name) self.contents.font.color = normal_color self.contents.draw_text(x + 120, y, 36, WLH, parameter_value, 2) # それ以外のパラメータの場合 else # 元の処理を実行 mint_ctb_draw_actor_parameter(actor, x, y, type) end end end #============================================================================== # ■ Window_Status #------------------------------------------------------------------------------ #  ステータス画面で表示する、フル仕様のステータスウィンドウです。 #============================================================================== class Window_Status < Window_Base #-------------------------------------------------------------------------- # ● 能力値の描画 # x : 描画先 X 座標 # y : 描画先 Y 座標 #-------------------------------------------------------------------------- alias mint_ctb_draw_parameters draw_parameters def draw_parameters(x, y) # 最大Y座標初期化 @max_y = 0 # 元の処理を実行 mint_ctb_draw_parameters(x, y) # 行動速度を描写 draw_actor_parameter(@actor, x, @max_y + WLH, 255) end end #============================================================================== # ■ Window_Lvup_Data #------------------------------------------------------------------------------ # Lvup時のデータを表示するウィンドウです。 #============================================================================== class Window_Lvup_Data < Window_Base #-------------------------------------------------------------------------- # ● リフレッシュ # actor : アクター #-------------------------------------------------------------------------- def refresh(actor) x = 160 self.contents.clear # アクター名を描写 self.contents.font.color = normal_color self.contents.draw_text(x * 0, WLH * 0, 224, WLH, actor.name) # アクターグラフィックを描写 graphic_set(actor, 240, 0) # 用語を描写 self.contents.font.color = system_color self.contents.draw_text(x * 0, WLH * 1, 96, WLH, "Level") self.contents.draw_text(x * 0, WLH * 2, 96, WLH, Vocab.hp) self.contents.draw_text(x * 0, WLH * 3, 96, WLH, Vocab.mp) self.contents.draw_text(x * 0, WLH * 4, 96, WLH, Vocab.atk) self.contents.draw_text(x * 0, WLH * 5, 96, WLH, Vocab.def) self.contents.draw_text(x * 0, WLH * 6, 96, WLH, Vocab.spi) self.contents.draw_text(x * 0, WLH * 7, 96, WLH, Vocab.agi) self.contents.draw_text(x * 0, WLH * 8, 96, WLH, "行速") self.contents.font.color = normal_color # パラメータを描写 for i in 0...@data[actor].size do draw_status(actor, i) end end end #============================================================================== # ■ Window_Ct_Orders #------------------------------------------------------------------------------ # バトラーの行動順を表示するウィンドウです。 #============================================================================== class Window_Ct_Orders #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize @sprite = Sprite.new @sprite.x = 0 @sprite.y = 0 @sprite.z = 10 @sprite.opacity = 116 @sprite.visible = true @sprite.bitmap = Cache.picture("CT_Base") @sprite2 = @sprite.dup @sprite2.opacity = 255 @sprite2.z = 10 @sprite_base = Sprite.new @sprite_base.y = 16 @sprite_base.z = 11 @sprite_base.visible = true @sprite_base.bitmap = Bitmap.new(128, 288) refresh_base end #-------------------------------------------------------------------------- # ● アルファベットの描写 # x : 描写先 X 座標 # y : 描写先 Y 座標 # string : 描写する文字 # bitmap : 使用するビットマップ(Bitmap) #-------------------------------------------------------------------------- def draw_alphabet(x, y, string, bitmap, bit = "AlphabetsG2") # ピクチャーの読み込み picture = Cache.picture(bit) # 求められた数字を一文字ずつ配列にする array = string.split(//) # ループ処理(イテレータ) (0...array.size).each do |i| # 文字のインデックスを取得 index = MINTO::Alphabets.index(array[i]) # 描写座標を計算 draw_x = index % 20 * 32 draw_y = index / 20 * 24 # 描写座標を取得する rect = Rect.new(draw_x, draw_y, 32, 24) # 数字を描写 bitmap.blt(x, y, picture, rect) x += MINTO::Alphabet_Size[index] end end #-------------------------------------------------------------------------- # ● 文字色取得 # n : 文字色番号 (0〜7) #-------------------------------------------------------------------------- def text_color(n) case n when 0 return Color.new(255, 255, 255) when 1 return Color.new(100, 255, 255) when 2 return Color.new(250, 240, 200) when 3 return Color.new(100, 200, 255) when 4 return Color.new(255, 150, 0) when 5 return Color.new(255, 0, 0) when 6 return Color.new(150, 150, 255) when 7 return Color.new(155, 155, 155) when 8 return Color.new(255, 200, 0) end end #-------------------------------------------------------------------------- # ● 通常文字色の取得 #-------------------------------------------------------------------------- def normal_color return Color.new(255, 255, 255) end #-------------------------------------------------------------------------- # ● 無効文字色の取得 #-------------------------------------------------------------------------- def disabled_color return Color.new(200, 200, 200) end #-------------------------------------------------------------------------- # ● システム文字色の取得 #-------------------------------------------------------------------------- def system_color return Color.new(100, 255, 255) end #-------------------------------------------------------------------------- # ● 行動者の名前の描写 #-------------------------------------------------------------------------- def refresh_name(data, index) # 行動者の名前を描写 battler = data[index] # カラーIDを取得 c = battler.dup.split(//)[0].to_i text = " #{battler.split(/#{c}/)[1]}" #text = " #{battler}" y = 20 + (index * 32) width = 128 # スキル名の場合、発動者の名前も表示 if text.include?("/") @sprite_base.bitmap.font.color = system_color text = text.split(/\//)[0] name_text = battler.split(/\//)[1] @sprite_base.bitmap.font.size = 13 @sprite_base.bitmap.draw_text(4, y - 16, width, 32, name_text) @sprite_base.bitmap.font.size = 17 end @sprite_base.bitmap.font.color = text_color(c) @sprite_base.bitmap.draw_text(0, y, width - 4, 32, text, 2) end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh_base # 再描画開始 @sprite2.bitmap.clear @sprite2.bitmap.font.color = system_color @sprite2.bitmap.font.size = 22 @sprite2.bitmap.draw_key2(4, 4, "X") draw_alphabet(32, 4, "A,Turn", @sprite2.bitmap) @sprite2.bitmap.font.size = 18 width = @sprite.bitmap.width - 32 # 名前を頭から順に描写 #for id in 0...8 #@sprite2.bitmap.draw_text(16, 48 + (id * 32), 32, 32, "#{id + 1}") #end end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh(data) # 再描画開始 @sprite_base.bitmap.clear @sprite_base.bitmap.font.size = 17 # 行動者を描写 refresh_name(data, 0) refresh_name(data, 1) refresh_name(data, 2) refresh_name(data, 3) refresh_name(data, 4) refresh_name(data, 5) refresh_name(data, 6) refresh_name(data, 7) end #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- def dispose @sprite_base.bitmap.dispose @sprite_base.dispose @sprite_base = nil @sprite.bitmap.dispose @sprite.dispose @sprite = nil @sprite2.bitmap.dispose @sprite2.dispose @sprite2 = nil end #-------------------------------------------------------------------------- # ● 透明度の取得 #-------------------------------------------------------------------------- def visible return @sprite.visible end #-------------------------------------------------------------------------- # ● 透明度の変更 #-------------------------------------------------------------------------- def visible=(visible) @sprite.visible = visible if visible @sprite2.opacity = 255 else @sprite2.opacity = 160 end @sprite_base.visible = visible end end #============================================================================== # ■ Scene_Battle #------------------------------------------------------------------------------ #  バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :active_battler # アクティブバトラー attr_reader :action_battlers # アクションバトラーズ attr_reader :active_battlers # アクティブバトラーズ attr_reader :spriteset # スプライトセット #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- alias mint_ctb_start start def start # 関連データ初期化 @action_battlers = [] @active_battlers = [] @special_battle_effect = {} @last_name = [] # 元の処理を実行 mint_ctb_start # CTウィンドウを作成 @ct_window = Window_Ct_Orders.new # メンバーを作成 member_set # イニシアティブをリセット initiative_reset end #-------------------------------------------------------------------------- # ● 終了処理 #-------------------------------------------------------------------------- alias mint_ctb_terminate terminate def terminate # CTウィンドウを解放 @ct_window.dispose # 元の処理を実行 mint_ctb_terminate end #-------------------------------------------------------------------------- # ● 行動順序作成 #-------------------------------------------------------------------------- alias mint_ctb_make_action_orders make_action_orders def make_action_orders # メソッドを返す(元の処理を行わない) return end #-------------------------------------------------------------------------- # ● 次のアクターのコマンド入力へ #-------------------------------------------------------------------------- def next_actor # コマンド選択が可能な場合 if @active_battlers[0].command_call == true # アクターコマンドを選択不可能にする @active_battlers[0].command_call = false # 自動戦闘の場合 if @active_battlers[0].auto_battle # アクションを作成 @active_battlers[0].make_action # メソッドを返す return end # 戦闘のアクションバトラーをアクティブバトラーにする @active_battler = @action_battlers[0] # ステータスインデックスを設定 @status_window.index = @status_index # アクターコマンドの選択処理を開始 start_actor_command_selection # メソッドを返す return # コマンド選択が不可能な場合 else # メイン処理を開始する start_main # メソッドを返す return end end #-------------------------------------------------------------------------- # ● 前のアクターのコマンド入力へ #-------------------------------------------------------------------------- def prior_actor # アクターコマンドを選択可能にする @active_battlers[0].command_call = true # ステータスインデックスを設定 @status_window.index = @status_index # パーティーコマンドの選択を開始 start_party_command_selection # メソッドを返す return end #-------------------------------------------------------------------------- # ● 次に行動するべきバトラーの設定 # イベントコマンドで [戦闘行動の強制] が行われている時は # そのバトラーを設定して、それ以外はリストの先頭から取得する。 #-------------------------------------------------------------------------- def set_next_active_battler # アクションが強制されているバトラーが存在する場合 unless $game_troop.forcing_battler.nil? @active_battler = $game_troop.forcing_battler $game_troop.forcing_battler = nil else # 先頭のアクションバトラーをアクティブバトラーにする @active_battler = @action_battlers.shift end end #-------------------------------------------------------------------------- # ● 行動可能バトラー存在判定 #-------------------------------------------------------------------------- def active_battlers_empty? bool = false # ループ処理(メンバー) for battler in @member bool |= battler.inputable? end # メソッドを返す return bool end #-------------------------------------------------------------------------- # ● スキル選択の更新 #-------------------------------------------------------------------------- alias mint_ctb_update_skill_selection update_skill_selection def update_skill_selection # X ボタンが押された場合 if Input.trigger?(Input::X) # スキルウィンドウで現在選択されているデータを取得 skill = @skill_window.skill if skill @active_battler.at = skill.spell @active_battler.action_skill = skill # ノンチャージの場合 name = nil if @active_battler.at >= 100 or @active_battler.state_include?("ノンチャージ") name = "0" + skill.name + "/#{@active_battler.name}" end data = ct_orders2(name, @active_battler, skill.wait) @active_battler.action_skillclear # CTウィンドウをリフレッシュ @ct_window.refresh(data) end end # 保存用のスキルをクリア @active_battler.action_skillclear # 元の処理を実行 mint_ctb_update_skill_selection # B ボタンが押された場合 if Input.trigger?(Input::B) # CTウィンドウをリフレッシュ @ct_window.refresh(ct_orders) end # X ボタンが押された場合 if Input.trigger?(Input::X) # スキル選択の終了 Sound.play_cancel end_skill_selection # 行動順ウィンドウの表示を反転 @ct_window.visible = (not @ct_window.visible) end end #-------------------------------------------------------------------------- # ● スキルの決定 #-------------------------------------------------------------------------- alias mint_ctb_determine_skill determine_skill def determine_skill # スキルを設定 call_determine_skill(@active_battler, @skill) # 元の処理を実行 mint_ctb_determine_skill end #-------------------------------------------------------------------------- # ● スキルの決定処理 # battler : 対象者 # skill : スキル #-------------------------------------------------------------------------- def call_determine_skill(battler, skill) # スキル情報を保存 battler.action_skill = skill.dec # 初期AT加算 battler.at = battler.action_skill.spell name = nil # ノンチャージの場合 if battler.at >= 100 or battler.state_include?("ノンチャージ") name = "0" + battler.action_skill.name + "/#{battler.name}" # ATを100にする battler.at = 100 end data = ct_orders2(name, battler, battler.action_skill.wait) # CTウィンドウをリフレッシュ @ct_window.refresh(data) end #-------------------------------------------------------------------------- # ● 戦闘処理の実行開始 #-------------------------------------------------------------------------- def start_main @info_viewport.visible = false @info_viewport.ox = 0 @message_window.visible = true @party_command_window.active = false @actor_command_window.active = false @status_window.index = @actor_index = -1 @active_battler = nil @message_window.clear $game_troop.make_actions make_action_orders wait(20) end #-------------------------------------------------------------------------- # ● 戦闘行動の処理 #-------------------------------------------------------------------------- alias mint_ctb_process_action process_action def process_action # 未行動バトラーが存在しない場合 (全員行動した) if @action_battlers.empty? # バトルイベント実行中でない場合 unless $game_troop.interpreter.running? # 先頭のバトラーを削除 @active_battlers[0] = nil @active_battlers.compact! end # 最終ネームをクリア @last_name = [] # CTウィンドウをリフレッシュ @ct_window.refresh(ct_orders) # CTをカウント ct_count return end # 元の処理を実行 mint_ctb_process_action end #-------------------------------------------------------------------------- # ● 戦闘行動の実行 #-------------------------------------------------------------------------- alias mint_ctb_execute_action execute_action def execute_action # アクティブバトラーがエネミーの場合 unless @active_battler.actor? # スキル攻撃の場合 if @active_battler.action.kind == 1 # スキル未取得の場合 if @active_battler.action_skill.nil? # スキルを設定 call_determine_skill(@active_battler, @active_battler.action.skill) end end end # 元の処理を実行 mint_ctb_execute_action # スキル以外の場合 if @active_battler.action.kind != 1 # アクティブバトラーのCTを減算 ct_consumption(@active_battler, @active_battler.action.kind) end end #-------------------------------------------------------------------------- # ● 戦闘行動の実行 : スキル #-------------------------------------------------------------------------- alias mint_ctb_execute_action_skill execute_action_skill def execute_action_skill # ATが溜まっていない場合 if @active_battler.at.between?(1, 99) # 行動を何もしないに変更 @active_battler.action.action_clear # メソッドを返す return end # スキルが無効な場合(エネミー用) if @skill.nil? # スキルを再設定 @skill = @active_battler.action_skill end # 制約などで、スキルを使用する事が出来ない場合 unless @active_battler.skill_can_use?(@skill) # 行動を何もしないに変更 @active_battler.action.action_clear # メソッドを返す return end # CTチャージスキルの場合 if @skill.charge? # ループ処理(ターゲット) for target in @active_battler.action.make_targets # CTが100未満の場合 if target.ct <= 99 # CTをチャージ target.ct = 100 end # ATが100未満の場合 if target.at >= 1 # ATをチャージ target.at = 100 end end end # 連続行動スキルの場合 if @skill.multi_attack >= 1 # ループ処理(ターゲット) for target in @active_battler.action.make_targets # CTをチャージ target.ct = @skill.multi_attack * 100 # アクティブバトラーズの先頭に追加 @skill.multi_attack.times do @active_battlers.unshift(target) end # ATが100未満の場合 if target.at >= 1 # ATをチャージ target.at = 100 end end end # アクティブバトラーのCTを減算 ct_consumption(@active_battler, @active_battler.action.kind) # 元の処理を実行 mint_ctb_execute_action_skill end #-------------------------------------------------------------------------- # ● CTの減算 # battler : 対象者 # kind : 行動 #-------------------------------------------------------------------------- def ct_consumption(battler, kind) # 特殊通常攻撃スクリプトが有効な場合 if MINTO::RGSS["特殊通常攻撃スクリプト"] == true # 特殊通常攻撃発動中の場合 unless @special_attack_skill[battler].nil? # 攻撃回数が残っている場合 if @special_attack_skill[battler].attack_bonus >= 1 # メソッドを返す return end end end # 何らかのスキルをチャージ中の場合 if battler.at >= 1 and battler.at <= 99 # メソッドを返す return end $game_troop.increase_turn case kind # 基本行動 when 0 case battler.action.basic # 攻撃 when 0 # CTからマイナス100 battler.ct -= 100 # 防御 when 1 # CTからマイナス50 battler.ct -= 50 # 逃走 when 2 # CTからマイナス100 battler.ct -= 100 # 待機 when 3 # CTからマイナス25 battler.ct -= 25 end # スキル when 1 # CTからスキルの設定値分 battler.ct -= battler.action_skill.wait # 保存用のスキル情報をクリア battler.action_skillclear # アイテム when 2 # CTからマイナス100 battler.ct -= 100 end end #-------------------------------------------------------------------------- # ● ステート自然解除 # battler : 対象者 #-------------------------------------------------------------------------- def remove_states_auto(battler = @active_battler) # 最終ステートを保存 last_st = battler.states # ステートの自然解除 battler.remove_states_auto # ステートが更新された場合 if battler.states != last_st # 解除メッセージ表示 wait(5) display_state_changes(battler) wait(30) @message_window.clear end end #-------------------------------------------------------------------------- # ● ターン終了 #-------------------------------------------------------------------------- def turn_end # ターン終了フラグをオンにする $game_troop.turn_ending = true # スリップダメージの更新 $game_party.slip_damage_effect $game_troop.slip_damage_effect # HPの自然回復の更新 $game_party.do_auto_recovery # 先制攻撃フラグを解除 $game_troop.preemptive = false # 不意打ちフラグを解除 $game_troop.surprise = false # バトルイベントの更新 process_battle_event # ターン終了フラグをオフにする $game_troop.turn_ending = false #start_party_command_selection end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- alias mint_ctb_update update def update # 元の処理を実行 mint_ctb_update # X ボタンが押された場合 if @skill_window == nil and Input.trigger?(Input::X) # 行動順ウィンドウの表示を反転 @ct_window.visible = (not @ct_window.visible) return end end #-------------------------------------------------------------------------- # ● メンバー作成 #-------------------------------------------------------------------------- def member_set # メンバー用の配列を初期化 @member = $game_party.members + $game_troop.members # 全メンバーを並べて順番に処理する for battler in @member # メンバーの行動速度と # 素早さ分の乱数を足した値をイニシアティブに代入 battler.initiative = battler.spd + rand(battler.agi) end # メンバーを行動速度が高い順に、 # 同じ場合はイニシアティブが高い順に、 # それも同じなら管理ID順に並び替え @member.sort! do |a, b| if a.spd > b.spd -1 elsif a.spd < b.spd +1 elsif a.initiative > b.initiative -1 elsif a.initiative < b.initiative +1 else 0 end end @member.uniq! end #-------------------------------------------------------------------------- # ● メンバーの更新 #-------------------------------------------------------------------------- def member_update # ステータスウィンドウをリフレッシュ @status_window.refresh # メンバーを統合 @member = $game_party.members + $game_troop.members # イニシアティブをリセット initiative_reset # メンバーを行動速度が高い順に、 # 同じ場合はイニシアティブが高い順に、 # それも同じなら管理ID順に並び替え @member.sort! do |a, b| if a.spd > b.spd -1 elsif a.spd < b.spd +1 elsif a.initiative > b.initiative -1 elsif a.initiative < b.initiative +1 else 0 end end @member.uniq! end #-------------------------------------------------------------------------- # ● イニシアティブ・リセット #-------------------------------------------------------------------------- def initiative_reset # 全メンバーの行動カウントを初期化する for battler in @member battler.ct = 0 battler.ct2 = 0 battler.at = 0 battler.at2 = 0 # メンバーの行動速度と # 素早さ分の乱数を足した値をイニシアティブに代入 battler.initiative = battler.spd + rand(battler.agi) # アクションをクリア battler.action.clear battler.action_skillclear end # アクティブバトラーズを初期化 @active_battlers = [] # アクションバトラーズを初期化 @action_battlers = [] end #-------------------------------------------------------------------------- # ● スキルセット #-------------------------------------------------------------------------- def skill_set(battler) # アクティブバトラーにシフト @active_battler = battler # 動けない場合 unless @active_battler.movable? # チャージ中を解除 #battler.remove_state("チャージ中") # アクションを変更 battler.action.clear battler.at2 = 0 # メインフェーズ開始 process_action return end # アクションをスキルに設定 battler.action.set_skill(battler.action_skill.id) # メインフェーズ開始 process_action end #-------------------------------------------------------------------------- # ● 行動者を決定 #-------------------------------------------------------------------------- def set_action_battler # ステータスウィンドウをリフレッシュ @status_window.refresh # 先頭のバトラーが制約などで行動不能の場合 if (not @active_battlers[0].exist? or not @active_battlers[0].movable?) # CTを初期化 @active_battlers[0].ct = 0 @active_battlers[0].at = 0 @active_battlers[0].ct2 = 0 @active_battlers[0].at2 = 0 @active_battlers[0].action_skillclear # 先頭のバトラーを削除 @active_battlers[0] = nil @active_battlers.compact! #ct_count return end @active_battler = @active_battlers[0] # 行動者決定 case @active_battlers[0] # アクターの場合 when Game_Actor # アクションバトラーにプッシュ @action_battlers.push(@active_battlers[0]) # ATが100の場合 if @active_battlers[0].at >= 100 and not @active_battlers[0].action_skill.nil? # スキルを実行 skill_set(@active_battlers[0]) # それ以外の場合 else @active_battlers[0].at = 0 @active_battlers[0].at2 = 0 @active_battlers[0].action_skillclear #@active_battlers[0].slip_ng = false # バトルイベント実行中でなければ unless $game_troop.interpreter.running? # ATをクリア @active_battlers[0].action_skillclear # アクターコマンド呼び出し準備 @info_viewport.visible = true @message_window.visible = false # アクターコマンドを選択不可能にする @active_battlers[0].command_call = false # ステータスインデックスを設定 @status_window.index = @active_battlers[0].index @status_index = @status_window.index # アクターコマンド選択開始 start_actor_command_selection end end # エネミーの場合 when Game_Enemy # アクションバトラーにプッシュ @action_battlers.push(@active_battlers[0]) # ATが100の場合 if @active_battlers[0].at >= 100 and not @active_battlers[0].action_skill.nil? # スキルを実行 skill_set(@active_battlers[0]) # それ以外ならメインフェーズ開始 else @active_battlers[0].at = 0 @active_battlers[0].at2 = 0 @active_battlers[0].action_skillclear #@active_battlers[0].slip_ng = false # バトルイベント実行中でなければ unless $game_troop.interpreter.running? # ATをクリア @active_battlers[0].action_skillclear # アクションを作成 @active_battlers[0].make_action # メインフェーズ開始 process_action end end end end #-------------------------------------------------------------------------- # ● CTカウント #-------------------------------------------------------------------------- def ct_count # クロック数 clock = 0 # 再描写フラグ refresh = false # アクションバトラーを初期化 @action_battlers.clear # ターン内先制の処理 for battler in $game_party.members # ターン内先制の場合 if battler.fast_attack # まだ先制していないターンの場合 unless @special_battle_effect[$game_troop.turn_count] # 初期CTを100にする battler.ct = 100 # 再描写を行う refresh = true end end end # 初期先制フラグをオンにする @special_battle_effect[$game_troop.turn_count] = true # 味方の先制攻撃の場合 if $game_troop.preemptive and not @preemptive # アクター側の処理 for battler in $game_party.members # 初期CTを100にする battler.ct = 100 end # 再描写を行う refresh = true # フラグをクリア @preemptive = true # 敵の不意打ちの場合 elsif $game_troop.surprise and not @surprise # エネミー側の処理 for battler in $game_troop.members # 初期CTを100にする battler.ct = 100 end # 再描写を行う refresh = true # フラグをクリア @surprise = true end # 先頭の行動者が返るまで繰り返す while @active_battlers[0] == nil # クロック数を加算 clock += 1 # CT加算処理開始 for battler in @member # ATがない場合 if battler.at == 0 # CTが100未満の場合 if battler.ct <= 99 # CTにSPDを加算(戦闘不能か動けない場合は終了) if battler.exist? and battler.movable? battler.ct += battler.spd end # CTが100以上の場合 else # アクティブバトラーズにプッシュ(戦闘不能の場合は終了) if battler.exist? @active_battlers.push(battler) else # CTを初期化 battler.ct = 0 end end # スキルの場合 else # ATが100未満の場合 if battler.at <= 99 # ATにスキルの詠唱値を加算(戦闘不能か動けない場合は終了) if battler.exist? and battler.movable? # ショートチャージならチャージタイムを半分に if battler.state_include?("ショートチャージ") battler.at += battler.action_skill.spell * 2 else battler.at += battler.action_skill.spell end else # ATを0に設定 battler.at = 0 end # ATが100以上の場合 else # アクティブバトラーズにプッシュ(戦闘不能の場合は終了) if battler.exist? @active_battlers.push(battler) else # ATを0に設定 battler.at = 0 end end end end end # 再描写を行う場合 if refresh @last_name.clear # CTウィンドウをリフレッシュ @ct_window.refresh(ct_orders) end # 先頭のバトラーを行動させる set_action_battler # 極端な処理落ちを防止する Graphics.frame_reset end #-------------------------------------------------------------------------- # ● 描写用の行動順を作成(本体) #-------------------------------------------------------------------------- def ct_orders_base # クロック数 clock = 0 # 配列の要素が8つになるまで繰り返す while @battlers_name[7] == nil # クロック数を加算 clock += 1 # CT2加算処理開始 for battler in @member # AT2がない場合 if battler.at2 == 0 # CT2が100未満の場合 if battler.ct2 <= 99 # CTにSPDを加算(戦闘不能か動けない場合は終了) if battler.exist? and battler.movable? battler.ct2 += battler.spd end # CT2が100以上の場合 else # バトラーの名前をプッシュ(戦闘不能の場合は終了) if battler.exist? # バトラーの所属に応じて分岐 case battler.belong # アクター when 0 then # バトラー名をプッシュ @battlers_name.push("3" + battler.name) # エネミー else # バトラー名をプッシュ @battlers_name.push("4" + battler.name) end # CT2を初期化 battler.ct2 -= 100 else # CT2を初期化 battler.ct2 = 0 end end # スキルの場合 else # AT2が100未満の場合 if battler.at2 <= 99 # ATにスキルの詠唱値を加算(戦闘不能か動けない場合は終了) if battler.exist? and battler.movable? # ショートチャージならチャージタイムを半分に if battler.state_include?("ショートチャージ") battler.at2 += battler.action_skill.spell * 2 else battler.at2 += battler.action_skill.spell end else # AT2を0に設定 battler.at2 = 0 end # AT2が100以上の場合 else # スキルの名前をプッシュ(戦闘不能の場合は終了) if battler.exist? # バトラーの所属に応じて分岐 case battler.belong # アクター when 0 # スキル名とバトラー名をプッシュ @battlers_name.push("3" + battler.action_skill.name + "/#{battler.name}") # エネミー else # スキル名とバトラー名をプッシュ @battlers_name.push("4" + battler.action_skill.name + "/#{battler.name}") end # CT2を初期化 battler.ct2 -= battler.action_skill.wait # AT2を初期化 battler.at2 = 0 else # AT2を初期化 battler.at2 = 0 # CT2を初期化 battler.ct2 = 0 end end end end end end #-------------------------------------------------------------------------- # ● 描写用の行動順を作成(ループ) #-------------------------------------------------------------------------- def ct_orders # 行動者配列を初期化 @battlers_name = [] # 最終ネームの要素が存在すればそれを返す return @last_name if @last_name.size > 0 # メンバー順にCTとATの現在値を代入 for battler in @member # CT2とAT2にCTとATを代入 battler.ct2 = battler.ct.to_i battler.at2 = battler.at.to_i end # 行動が予約されているバトラーがある場合 if @active_battlers[0] != nil # 予約されているバトラー順に処理 for battler in @active_battlers # バトラーが存在しない場合 if not battler.exist? # 次の処理へ移行 next end # 詠唱中でない場合 if battler.at2 == 0 # バトラーの所属に応じて分岐 case battler.belong # アクター when 0 then # バトラー名をプッシュ @battlers_name.push("3" + battler.name) # エネミー else # バトラー名をプッシュ @battlers_name.push("4" + battler.name) end # CT2を初期化 battler.ct2 -= 100 # 詠唱中の場合 elsif battler.at2 >= 100 # バトラーの所属に応じて分岐 case battler.belong # アクター when 0 # スキル名とバトラー名をプッシュ @battlers_name.push("3" + battler.action_skill.name + "/#{battler.name}") # エネミー else # スキル名とバトラー名をプッシュ @battlers_name.push("4" + battler.action_skill.name + "/#{battler.name}") end # CT2を初期化 battler.ct2 -= battler.action_skill.wait.to_i # AT2を初期化 battler.at2 = 0 end end end # 8回先まで行動順序を計算 ct_orders_base # 最終ネームを保存 @last_name = @battlers_name.dup # 極端な処理落ちを防止する Graphics.frame_reset # 配列を返す return @battlers_name end #-------------------------------------------------------------------------- # ● 描写用の行動順を作成(ループ) # name : 先行スキルネーム(ノンチャージ用) # active_battler : 現在のバトラー #-------------------------------------------------------------------------- def ct_orders2(name, active_battler, wait) # 行動者配列を初期化 @battlers_name = name != nil ? name.to_a : [] # メンバー順にCTとATの現在値を代入 for battler in @member # CT2とAT2にCTとATを代入 battler.ct2 = battler.ct.to_i battler.at2 = battler.at.to_i # 先行スキルネームが存在し、 # 且つバトラーとアクティブバトラーが等しい場合 if name != nil and battler == active_battler # AT2を初期化 battler.at2 = 0 battler.ct2 -= battler.action_skill.wait end end # 行動が予約されているバトラーがある場合 if @active_battlers[0] != nil index = 0 # 予約されているバトラー順に処理 for battler in @active_battlers index += 1 # バトラーとアクティブバトラーが等しい場合 if battler == active_battler and index == 1 # 次の処理へ移行 next # バトラーが存在しない場合 elsif not battler.exist? # 次の処理へ移行 next end # 詠唱中でない場合 if battler.at2 == 0 # バトラーの所属に応じて分岐 case battler.belong # アクター when 0 then # バトラー名をプッシュ @battlers_name.push("3" + battler.name) # エネミー else # バトラー名をプッシュ @battlers_name.push("4" + battler.name) end # CT2を初期化 battler.ct2 -= 100 # 詠唱中の場合 elsif battler.at2 >= 100 # バトラーの所属に応じて分岐 case battler.belong # アクター when 0 # スキル名とバトラー名をプッシュ @battlers_name.push("3" + battler.action_skill.name + "/#{battler.name}") # エネミー else # スキル名とバトラー名をプッシュ @battlers_name.push("4" + battler.action_skill.name + "/#{battler.name}") end # CT2を減算 battler.ct2 -= battler.action_skill.wait.to_i # AT2を初期化 battler.at2 = 0 end end end # 8回先まで行動順序を計算 ct_orders_base # 極端な処理落ちを防止する Graphics.frame_reset # 配列を返す return @battlers_name end #-------------------------------------------------------------------------- # ● 最終能力値の記憶 # actor : アクター #-------------------------------------------------------------------------- def save_last_parameter(actor) @lvup_window.data[actor] = [] @lvup_window.data[actor][0] = actor.level @lvup_window.data[actor][1] = actor.base_maxhp @lvup_window.data[actor][2] = actor.base_maxmp @lvup_window.data[actor][3] = actor.base_atk @lvup_window.data[actor][4] = actor.base_def @lvup_window.data[actor][5] = actor.base_spi @lvup_window.data[actor][6] = actor.base_agi @lvup_window.data[actor][7] = actor.base_spd end #-------------------------------------------------------------------------- # ● 現在のパラメータの取得 # actor : アクター # index : 項目 #-------------------------------------------------------------------------- def look_parameter(actor, index) # 項目に応じて分岐 case index when 0 then return actor.level when 1 then return actor.base_maxhp when 2 then return actor.base_maxmp when 3 then return actor.base_atk when 4 then return actor.base_def when 5 then return actor.base_spi when 6 then return actor.base_agi when 7 then return actor.base_spd end end #-------------------------------------------------------------------------- # ● レベルアップモーション #-------------------------------------------------------------------------- def level_up_motion # ポップ作成 @pop = Mint_Pop.new # ループ処理(パーティー) for id in 0...$game_party.members.size do # アクターを取得 actor = $game_party.members[id] # パラメータウィンドウをリフレッシュ @lvup_window.refresh(actor) # レベルが上がっている場合 if @lvup_window.data[actor][0] < actor.level then # パラメータウィンドウを表示 @lvup_window.visible = true # ループ処理 for i in (0..7) do # 描写座標を設定 x = 112 y = 66 + (i * Window_Base::WLH) # 上昇したパラメータを読み込む parameter = look_parameter(actor, i) # 結果を収納する string = "+#{parameter - @lvup_window.data[actor][i]}" # 上昇後のパラメータを設定 @lvup_window.data[actor][i] = parameter # パラメータウィンドウをリフレッシュ @lvup_window.draw_status(actor, i) # ポップ描写 @pop.string_pop(string, x, y) # ウェイトカウントを設定 wait = i == 7 ? 160 : 7 # ポップSEを演奏 data = MINTO::SE_Data Audio.se_play(data[0], data[1], data[2]) # フレーム更新 wait.times do # ゲーム画面を更新 Graphics.update # 入力情報を更新 Input.update # スプライトセットを更新 @spriteset.update # ポップを更新 @pop.update # パラメータウィンドウを更新 @lvup_window.update # 最終インデックスの場合 if i == 7 then # ポーズサインを表示する @lvup_window.pause = true # C ボタンが押された場合 if Input.trigger?(Input::C) == true then # ポーズサインを非表示にする @lvup_window.pause = false # 更新を中断 break end end end end end # 習得したスキルを表示 learning_skills_pop(actor) # ポップを解放 @pop.dispose # パラメータウィンドウを閉じる @lvup_window.visible = false end end end Data_States.initialize($BTEST) end