#◆◇◆◇◆ XP風ATBスクリプトVXA ver 1.07 ◇◆◇◆◇ # サポート掲示板 http://www2.ezbbs.net/21/minto-aaa/ # by みんと =begin ■ 更新履歴 ○ ver 1.07(2012/07/25) MPダメージ表示をこっそり実装 ○ ver 1.06(2012/07/25) 付加、解除などされたバフ等のダメージ表示に対応 ○ ver 1.05(2012/07/21) ショート、ノンチャージが反映されないミスを修正 ○ ver 1.04(2012/07/17) 5人以上でエラー落ちするミスを修正 ○ ver 1.03(2012/07/16) 細かいミスを修正 ○ ver 1.02(2012/07/16) 再生のミスを修正 ○ ver 1.01(2012/07/16) ステートの自然解除のミスを修正 ○ ver 1.00(2012/07/16) 正式公開 ○ ver 0.00(2012/07/08) βバージョン作成 ■ 説明 いわゆるATBスクリプトです。 ゲージが溜まっていき、溜まった人から行動します。 ● 行動の概念 各キャラクター毎に 敏捷性÷2÷バトルスピード分のカウント(CT)が加算されていきます。 このCTが100になった人から行動します。 すなわち、敏捷性が10の人と20の人がいた場合、 20の人は10の人が行動するまでに2回行動できるということを意味します。 行動したらカウントは行動別にマイナスされ、 100以上だった場合は、あまりを次のカウントに持ち越します。 ※ 注意点 カウントが100になった人から行動するので、 極端に高い数値は推奨できません。 高くても70程度にしておきましょう。 計算上の上限は198です。 それ以上の敏捷性を設定しても効果がありません。 ● 詠唱の概念 各スキルには詠唱値を設定できます。 設定にはメモ欄を使います。 例 SPD20 この様に記載された場合、詠唱値は20になります。 概念は敏捷性と同じで、100になるまでカウントしていき、 100になったら発動します。 詠唱40は敏捷性40のキャラが行動できるまでの時間と同じです。 省略した場合は200(即発動)になります。 強力なスキルほど低めの数値にするといいでしょう。 ● 詠唱速度が変動するステート 各ステートには詠唱速度が変動するオプションが設定できます。 設定にはステート名を以下の名前にします。 ショートチャージ ・詠唱が半分になります。 ノンチャージ ・詠唱が0になります。 ● スキルの反動 各スキルには消費するCT、すなわち反動が設定できます。 設定にはメモ欄を使用します。 例 WAI20 この様に記載された場合、20になります。 この数値分スキル実行後にマイナスされるので、 威力は低いが次の行動にすぐ移れるスキルなどが作れます。 省略した場合は100になります。 ● スキルのオプション 各スキルにはメモ欄に以下の記述を記載する事で、 特別なオプションが設定できます。 CTチャージ ・CTを100にして即行動可能にする。 詠唱中の場合は即発動する。 (対象よりも敏捷性が高く、カウントが100以上の場合はそちらが優先) 連続行動 ・設定値分連続で行動する。 連続行動8なら8回連続行動になる。 (強制的に設定値分連続で行動できる) ● ターンの概念 存在するアクター、エネミーの総数分の行動が行われたら1ターン経過します。 すなわち、アクター2人、エネミー1体の場合、 3回行動が経過したら1ターン経過します。 ● バトルグラフィックの設定 バトルグラフィックファイル名は機械的に作成しています。 例えば顔グラフィックのファイル名がActor1でインデックスが0の場合、 "実際の"ファイル名は Actor1-0_B となります。 さらに攻撃時のグラフィック(アクショングラフィックを使用する場合)は Actor1-0_B_攻、ダメージ時はActor1-0_B_苦になります。 ● 仕様 全てのアクター、エネミーともに動けなくなると(マヒなど)フリーズします。 (動けない=CTをカウントしない=行動が経過しない=ターンが経過しない) =end #============================================================================== # ☆ MINTO #------------------------------------------------------------------------------ # 様々なフラグを扱うメインモジュールです。 #============================================================================== module MINTO # XP風ATBスクリプトVXAを有効化 ( true で有効 / false で無効 ) RGSS["XP風ATBスクリプトVXA"] = true end # XP風ATBスクリプトVXAが有効な場合に以降の処理を実行する if MINTO::RGSS["XP風ATBスクリプトVXA"] == true then #============================================================================== # ☆ カスタマイズ #------------------------------------------------------------------------------ # 機能のカスタマイズをここで行います。 #============================================================================== module MINTO # 戦闘速度(減算方式) Battle_Speed = 10 # コマンド開始SE([ファイル名, ボリューム, ピッチ]) Command_SE = ["Ice4", 100, 150] # 表情変化機能フラグ # true で攻撃時、ダメージ時にグラフィックが変化します FaceChange = false # ダメージ用ピクチャーファイル名 Damage_P = "num" # ダメージのウェーブ間隔(フレーム) Wave_Rate = 5 # 詠唱演出実行フラグ # teue でアクター、ネミーともに詠唱中は詠唱に合わせて演出を行います Spell_Effect = true #-------------------------------------------------------------------------- # ● ログウィンドウの可視フラグの取得 #-------------------------------------------------------------------------- def self.log_visible? # 可視フラグを返す( true / false ) return false 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 #-------------------------------------------------------------------------- # ● 縁文字描写 # x : 文章の X 座標 # y : 文章の Y 座標 # width : 文章の描写範囲(横幅) # height : 文章の描写範囲(高さ) # text : 文章 # align : アラインメント (0..左揃え、1..中央揃え、2..右揃え) #-------------------------------------------------------------------------- def frame_text(x, y, width, height, text, ag = 0) # 元の色を保存 ori_color = font.color.clone # 縁の色を定義 font.color.set(0, 0, 0) # 縁文字を描写 draw_text(x-1, y, width, height, text, ag) draw_text(x+1, y, width, height, text, ag) draw_text(x, y-1, width, height, text, ag) draw_text(x, y+1, width, height, text, ag) # 元の色に戻す font.color = ori_color # 本体の文字を描写 draw_text(x, y, width, height, text, ag) 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 = 200 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.rvdata2") else data_states = load_data("Data/States.rvdata2") end @name = [""] for state in data_states next if state == nil @name.push(state.name) end end #-------------------------------------------------------------------------- # ● ステートネーム #-------------------------------------------------------------------------- def self.name return @name end end #============================================================================== # ☆ MINTO_Spell_Effect #------------------------------------------------------------------------------ # 詠唱時のエフェクトを管理するモジュールです。 #============================================================================== module MINTO_Spell_Effect #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- def dispose # バトラーが有効な場合 if @battler != nil then # 詠唱エフェクトスプライトが存在する場合 if @battler.spell_effect != nil then # 詠唱エフェクトスプライトを解放 @battler.spell_effect.dispose @battler.spell_effect = nil end end # 継承先のスーパークラスの処理に移行 super end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update # バトラーが有効な場合 if @battler != nil then # エフェクトスプライトが存在する場合 if @battler.spell_effect != nil then # エフェクトスプライトを更新 @battler.spell_effect.update # バトラーが不可視の場合 if @battler_visible == false then # エフェクト演出中の場合 if @battler.spell_effect.mode == 1 # 演出を解放 @battler.spell_effect.mode = 2 end end # バトラーが行動不可能な場合 if @battler.movable? == false then # エフェクト演出中の場合 if @battler.spell_effect.mode == 1 # 演出を解放 @battler.spell_effect.mode = 2 end end # バトラーが詠唱状態でない場合 if @battler.at == 0 then # エフェクト演出中の場合 if @battler.spell_effect.mode == 1 # 演出を解放 @battler.spell_effect.mode = 2 end end # エフェクトスプライトが無効な場合 else # エフェクトスプライトを作成 @battler.spell_effect = Charge_Effect.new(self) end # 詠唱エフェクトの実行が予約されている場合 if @battler.call_spell_effect == true then # 詠唱エフェクトを実行 @battler.spell_effect.start # 詠唱エフェクト実行フラグをクリア @battler.call_spell_effect = false end end # 継承先のスーパークラスの処理に移行 super end end #============================================================================== # ☆ MINTO_Fone_Change #------------------------------------------------------------------------------ # 戦闘背景の色調変更を管理するシステムモジュールです。 #============================================================================== module MINTO_Fone_Change #-------------------------------------------------------------------------- # ● アニメーションの開始 # animation : アニメーション(RPG::Animation) # mirror : アニメ反転フラグ #-------------------------------------------------------------------------- def start_animation(animation, mirror = false) # 戦闘画面でない場合 if SceneManager.scene.is_a?(Scene_Battle) == false then # スーパークラスの処理へ移行 super(animation, mirror) # メソッドを返す return end # スーパークラスの処理へ移行 super(animation, mirror) # アニメーション名に 暗転 の文字が含まれている場合 if animation.name.include?("暗転") # 背景を暗転 SceneManager.scene.spriteset.tone_change(Color.new(48, 48, 48), 6) end # 暗転呼び出しの場合 if SceneManager.scene.call_blackout == true then # フラグをクリア SceneManager.scene.call_blackout = false # 背景を暗転 SceneManager.scene.spriteset.tone_change(Color.new(48, 48, 48), 4) end end #-------------------------------------------------------------------------- # ● アニメーションの解放 #-------------------------------------------------------------------------- def dispose_animation # 戦闘画面でない場合 if SceneManager.scene.is_a?(Scene_Battle) == false then # スーパークラスを実行 (継承先の処理に移行する) super # メソッドを返す return end # 戦闘背景の色調を戻す SceneManager.scene.spriteset.tone_change(Color.new(128, 128, 128), 8) # スーパークラスを実行 (継承先の処理に移行する) super end end #============================================================================== # ■ Mint_Damage_System #------------------------------------------------------------------------------ #  ピクチャー数字のスプライト表示を扱うクラスです。 # このクラスは数値の高速再描写に特化したクラスとなっています。 #============================================================================== class Mint_Damage_System #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :x # X座標 attr_reader :y # Y座標 #-------------------------------------------------------------------------- # ● オブジェクト初期化 # x : X座標 # y : Y座標 # index : 求められた行数 # z : Z座標 # size : 求められた1カラーの高さ # text : 求められたピクチャー #-------------------------------------------------------------------------- def initialize(x, y, index, z, size, text, v) text ||= MINTO::Damage_P # ピクチャーデータを読み込んで代入 @number = Cache.picture(text) # 各種データを初期化 @x = x @y = y @z = z @index = index @count = [] @viewport = v # ビットマップを作成 @text_bitmap = Bitmap.new(32, 32) @text_bitmap.font.size = 30 # クリティカル表示用スプライト @critical = Sprite.new(@viewport) @critical.visible = false @critical.bitmap = Cache.picture("critical") # カラーサイズを取得(画像の高さをsizeで割った数) collar_size = @number.rect.height / size # 読み込んだ画像の幅を10で割った値が、1文字1文字の幅になる @width = @number.rect.width / 10.0 # 読み込んだ画像の高さをカラーサイズで割った数が1カラーの高さになる height = @number.rect.height / collar_size @height = height.to_i # スプライトを収納する配列を定義 @sprite = [Sprite.new(@viewport)] # スプライト生成(求められた行数分) (0...@index).each do |i| @sprite[i] = Sprite.new(@viewport) @sprite[i].x = x.to_i + (i * @width) @sprite[i].y = y.to_i @sprite[i].z = z end # ピクチャー数字用の配列生成 @picture_number = [] # X, Y, 幅, 高さ rect = Rect.new(0, 0, @width, height) # 各カラー分のピクチャーを作成 (0...collar_size).each do |collar_index| # 配列内配列を作成 @picture_number[collar_index] = [] # 0〜9までのピクチャー数字を予め作成 (0..9).each do |i| # インデックス(i)から、 # 基本幅(@width)を掛けたところにある画像を参照する rect.x = i * @width # collar_index から # 基本高さ(height)を掛けたところにある画像を参照する rect.y = collar_index * height # Bitmapを作成 bitmap = Bitmap.new(@width, height) # ピクチャー生成 bitmap.blt(0, 0, @number, rect) # 生成したピクチャーを収納 @picture_number[collar_index][i] = bitmap end end end #-------------------------------------------------------------------------- # ● インデックスの変更 # index : 求められたインデックス #-------------------------------------------------------------------------- def set_index(index) # スプライト生成(求められた行数分) (0...index).each do |i| # すでにスプライトがある場合 if @sprite[i] != nil # 次へ next end @sprite[i] = Sprite.new(@viewport) @sprite[i].x = @x.to_i + (i * @width) @sprite[i].y = @y.to_i @sprite[i].z = @z.to_i end # インデックスを更新 @index = index end #-------------------------------------------------------------------------- # ● X座標のセット # x : 基本X座標 # damage : 求められた文字 #-------------------------------------------------------------------------- def set_x(x, damage, viewport) @viewport = viewport # 求められた文字を一文字ずつ配列にする text = damage.to_s.split(//) text -= ["-"] # 文字幅を初期化 text_width = 0 # 求められた行数分繰り返す (0...@index).each do |i| # ダメージが文字列の場合 if damage.is_a?(String) # 文字の幅を取得して加算 text_width += 32 - (@text_bitmap.text_size(text[i]).width) / 2 # X座標を調整する(左寄せ) @sprite[i].x = (-32 + x) + text_width else # X座標を調整する(左寄せ) @sprite[i].x = (x + @x.to_i) + (i * (@width - 4)) end @sprite[i].viewport = viewport end @critical.x = @sprite[0].x + 16 @critical.y = @sprite[0].y - 32 end #-------------------------------------------------------------------------- # ● X座標の変更 # n : 新しいX座標 #-------------------------------------------------------------------------- def x=(n) # X座標の変更(イテレータ) (0...@index).each{|i| @sprite[i].x = n} end #-------------------------------------------------------------------------- # ● Y座標の変更 # n : 新しいY座標 #-------------------------------------------------------------------------- def y=(n) # Y座標の変更(イテレータ) (0...@index).each{|i| @sprite[i].y = n} end #-------------------------------------------------------------------------- # ● 可視状態の取得 #-------------------------------------------------------------------------- def visible # 先頭の可視状態を返す return @sprite[0].visible end #-------------------------------------------------------------------------- # ● 内容の可視状態の変更 # flag : 新しい可視状態 #-------------------------------------------------------------------------- def visible=(flag) # 可視状態の変更(イテレータ) (0...@index).each{|i| @sprite[i].visible = flag} # クリティカルを初期化 @critical.visible = flag end #-------------------------------------------------------------------------- # ● 透明度の取得 #-------------------------------------------------------------------------- def opacity # 先頭の透明度を返す return @sprite[0].opacity end #-------------------------------------------------------------------------- # ● 透明度の変更 # opacity : 新しい透明度 #-------------------------------------------------------------------------- def opacity=(opacity) # 透明度の変更(イテレータ) (0...@index).each{|i| @sprite[i].opacity = opacity} @critical.opacity = opacity end #-------------------------------------------------------------------------- # ● クリア #-------------------------------------------------------------------------- def clear # 求められた行数分のビットマップをクリア (0...@index).each do |i| @sprite[i].bitmap = nil end end #-------------------------------------------------------------------------- # ● 文字色取得 # n : 文字色番号 (0〜7) #-------------------------------------------------------------------------- def text_color(n) case n # 強化 when 0 return Color.new(0, 255, 200) # 弱体 when 1 return Color.new(255, 0, 200) # 解除 when 2 return Color.new(0, 200, 255) when 3 return Color.new(255, 255, 255) when 4 return Color.new(128, 255, 255, 255) when 5 return Color.new(255, 128, 255, 255) when 6 return Color.new(255, 255, 128, 255) when 7 return Color.new(192, 192, 192, 255) else return Color.new(255, 255, 255) end end #-------------------------------------------------------------------------- # ● 縁文字作成 # text : 求められた文字列 # bitmap : ビットマップ # color : カラーID #-------------------------------------------------------------------------- def frame_text(text, bitmap, color) bitmap.font.size = 30 bitmap.draw_text(0, 0, 40, 40, text, 1) end #-------------------------------------------------------------------------- # ● セットストリング # string : 求められた文字列 # collar : 求められたカラーインデックス # critical : クリティカルの有無 # buff : バフの種類 #-------------------------------------------------------------------------- def set_string(string, collar, critical = false, buff = nil) # クリティカルを初期化 @critical.visible = false @critical.opacity = 255 text = [string] text -= ["-"] # 求められた文字を一文字ずつ配列にする text_size = string.to_s.split(//).size # 求められた行数分繰り返す (0...@index).each do |i| # テキストが存在しない場合 if text[i] == nil # 次の処理へ next end # X座標を調整する(左寄せ) @sprite[i].x = @x.to_i + (i * 40) # ビットマップ作成 @sprite[i].bitmap = Bitmap.new(255, 40) # 文字色を設定 @sprite[i].bitmap.font.color = text_color(buff) # 文字列を描写 @sprite[i].bitmap.draw_text(0, 0, 109, 40, text[i]) # 不可視状態に設定 @sprite[i].visible = false # 透明度を初期化 @sprite[i].opacity = 255 # カウントを設定 @count[i] = 40 @count[i] += (i * MINTO::Wave_Rate) end # クリティカルの場合 if critical @critical.z = 3000 @critical.visible = true if critical == "MP" @critical.bitmap = Cache.picture("mp_dum") end end end #-------------------------------------------------------------------------- # ● セットテキスト # number : 求められた数値 # collar : 求められたカラーインデックス # critical : クリティカルの有無 #-------------------------------------------------------------------------- def set_text(number, collar = 0, critical = false) # クリティカルを初期化 @critical.visible = false # 求められた文字を一文字ずつ配列にする text = number.to_s.split(//) text -= ["-"] # クリア行数 clear_index = text.size == 1 ? 1 : 0 # X座標を調整する x_size = @index - text.size # 求められた行数分繰り返す (0...@index).each do |i| # クリア行数が0で求められた数字が0か、 # 元の数字が存在しなければなら次へ if clear_index == 0 && text[i].to_i == 0 || text[i] == nil @sprite[i].bitmap = nil next end # X座標を調整する(右寄せ) @sprite[i].x = @x.to_i + (i * (@width - 4)) + (x_size * @width) # 条件をクリアしていれば、クリア行数に1を加算 clear_index += 1 # 条件をクリアしていれば描写 @sprite[i].bitmap = @picture_number[collar][text[i].to_i] # 不可視状態に設定 @sprite[i].visible = false # 透明度を初期化 @sprite[i].opacity = 255 @critical.opacity = 255 # カウントを設定 @count[i] = 50 @count[i] += (i * MINTO::Wave_Rate) end # クリティカルの場合 if critical @critical.z = 3000 @critical.opacity = 0 @critical.visible = true if critical == "MP" @critical.bitmap = Cache.picture("mp_dum") end end end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update # スプライトのループ処理 (0...@index).each do |i| # カウントが0の場合 if @count[i].to_i == 0 # 次の処理へ next end # カウントが40以下の場合 if @count[i] <= 40 # スプライトを可視状態にする @sprite[i].visible = true # クリティカルの場合 if @critical.visible @critical.opacity = 255 end # 残りカウントに応じて分岐 case @count[i] when 36..40 @sprite[i].y -= 4 when 33..37 @sprite[i].y -= 2 when 32..34 @sprite[i].y += 2 when 25..32 @sprite[i].y += 4 end end @critical.y = @sprite[0].y - (@height + 4) # カウントを減らす @count[i] -= 1 end end #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- def dispose # スプライトを解放 for s in @sprite + [@critical] s.dispose s = nil end # ビットマップを解放 @text_bitmap.dispose end end #============================================================================== # ■ BattleManager #------------------------------------------------------------------------------ #  戦闘の進行を管理するモジュールです。 #============================================================================== module BattleManager #-------------------------------------------------------------------------- # ● 行動順序の作成 #-------------------------------------------------------------------------- def self.make_action_orders # メソッドを返す(元の処理を行わない) return end #-------------------------------------------------------------------------- # ● 先制攻撃フラグの取得 #-------------------------------------------------------------------------- def self.preemptive return @preemptive end #-------------------------------------------------------------------------- # ● 不意打ちフラグの取得 #-------------------------------------------------------------------------- def self.surprise return @surprise end #-------------------------------------------------------------------------- # ● 先制攻撃フラグの変更 #-------------------------------------------------------------------------- def self.preemptive=(f) @preemptive = f end #-------------------------------------------------------------------------- # ● 不意打ちフラグの変更 #-------------------------------------------------------------------------- def self.surprise=(f) @surprise = f end end #============================================================================== # ■ DummySprite #------------------------------------------------------------------------------ #  スプライト表示のダミーを扱うクラスです。 #============================================================================== class DummySprite #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :x # X座標 attr_accessor :y # Y座標 attr_accessor :ox # OX座標 attr_accessor :oy # OY座標 attr_accessor :z # Z座標 attr_accessor :visible # 可視状態 attr_accessor :opacity # 内容の透明度 attr_accessor :bitmap # ビットマップ #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update(object = nil) end #-------------------------------------------------------------------------- # ● 可視状態の取得 #-------------------------------------------------------------------------- def visible return false end #-------------------------------------------------------------------------- # ● 可視状態の変更 #-------------------------------------------------------------------------- def visible=(n) end #-------------------------------------------------------------------------- # ● ビットマップの変更 #-------------------------------------------------------------------------- def bitmap=(n) end #-------------------------------------------------------------------------- # ● エフェクト表示中判定 #-------------------------------------------------------------------------- def effect? return false end #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- def dispose end end #============================================================================== # ■ Charge_Effect #------------------------------------------------------------------------------ # 詠唱中の演出を実行するクラスです。 #============================================================================== class Charge_Effect #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :speed # チャージ演出速度 #-------------------------------------------------------------------------- # ● オブジェクト初期化 # battler : バトラー (Sprite) #-------------------------------------------------------------------------- def initialize(battler) # バトラーを変更 @battler = battler # ダミースプライトを作成 @gage = DummySprite.new end #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start @enemy_spell = true @bitmap_name = ["Charge_01", "Charge_02"] @speed = 10 # 既存のエフェクトを解放 dispose # スプライトカウントをクリア @sprite_count = 0 # スプライトを作成 @sprites = [nil] sub_sprite_set # 初期モードを設定 @mode = 1 # 極端な処理落ちを防止する Graphics.frame_reset end #-------------------------------------------------------------------------- # ● メインスプライトの作成 #-------------------------------------------------------------------------- def main_sprite_set(mode = 0) # メインスプライトを返す return Sprite_Spell_Effect.new(@battler, @bitmap_name[0]) end #-------------------------------------------------------------------------- # ● 補助スプライトの作成 #-------------------------------------------------------------------------- def sub_sprite_set @sub_sprite = Sprite.new(@battler.viewport) # 読み込んだ画像を渡す @sub_sprite.bitmap = Cache.picture(@bitmap_name[1]) # スプライトの座標を設定 @sub_sprite.x = @battler.x + @battler.viewport.rect.x - @battler.ox + @battler.src_rect.width / 2 @sub_sprite.y = @battler.battler.screen_y - @battler.oy + @battler.src_rect.height / 2 @sub_sprite.ox = 96 @sub_sprite.oy = 96 @sub_sprite.z = 99998 @sub_sprite.zoom_x = 0.2 @sub_sprite.zoom_y = 0.2 @sub_sprite.opacity = 0 # スプライトを加算表示にする @sub_sprite.blend_type = 1 end #-------------------------------------------------------------------------- # ● モードの取得 #-------------------------------------------------------------------------- def mode # 現在の演出モードを返す return @mode end #-------------------------------------------------------------------------- # ● モードの変更 # n : 新しいモード #-------------------------------------------------------------------------- def mode=(n) @mode = n # 無効なスプライトの場合 if @sprites == nil then # 実行モードをクリア @mode = 0 # メソッドを返す return end # 無効なデータを削除 @sprites.compact! end #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- def dispose # 実行モードをクリア @mode = 0 # データが存在しない場合 if @sprites == nil then # メソッドを返す return end # ループ処理 (0...@sprites.size).each do |i| # スプライトを取得 sprite = @sprites[i] # 有効なスプライトの場合 if sprite != nil then # スプライトを解放 @sprites[i].dispose @sprites[i] = nil end end # 無効なデータを削除 @sprites.compact! @sprites = nil @sub_sprite.bitmap.dispose @sub_sprite.bitmap = nil @sub_sprite.dispose @sub_sprite = nil end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update # 現在のモードに応じて分岐 case @mode # 集中 when 1 then # 集中演出の更新 update_mode1 # 発散 when 2 then # 発散演出の更新 update_mode2 end end #-------------------------------------------------------------------------- # ● フレーム更新(モード1) #-------------------------------------------------------------------------- def update_mode1 # ループ処理 (0...@sprites.size).each do |i| # スプライトを取得 sprite = @sprites[i] # 有効なスプライトの場合 if sprite != nil then # スプライトを更新 sprite.update # スプライトの位置が中心点の場合 if sprite.center? then # スプライトを解放 @sprites[i].dispose @sprites[i] = nil end end end # スピードが無効な場合 if @speed == nil then # メソッドを返す return end # スプライトカウントが @speed 以上の場合 if @sprite_count >= @speed then # 新しいスプライトを作成 @sprites.push(main_sprite_set) # 無効なデータを削除 @sprites.compact! # スプライトカウントをクリア @sprite_count = 0 # スプライトカウントが 1 未満の場合 else # スプライトのカウントを進める @sprite_count += 1 end end #-------------------------------------------------------------------------- # ● フレーム更新(モード2) #-------------------------------------------------------------------------- def update_mode2 # ループ処理 (0...@sprites.size).each do |i| # スプライトを取得 sprite = @sprites[i] # 有効なスプライトの場合 if sprite != nil then # スプライトを更新 sprite.update end end @sub_sprite.zoom_x += 0.05 @sub_sprite.zoom_y += 0.05 @sub_sprite.opacity = (@sub_sprite.opacity - 9).to_min(1) # スプライトカウントが 30 に達した場合 if @sprite_count == 30 then # 既存のエフェクトを解放 dispose # スプライトカウントが 30 未満の場合 else # スプライトのカウントを進める @sprite_count += 1 end end end #============================================================================== # ■ Game_Action #------------------------------------------------------------------------------ #  戦闘行動を扱うクラスです。このクラスは Game_Battler クラスの内部で使用され # ます。 #============================================================================== class Game_Action #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :kind # 行動の種類 attr_accessor :basic # 基本行動の内容 #-------------------------------------------------------------------------- # ● クリア #-------------------------------------------------------------------------- def clear @item = Game_BaseItem.new @target_index = -1 @value = 0 @kind = 0 @basic = 0 end #-------------------------------------------------------------------------- # ● 通常攻撃を設定 #-------------------------------------------------------------------------- def set_attack set_skill(subject.attack_skill_id) @kind = 0 @basic = 0 self end #-------------------------------------------------------------------------- # ● 防御を設定 #-------------------------------------------------------------------------- def set_guard set_skill(subject.guard_skill_id) @kind = 0 @basic = 1 self end #-------------------------------------------------------------------------- # ● スキルを設定 #-------------------------------------------------------------------------- def set_skill(skill_id) @item.object = $data_skills[skill_id] @kind = 1 self end #-------------------------------------------------------------------------- # ● アイテムを設定 #-------------------------------------------------------------------------- def set_item(item_id) @item.object = $data_items[item_id] @kind = 2 self end end #============================================================================== # ■ Game_ActionResult #------------------------------------------------------------------------------ #  戦闘行動の結果を扱うクラスです。このクラスは Game_Battler クラスの内部で # 使用されます。 #============================================================================== class Game_ActionResult #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :call_damage # ダメージ呼び出しフラグ attr_accessor :call_buff # バフ表示呼び出しフラグ attr_accessor :call_slip_damage # スリップダメージ呼び出しフラグ #-------------------------------------------------------------------------- # ● バフ表示呼び出しフラグの取得 #-------------------------------------------------------------------------- def call_buff @call_buff ||= [] return @call_buff end end #============================================================================== # ■ Game_Battler #------------------------------------------------------------------------------ #  バトラーを扱うクラスです。このクラスは Game_Actor クラスと Game_Enemy クラ # スのスーパークラスとして使用されます。 #============================================================================== class Game_Battler < Game_BattlerBase #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :ct # 現在CT attr_accessor :at # 現在AT attr_accessor :ct2 # 計算用CT attr_accessor :at2 # 計算用AT attr_accessor :initiative # 行動優先度 attr_accessor :action_skill # 保存用のスキル attr_accessor :target # 保存用のターゲット attr_accessor :battler_name # 戦闘グラフィック ファイル名 attr_accessor :battler_hue # 戦闘グラフィック 色相 attr_accessor :spell_effect # 詠唱エフェクト attr_accessor :call_spell_effect # 詠唱エフェクト実行フラ #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias mint_ctb_initialize initialize def initialize # 元の処理を実行 mint_ctb_initialize @ct = 0 @at = 0 @ct2 = 0 @at2 = 0 @initiative = 0 end #-------------------------------------------------------------------------- # ● ターン終了処理 #-------------------------------------------------------------------------- def on_turn_end @result.clear #regenerate_all update_state_turns update_buff_turns remove_states_auto(2) end #-------------------------------------------------------------------------- # ● HP の再生 #-------------------------------------------------------------------------- alias mint_ctb_regenerate_hp regenerate_hp def regenerate_hp # 元の処理を実行 mint_ctb_regenerate_hp # 再生が発生した場合 if @result.hp_damage.to_i != 0 # ダメージを表示 @result.call_damage = true @result.call_slip_damage = true end end #-------------------------------------------------------------------------- # ● スキル/アイテムの効果適用 #-------------------------------------------------------------------------- alias mint_ctb_item_apply item_apply def item_apply(user, item) # 元の処理を実行 mint_ctb_item_apply(user, item) @result.call_damage = true end #-------------------------------------------------------------------------- # ● 戦闘行動の作成(詠唱スキル用) #-------------------------------------------------------------------------- def make_skill_actions clear_actions @actions = Array.new(make_action_times) { Game_Action.new(self) } end #-------------------------------------------------------------------------- # ● CTの変更 #-------------------------------------------------------------------------- def ct=(n) @ct = n end #-------------------------------------------------------------------------- # ● CT の割合を取得 #-------------------------------------------------------------------------- def ct_rate @ct.to_i / 100.0 end #-------------------------------------------------------------------------- # ● 行動速度の取得 #-------------------------------------------------------------------------- def spd # メソッドを返す return (self.agi.to_f / 2.0).to_max(0.5, 99.0) end #-------------------------------------------------------------------------- # ● 実行動速度の取得 #-------------------------------------------------------------------------- def true_spd # メソッドを返す return spd.to_f / MINTO::Battle_Speed end #-------------------------------------------------------------------------- # ● コマンド入力可能判定 #-------------------------------------------------------------------------- def inputable? # 元の処理を実行 bool = super # 先頭バトラー以外なら終了 if SceneManager.scene.active_battlers[0] != self return false end # CTが100未満なら終了 if @ct.to_i < 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 @states.include?($data_states[id]) end #-------------------------------------------------------------------------- # ● スキルのクリア #-------------------------------------------------------------------------- def action_skillclear @at = 0 @action_skill = nil end #-------------------------------------------------------------------------- # ● 画像の高さの取得 #-------------------------------------------------------------------------- def bit_height height = Cache.battler(battler_name, battler_hue).height return height end end #============================================================================== # ■ Game_Actor #------------------------------------------------------------------------------ #  アクターを扱うクラスです。このクラスは Game_Actors クラス ($game_actors) # の内部で使用され、Game_Party クラス ($game_party) からも参照されます。 #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_accessor :command_call # コマンド選択フラグ attr_accessor :screen_x # バトル画面 X 座標 attr_accessor :screen_y # バトル画面 Y 座標 #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias minto_xp_battle_initialize initialize def initialize(actor_id) # 元の処理を実行 minto_xp_battle_initialize(actor_id) # バトラー名を収納 @battler_name = "#{@face_name}-#{@face_index}_B" @battler_hue = 0 end #-------------------------------------------------------------------------- # ● 画面 X 座標の取得 #-------------------------------------------------------------------------- def screen_x return 174 + self.index * 104 end #-------------------------------------------------------------------------- # ● 画面 Y 座標の取得 #-------------------------------------------------------------------------- def screen_y if SceneManager.scene.is_a?(Scene_Battle) unless SceneManager.scene.info_viewport return 999 end end return 248 + 160 end #-------------------------------------------------------------------------- # ● 画面 z 座標の取得 #-------------------------------------------------------------------------- def screen_z return 100 end #-------------------------------------------------------------------------- # ● スプライトを使うか? #-------------------------------------------------------------------------- def use_sprite? return true end #-------------------------------------------------------------------------- # ● 所属判定の取得 #-------------------------------------------------------------------------- def belong # 制約が [味方を通常攻撃する] の場合 if self.restriction == 3 then # 識別信号を反転 return 1 end return 0 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 #-------------------------------------------------------------------------- # ● 戦闘行動の作成 #-------------------------------------------------------------------------- alias mint_ctb_make_actions make_actions def make_actions # 先頭バトラー以外なら終了 #if $scene.active_battlers[0] != self # return #end # CTが100未満なら終了 if @ct < 100.0 return false end # 保存用のスキルがあるなら終了 unless @action_skill.nil? return end # 元の処理を実行 mint_ctb_make_actions end end #============================================================================== # ■ Game_Troop #------------------------------------------------------------------------------ #  敵グループおよび戦闘に関するデータを扱うクラスです。バトルイベントの処理も # 行います。このクラスのインスタンスは $game_troop で参照されます。 #============================================================================== class Game_Troop < Game_Unit #-------------------------------------------------------------------------- # ● クリア #-------------------------------------------------------------------------- alias mint_ctb_clear clear def clear # 元の処理を実行 mint_ctb_clear # 総合カウントを初期化 @total_count = -1 end #-------------------------------------------------------------------------- # ● ターンの増加 #-------------------------------------------------------------------------- def increase_turn # 総合カウントを加算 @total_count += 1 # 総合カウントが存在するバトラーと並んだ場合 if @total_count >= exist_battlers # 総合カウントを初期化 @total_count = 0 # ターン増加 troop.pages.each {|page| @event_flags[page] = false if page.span == 1 } @turn_count += 1 end end #-------------------------------------------------------------------------- # ● 存在するバトラーの取得 #-------------------------------------------------------------------------- def exist_battlers exist = 0 # ループ処理(全メンバー) for battler in $game_party.battle_members + self.members # バトラーが存在する場合 if battler.alive? # 存在カウント加算 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_party.in_battle == true # メンバーを更新 SceneManager.scene.member_update end # マップをリフレッシュ $game_map.need_refresh = true end # リザルトを返す return true end end #============================================================================== # ■ Sprite_Spell_Effect #------------------------------------------------------------------------------ #  特殊効果表示用のスプライトです。 # このクラスのインスタンスは SceneBattle の内部で使用されます。 #============================================================================== class Sprite_Spell_Effect < Sprite #-------------------------------------------------------------------------- # ● オブジェクト初期化 # battler : バトラー (Sprite) # bitmap_name : 読み込む画像ファイル名 #-------------------------------------------------------------------------- def initialize(sprite, bitmap_name) # スーパークラスの処理に移行 super(sprite.viewport) # 速度を決定 @speed = 16 + rand(16) # 読み込んだ画像の複製を渡す self.bitmap = Cache.picture(bitmap_name).dup # スプライトの座標を設定 @base_x = sprite.x + sprite.viewport.rect.x - sprite.ox + sprite.src_rect.width / 2 @base_y = sprite.battler.screen_y - sprite.oy + sprite.src_rect.height / 2 # 位置のランダム補正 amp_x = 128 + rand(64) amp_y = 160 + rand(48) @x_puls = rand(amp_x+1) + rand(amp_x+1) - amp_x @y_puls = rand(amp_y+1) + rand(amp_y+1) - amp_y @x_puls /= @speed @x_puls *= @speed @y_puls /= @speed @y_puls *= @speed self.x = @base_x + @x_puls self.y = @base_y + @y_puls self.ox = 96 self.oy = 96 self.z = 99999 # スプライトを加算表示にする self.blend_type = 1 # スプライトの不透明度を設定 self.opacity = 192 # スプライトの大きさを設定 @zoom = (100.0 + rand(100)) / 100.0 @zoom /= @speed.to_f @zoom *= @speed.to_f self.zoom_x = @zoom.to_f self.zoom_y = @zoom.to_f end #-------------------------------------------------------------------------- # ● 中央判定 #-------------------------------------------------------------------------- def center? # X座標とY座標の移動が完了している場合 self.x - @base_x == 0 and self.y - @base_y == 0 end #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- def dispose # ビットマップを解放 self.bitmap.dispose self.bitmap = nil # スーパークラスの処理に移行 super end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update # スーパークラスの処理に移行 super # 拡大率を小さくする self.zoom_x -= (@zoom.to_f / @speed.to_f) self.zoom_y = self.zoom_x # 元のX座標で無い場合 if self.x - @base_x != 0 then # 座標を詰める self.x -= (@x_puls / @speed) end # 元のY座標で無い場合 if self.y - @base_y != 0 then # 座標を詰める self.y -= (@y_puls / @speed) end end end #============================================================================== # ■ Sprite_Base #------------------------------------------------------------------------------ #  アニメーションの表示処理を追加したスプライトのクラスです。 #============================================================================== class Sprite_Base < Sprite #-------------------------------------------------------------------------- # ● アニメーションの原点設定 #-------------------------------------------------------------------------- def set_animation_origin if @animation.position == 3 if viewport == nil @ani_ox = Graphics.width / 2 @ani_oy = Graphics.height / 2 else @ani_ox = viewport.rect.width / 2 @ani_oy = viewport.rect.height / 2 # バトラーが有効な場合 unless @battler.nil? # バトラーがアクターの場合 if @battler.is_a?(Game_Actor) @ani_oy += 128 end end end else @ani_ox = x - ox + width / 2 @ani_oy = y - oy + height / 2 if @animation.position == 0 @ani_oy -= height / 2 elsif @animation.position == 2 @ani_oy += height / 2 end end end end #============================================================================== # ■ Sprite_Battler #------------------------------------------------------------------------------ #  バトラー表示用のスプライトです。Game_Battler クラスのインスタンスを監視し、 # スプライトの状態を自動的に変化させます。 #============================================================================== class Sprite_Battler < Sprite_Base #-------------------------------------------------------------------------- # ● システムインクルード #-------------------------------------------------------------------------- include(MINTO_Fone_Change) # 色調変更モジュール include(MINTO_Spell_Effect) # 詠唱演出モジュール #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- alias dispose_Wave_Damage dispose def dispose # 元の処理を実行 dispose_Wave_Damage # ダメージが存在する場合 if @damage != nil # ダメージを解放 dispose_damage end end #------------------------------------------------------------------------- # ● ダメージの表示 # value : ダメージ値 # critical : クリティカルの有無 # buff : バフの種類 # index : インデックス #------------------------------------------------------------------------- def damage(value, critical, buff = nil, index = nil) # 古いダメージを解放 #dispose_damage # バトラーが不可視の場合 unless @battler_visible # メソッドを返す return end # MPダメージの場合 if critical == "MP" # 0 ダメージの場合 if value.to_i == 0 # メソッドを返す return end end # バフ表示中で無い場合 unless buff center = true else center = false end # ミスの場合 unless @battler.result.hit? # スリップダメージで無い場合 unless @battler.result.call_slip_damage # バフ表示中で無い場合 unless buff # ダメージを Miss に置き換える value = "Miss" end else @battler.result.call_slip_damage = false end end # 0 ダメージの場合 if value == 0 # メソッドを返す return end # 求められた文字を一文字ずつ配列にする text = value.to_s.split(//) text -= ["-"] v = self.viewport # 初期定義(ダメージスプライトが存在しない場合) @damage ||= [] # ダメージスプライトを作成 @damage.unshift(Mint_Damage_System.new(0, 0, text.size, 3000, 28, nil, v)) # インデックスのセット @damage[0].set_index(text.size) # ダメージを作成 set_damage(value, critical, text.size, buff, index) # 座標を取得 if center x = (self.x - text.size * 15) + 16 else x = (self.x - self.ox / 2) end y = 14 + (self.y - self.oy / 2 + self.viewport.rect.y) # MPダメージの場合 if critical == "MP" y += 8 # 通常ダメージの場合 else y -= 8 + @damage.size % 5 * 22 end # ダメージが Miss の場合 if value == "Miss" then # ダメージの座標をセット @damage[0].set_x(x, 1233, self.viewport) else # ダメージの座標をセット @damage[0].set_x(x, value, self.viewport) end @damage[0].y = y end #------------------------------------------------------------------------- # ● ダメージ作成 # value : ダメージ値 # critical : クリティカルの有無 # size : 文字数 # buff : バフの種類 # index : インデックス #------------------------------------------------------------------------- def set_damage(value, critical, size, buff = nil, index = nil) # MPダメージの場合 if critical == "MP" critical_effect = false else critical_effect = critical end # ダメージが文字列の場合 if value.is_a?(String) # ダメージが Miss の場合 if value == "Miss" then # 数値ダメージとして表示 @damage[0].set_text(1233, 5, false) else # ダメージをセット(文字列) @damage[0].set_string(value.to_s, 0, critical_effect, buff) end else # 通常ダメージの場合 if value.to_i >= -1 # クリティカル表示の場合 if critical == true # カラーIDをセット c = 1 # ノーマルヒットの場合 else # MPダメージで無い場合 if critical != "MP" # カラーIDをセット c = 0 # MPダメージの場合 else # カラーIDをセット c = 3 end end # 回復ダメージの場合 else # MPダメージで無い場合 if critical != "MP" # カラーIDをセット c = 2 # MPダメージの場合 else # カラーIDをセット c = 4 end end # ダメージをセット(数値) @damage[0].set_text(value, c, critical_effect) end # ダメージカウントをセット @_damage_duration ||= [] @_damage_wait ||= [] # バフ表示遅延の場合 unless index.nil? # 表示を遅らせる @_damage_wait.unshift((@damage.size * 6)) else @_damage_wait.unshift(0) end @_damage_duration.unshift(50 + (size * MINTO::Wave_Rate)) # ダメージが空文字の場合 if value == "" # ダメージカウントをリセット @_damage_duration[0] = 0 end # ダメージカウントが奇数の場合 if @_damage_duration[0] % 2 == 1 # ダメージカウントを偶数にする @_damage_duration[0] += 1 end end #------------------------------------------------------------------------- # ● ダメージ解放 #------------------------------------------------------------------------- def dispose_damage(index = nil) # インデックスが指定されている場合 if index != nil @damage[index].dispose @damage[index] = nil @_damage_duration[index] = nil @_damage_wait[index] = nil @damage.compact! @_damage_duration.compact! @_damage_wait.compact! # インデックスが指定されていない場合 else # 全ダメージを解放 for i in 0...@damage.size @damage[i].dispose end @damage = [] @_damage_duration = [] @_damage_wait = [] end end #------------------------------------------------------------------------- # ● フレーム更新(ダメージ) #------------------------------------------------------------------------- def update_damage # ダメージオブジェクトが無効な場合 if @damage.nil? # メソッドを返す return end # ダメージオブジェクトの数が1以上の場合 unless @damage.empty? # ループ処理 @damage.each_with_index do |damage, i| # ウェイトカウント中の場合 if @_damage_wait[i] >= 1 # カウントを減らす @_damage_wait[i] -= 1 # 次の処理へ next else # ダメージカウントが0の場合 if @_damage_duration[i].zero? # ダメージオブジェクトを解放 dispose_damage(i) # 次の処理へ next end # ダメージカウントを進める @_damage_duration[i] -= 1 # ダメージカウントが5以下の場合 if @_damage_duration[i] <= 5 # 透明度の配列(6段階) opacity = [0, 50, 100, 150, 200, 250] # 表示中のダメージの透明度を下げる @damage[i].opacity = opacity[@_damage_duration[i]] end # ダメージオブジェクトを更新 @damage[i].update end end end end #-------------------------------------------------------------------------- # ● 白フラッシュエフェクトの更新 #-------------------------------------------------------------------------- alias mint_ctb_update_whiten update_whiten def update_whiten # 元の処理を実行 mint_ctb_update_whiten # アクターの場合 if @battler.actor? # 表情変化を行う場合 if MINTO::FaceChange # 元のグラフィックを記憶 @ori_name ||= @battler.battler_name.dup # グラフィックを一時的に変える @battler.battler_name = @ori_name + "_攻" # 変更カウントを設定 @face_duration = 40 end end end #-------------------------------------------------------------------------- # ● 点滅エフェクトの更新 #-------------------------------------------------------------------------- alias mint_ctb_update_blink update_blink def update_blink # 元の処理を実行 mint_ctb_update_blink # アクターの場合 if @battler.actor? # 表情変化を行う場合 if MINTO::FaceChange # 元のグラフィックを記憶 @ori_name ||= @battler.battler_name.dup # グラフィックを一時的に変える @battler.battler_name = @ori_name + "_苦" # 変更カウントを設定 @face_duration = 40 end end end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- alias mint_ctb_update update def update # バトラーが有効な場合 unless @battler.nil? # ダメージ呼び出しが行われた場合 if @battler.result.call_damage # ダメージを表示 damage(@battler.result.hp_damage, @battler.result.critical) # ダメージを表示 damage(@battler.result.mp_damage, "MP") # ダメージ呼び出しをクリア @battler.result.call_damage = false end # バフ表示の場合 unless @battler.result.call_buff.empty? # ループ処理(バフ) for i in 0...@battler.result.call_buff.size # バフの種類を取得 buff = @battler.result.call_buff[i][0] # ループ処理(変化したパラメータ) for id in @battler.result.call_buff[i][1] # idの修理に応じて分岐 case id when RPG::State # 属性が 付加 で 戦闘不能 が対象の場合 if buff == 3 and id.id == 1 # 次へ next end # バフテキストを取得 value = id.name when nil # 次へ next else # バフテキストを取得 value = Vocab::param(id) end # ダメージとして表示 damage(value, false, buff, i) end # バフ情報をクリア @battler.result.call_buff[i] = nil end # バフ情報を詰める @battler.result.call_buff.compact! end end # グラフィックを変更中の場合 if @face_duration.to_i >= 1 # カウントを減らす @face_duration -= 1 # カウントが切れた場合 if @face_duration.zero? # グラフィックを戻す @battler.battler_name = @ori_name end end # 元の処理を実行 mint_ctb_update # ダメージを更新 update_damage end end #============================================================================== # ■ Sprite_BattlerArrow #------------------------------------------------------------------------------ #  戦闘シーンでバトラーにアローカーソルを表示するクラスです。 # Sprite_Battlerクラスの内部で使用されます。 #============================================================================== class Sprite_BattlerArrow < Sprite #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super() @battler = nil self.bitmap = Cache.picture("arrow") self.visible = nil end #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- def dispose # スプライトを解放 self.bitmap.dispose self.bitmap = nil super end #-------------------------------------------------------------------------- # ● フレーム更新 # battler : 対象バトラー # visible : 可視状態 #-------------------------------------------------------------------------- def update(battler, visible) super() # バトラーが変更された場合 if @battler != battler # バトラーを更新 @battler = battler end # バトラーが無効な場合 if @battler.nil? # メソッドを返す return end # スプライトの座標を設定 self.x = @battler.screen_x self.y = @battler.screen_y - @battler.bit_height - 32 self.z = @battler.screen_z + 1 self.opacity = 255 # アクターの場合 if @battler.actor? # スプライトの座標を再設定 self.x = @battler.screen_x - SceneManager.scene.info_viewport.ox - 48 self.y = 272 self.z = 100 self.opacity = 160 end self.visible = (battler.alive? and visible) self.src_rect.set(0, battler.belong * 32, 32, 32) end end #============================================================================== # ■ Sprite_BattleStatus #------------------------------------------------------------------------------ #  戦闘シーンにおけるステータスを表示するクラスです。 # 内部は複数のスプライトで構成されています。 #============================================================================== class Sprite_BattleStatus < Sprite #-------------------------------------------------------------------------- # ● オブジェクト初期化 # actor : 対象アクター # viewport : ビューポート # window : 描写先のウィンドウ #-------------------------------------------------------------------------- def initialize(actor, viewport, window) super(viewport) @actor = actor @window = window self.bitmap = Bitmap.new(96, 128) self.y = 134 + 160 self.z = @window.z + 1 # スプライトを作成 @sprite = self.dup @sprite.z = @window.z + 2 draw_word refresh update end #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- def dispose # スプライトを解放 self.bitmap.dispose self.bitmap = nil @sprite.bitmap.dispose @sprite.bitmap = nil @sprite.dispose @sprite = nil super end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh self.bitmap.clear draw_item end #-------------------------------------------------------------------------- # ● ステートおよび強化/弱体のアイコンを描画 #-------------------------------------------------------------------------- def draw_actor_icons(x, y, width = 96) icons = (@actor.state_icons + @actor.buff_icons)[0, width / 24] icons.each_with_index {|n, i| draw_icon(n, x + 24 * i, y) } end #-------------------------------------------------------------------------- # ● アイコンの描画 # enabled : 有効フラグ。false のとき半透明で描画 #-------------------------------------------------------------------------- def draw_icon(icon_index, x, y, enabled = true) bitmap = Cache.system("Iconset") rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24) self.bitmap.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha) end #-------------------------------------------------------------------------- # ● ゲージの描画 # rate : 割合(1.0 で満タン) # color1 : グラデーション 左端 # color2 : グラデーション 右端 #-------------------------------------------------------------------------- def draw_gauge(x, y, width, rate, color1, color2, height) fill_w = (width * rate).to_i gauge_y = y + 16 self.bitmap.fill_rect(x, gauge_y, width, height, Color.new(0, 0, 0, 192)) self.bitmap.gradient_fill_rect(x, gauge_y, fill_w, height, color1, color2) end #-------------------------------------------------------------------------- # ● 用語の描画 #-------------------------------------------------------------------------- def draw_word @sprite.bitmap.font.outline = false @sprite.bitmap.font.size = 16 @sprite.bitmap.font.color = Color.new(128, 224, 255) @sprite.bitmap.frame_text(0, 19 * 2, 24, 24, Vocab::hp_a) @sprite.bitmap.frame_text(44, 19 * 2, 24, 24, Vocab::mp_a) @sprite.bitmap.frame_text(0, 19 * 4, 24, 24, Vocab::tp_a) end #-------------------------------------------------------------------------- # ● 項目の描画 #-------------------------------------------------------------------------- def draw_item x = 0 y = 0 # ゲージの描写 draw_gauge(x, y + (22 * 3) - 8, 40, @actor.hp_rate, @window.hp_gauge_color1, @window.hp_gauge_color2, 6) draw_gauge(x + 44, y + (22 * 3) - 8, 40, @actor.mp_rate, @window.mp_gauge_color1, @window.mp_gauge_color2, 6) draw_gauge(x, y + (22 * 4) - 8, 40, @actor.tp_rate, @window.tp_gauge_color1, @window.tp_gauge_color2, 6) draw_ct # 値の描写 self.bitmap.font.size = 22 self.bitmap.draw_text(x, 10 + y + (24 * 2), 40, 24, @actor.hp, 2) self.bitmap.draw_text(x + 44, 10 + y + (24 * 2), 40, 24, @actor.mp, 2) self.bitmap.font.size = 20 self.bitmap.draw_text(x, 10 + y + (24 * 3), 40, 24, @actor.tp.to_i, 2) # その他のステータスの描写 self.bitmap.font.size = 18 self.bitmap.draw_text(x + 4, y, 80, 24, @actor.name) draw_actor_icons(48, (22 * 4), 24) end #-------------------------------------------------------------------------- # ● CTゲージの描画 #-------------------------------------------------------------------------- def draw_ct # 詠唱中で無い場合 if @actor.at.zero? # CTゲージを描写 draw_gauge(0, (22 * 4) + 4, 40, (@actor.ct.rate(100) / 100.0), @window.mp_gauge_color1, @window.mp_gauge_color2, 4) # 詠唱中の場合 else # ATゲージを描写 color1 = Color.new(255, 0, 0) color2 = Color.new(192, 0, 255) draw_gauge(0, (22 * 4) + 4, 40, (@actor.at.rate(100) / 100.0), color1, color2, 4) end end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super # 座標を描写先のウィンドウに同期 self.x = @window.x + 8 + @actor.index * 104 @sprite.x = @window.x + 8 + @actor.index * 104 end end #============================================================================== # ■ Spriteset_Battle #------------------------------------------------------------------------------ #  バトル画面のスプライトをまとめたクラスです。このクラスは Scene_Battle クラ # スの内部で使用されます。 #============================================================================== class Spriteset_Battle #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :viewport1 # エネミー側のビューポート #-------------------------------------------------------------------------- # ● 戦闘背景の色調変更処理 # color : 変更する色調 # duration : 変更に掛ける時間 #-------------------------------------------------------------------------- def tone_change(color, duration) # 各種データを保存 @tone_color = color @change_rate = duration * 4 @duration_frame = duration * 4 # 各色調データを実際のものに変換 @red = @back1_sprite.tone.red - (((128 - color.red) * 2) * -1) @green = @back1_sprite.tone.green - (((128 - color.green) * 2) * -1) @blue = @back1_sprite.tone.blue - (((128 - color.blue) * 2) * -1) end #-------------------------------------------------------------------------- # ● フレーム更新 (色調変更) #-------------------------------------------------------------------------- def update_tone_change # 色調の変更が必要ない場合 if @duration_frame.to_i == 0 then # メソッドを返す return end # 残り時間を減らす @duration_frame -= 1 # 赤色の変更が必要な場合 if @red != 0 then # 赤色を変更 @back1_sprite.tone.red -= @red / @change_rate.to_f @back2_sprite.tone.red -= @red / @change_rate.to_f end # 緑色の変更が必要な場合 if @green != 0 then # 緑色を変更 @back1_sprite.tone.green -= @green / @change_rate.to_f @back2_sprite.tone.green -= @green / @change_rate.to_f end # 青色の変更が必要な場合 if @blue != 0 then # 青色を変更 @back1_sprite.tone.blue -= @blue / @change_rate.to_f @back2_sprite.tone.blue -= @blue / @change_rate.to_f end end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- alias minto_xp_battle_update update def update # 元の処理を実行 minto_xp_battle_update # 戦闘中でない場合 unless $game_party.in_battle return end # 戦闘背景色調変更スクリプトが無効な場合 unless MINTO::RGSS["戦闘背景色調変更"] then # 色調変更の更新 update_tone_change end # ビューポートを設定 for i in 0...@actor_sprites.size do @actor_sprites[i].viewport = SceneManager.scene.info_viewport end if SceneManager.scene.info_viewport SceneManager.scene.info_viewport.update end end end #============================================================================== # ■ Window_Battle_Help #------------------------------------------------------------------------------ # 戦闘メンバーのセリフを管理するウィンドウです。 #============================================================================== class Window_Battle_Help #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize # ビューポートを作成 @sprite = Sprite.new @sprite.opacity = 255 @sprite.y = 0 @sprite.z = 10000 @sprite.visible = false @sprite.bitmap = Bitmap.new(544, 32) @message_duration = 0 @wait_count = 0 @scroll = [] @scroll_count = 0 @scroll_duration = 0 @save_text = "" @text = [] @text_y = 0 @text_x = 0 @text_type = 0 @text_index = 0 @text_width = [] @align = [] @speed = 2 @belong = 0 @bitmap = Bitmap.new(544, 32) end #-------------------------------------------------------------------------- # ● アクター取得 #-------------------------------------------------------------------------- def get_actor(actor) @active_actor = actor end #-------------------------------------------------------------------------- # ● 可視状態の変更 #-------------------------------------------------------------------------- def visible=(visible) @sprite.visible = visible end #-------------------------------------------------------------------------- # ● フェード(変更) #-------------------------------------------------------------------------- def fade=(type) end #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- def dispose @bitmap.dispose @sprite.bitmap.dispose @sprite.dispose @sprite = nil end #-------------------------------------------------------------------------- # ● 文字色取得 # n : 文字色番号 (0〜7) #-------------------------------------------------------------------------- def text_color(n) case n when 0 then return normal_color when 1 then return system_color when 2 then return disabled_color when 3 then return Color.new(100, 200, 255) when 4 then return Color.new(255, 150, 0) when 5 then return Color.new(255, 0, 0) when 6 then return Color.new(150, 150, 255) when 7 then return Color.new(155, 155, 155) when 8 then return Color.new(255, 200, 0) end end #-------------------------------------------------------------------------- # ● 影文字描写 #-------------------------------------------------------------------------- def draw_shadow_text(x, y, width, height, text, ag = 0) # 元の色を保存 ori_color = @sprite.bitmap.font.color.clone # 影の色を定義 @sprite.bitmap.font.color.set(0, 0, 0) # 影文字を描写 @sprite.bitmap.draw_text(x+2, y+2, width, height, text, ag) # 元の色に戻す @sprite.bitmap.font.color = ori_color # 本体の文字を描写 @sprite.bitmap.draw_text(x, y, width, height, text, ag) end #-------------------------------------------------------------------------- # ● 縁文字描写 #-------------------------------------------------------------------------- def draw_frame_text(x, y, width, height, text, ag = 0) # 元の色を保存 ori_color = @sprite.bitmap.font.color.clone # 縁の色を定義 @sprite.bitmap.font.color.set(0, 0, 0) # 縁文字を描写 @sprite.bitmap.draw_text(x-1, y, width, height, text, ag) @sprite.bitmap.draw_text(x+1, y, width, height, text, ag) @sprite.bitmap.draw_text(x, y-1, width, height, text, ag) @sprite.bitmap.draw_text(x, y+1, width, height, text, ag) # 元の色に戻す @sprite.bitmap.font.color = ori_color # 本体の文字を描写 @sprite.bitmap.draw_text(x, y, width, height, text, ag) end #-------------------------------------------------------------------------- # ● テキスト設定 # text : スプライトに表示する文字列 # belong : 所属ID # speed : 描写速度 #-------------------------------------------------------------------------- def set_text(text = "", belong = 0, speed = 2) @belong = belong # 求められたテキストが無効な場合 if text.to_s == "" then @message_duration = 0 # テロップを不可視にする @sprite.visible = false # メソッドを終了 return end text = "\\al[1]" + text.dup + "\\w[8]" # スプライトを可視状態にする @sprite.visible = true # 各データを初期化 @scroll = [] @scroll_count = 0 @scroll_duration = 0 @save_text = "" @text = [] @text_width = [] @text_index = 0 @text_type = 0 @align = [] @sprite.opacity = 255 @speed = speed @press = false # 表示カウントを設定 @message_duration = 60 # 設定用のデータを定義 height_p = 1 max_height = 1 text_width = 0 max_width = 0 # テキストを再描画 @sprite.bitmap.clear bitmap = Cache.picture("help#{@belong}") @sprite.bitmap.blt(0, 0, bitmap, bitmap.rect) @sprite.bitmap.font.color = Color.new(255, 255, 255) @sprite.bitmap.font.size = 22 @sprite.bitmap.font.bold = false @sprite.bitmap.font.italic = false # 文字を複製 data = text.dup # 各制御文字を仮変換 data.gsub!(/\\\\/) { "\000" } data.gsub!(/\\[Cc]\[([0-9]+)\]/) { "" } data.gsub!(/\\[Ww]\[([0-9]+)\]/) { "" } data.gsub!(/\\[Ff][Oo]\[(.+?)\]/) { "" } data.gsub!(/\\[Nn]\[([0-9]+)\]/) { $game_actors[$1.to_i].name } data.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] } data.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\002[#{$1}]" } data.gsub!(/\\[Aa][Ll]\[([0-9]+)\]/) { "\004[#{$1}]" } data.gsub!(/\\[Ss][Ii]\[([0-9]+)\]/) { "\006[#{$1}]" } data.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\10[#{$1}]" } data.gsub!(/\\[Ii]\[([0-9]+)\]/) { "" } data.gsub!(/\\[Ss][Pp]\[([0-9]+)\]/) { "" } data.gsub!(/\\[Tt][Yy]\[([0-9]+)\]/) { "" } data.gsub!(/\\[Bb][Ww]/) { "" } data.gsub!(/\\[Ss][Tt]/) { "" } # c に 1 文字を取得 (文字が取得できなくなるまでループ) while ((c = data.slice!(/./m)) != nil) do # \SI[n] の場合 if c == "\006" then # 制御文字を処理 data.sub!(/\[([0-9]+)\]/, "") # 文字サイズを変更 @sprite.bitmap.font.size = [[$1.to_i, 32].min, 1].max # 次の文字へ next end # \S[n] の場合 if c == "\002" then # 文字幅が最高値以上の場合 if text_width > max_width then # 文字幅を更新 max_width = text_width end # 文字幅を記憶 @text_width.push(text_width) # 文字幅を初期化 text_width = 0 data.sub!(/\[([0-9]+)\]/, "") # 描写の高さを増やす height_p += 1 # スクロールが設定されていない場合 if $1.to_i == 0 then # 高さの上限を増やす max_height += 1 end # 次の文字へ next end # \AL[n] の場合 if c == "\004" then # 制御文字を処理 data.sub!(/\[([0-9]+)\]/, "") # アライメントを設定 @align[height_p-1] = $1.to_i # 次の文字へ next end # \B[n] の場合 if c == "\010" then # 制御文字を処理 data.sub!(/\[([0-9]+)\]/, "") # 太文字に変更 @sprite.bitmap.font.bold = ($1.to_i == 1) # 次の文字へ next end # text_width に描画した文字の幅を加算 text_width += @bitmap.text_size(c).width end # 文字幅を記憶 @text_width.push(text_width) # 文字幅が最高値以上の場合 if text_width > max_width # 文字幅を更新 max_width = text_width end refresh(text.dup) end #-------------------------------------------------------------------------- # ● リフレッシュ # text : スプライトに表示する文字列 #-------------------------------------------------------------------------- def refresh(text) # 基本情報を初期化 @text_y = 0 # 初期アライメントに応じて分岐 case @align[0].to_i # 左寄せ(デフォルト) when 0 then @text_x = 16 # 中央寄せ when 1 then @text_x = (544 - @text_width[0]) / 2 # 右寄せ when 2 then @text_x = 544 - @text_width[0] end # 文章のインデックスを初期化 @text_index = 0 # 表示待ちのメッセージがある場合 if text != "" then # 制御文字処理 begin last_text = text.clone end until text == last_text text.gsub!(/\\[Nn]\[([0-9]+)\]/) do $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : "" end # 便宜上、"\\\\" を "\000" に変換 text.gsub!(/\\\\/) { "\000" } # 各制御文字を実際のものに変換 text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" } text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\002[#{$1}]" } text.gsub!(/\\[Ww]\[([0-9]+)\]/) { "\003[#{$1}]" } text.gsub!(/\\[Aa][Ll]\[([0-9]+)\]/) { "" } text.gsub!(/\\[Ff][Oo]\[(.+?)\]/) { "\005[#{$1}]" } text.gsub!(/\\[Ss][Ii]\[([0-9]+)\]/) { "\006[#{$1}]" } text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\010[#{$1}]" } text.gsub!(/\\[Ii]\[([0-9]+)\]/) { "\016[#{$1}]" } text.gsub!(/\\[Bb][Ww]/) { "\017" } text.gsub!(/\\[Ss][Tt]/) { "\022" } text.gsub!(/\\[Ss][Pp]\[([0-9]+)\]/) { "\020[#{$1}]" } text.gsub!(/\\[Tt][Yy]\[([0-9]+)\]/) { "\021[#{$1}]" } text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] } @save_text = text.dup end end #-------------------------------------------------------------------------- # ● テキストの更新 #-------------------------------------------------------------------------- def text_update @text = @save_text.split(//) # 無効な文字列の場合 if @text[@text_index] == nil then # メソッドを返す return false end # テキストを取得 c = @text[@text_index] # \\ の場合 if c == "\000" then # 本来の文字に戻す c = "\\" end # \C[n] の場合 if c == "\001" then # 制御文字を処理 @save_text.sub!(/\[([0-9]+)\]/, "") # 文字色のIDを取得 color = $1.to_i # 文字色のIDが有効な場合 if color >= 0 then # 文字色を変更 @sprite.bitmap.font.color = text_color(color) end # インデックスを進める @text_index += 1 # メソッドを返す return true end # \S[n] の場合 if c == "\002" then # 制御文字を処理 @save_text.sub!(/\[([0-9]+)\]/, "") # スクロールを予約 @scroll.push($1.to_i+1) # インデックスを進める @text_index += 1 # @text_y に 1 を加算 @text_y += 1 # 現在の行のアライメントに応じて分岐 case @align[@text_y].to_i # 左寄せ(デフォルト) when 0 then @text_x = 16 # 中央寄せ when 1 then @text_x = (640 - @text_width[@text_y]) / 2 # 右寄せ when 2 then @text_x = 640 - @text_width[@text_y] end # メソッドを返す return true end # \W[n] の場合 if c == "\003" then # 制御文字を処理 @save_text.sub!(/\[([0-9]+)\]/, "") # ウェイトカウントを設定 @wait_count = $1.to_i # インデックスを進める @text_index += 1 # メソッドを返す return true end # \FO[n] の場合 if c == "\005" then # 制御文字を処理 @save_text.sub!(/\[(.+?)\]/, "") # フォントを変更 @sprite.bitmap.font.name = $1.to_s # インデックスを進める @text_index += 1 # メソッドを返す return true end # \SI[n] の場合 if c == "\006" then # 制御文字を処理 @save_text.sub!(/\[([0-9]+)\]/, "") # 文字サイズを変更 @sprite.bitmap.font.size = [[$1.to_i, 32].min, 1].max # インデックスを進める @text_index += 1 # メソッドを返す return true end # \B[n] の場合 if c == "\010" then # 制御文字を処理 @save_text.sub!(/\[([0-9]+)\]/, "") # 太文字に変更 @sprite.bitmap.font.bold = ($1.to_i == 1) # インデックスを進める @text_index += 1 # メソッドを返す return true end # \I[n] の場合 if c == "\016" then # 制御文字を処理 @save_text.sub!(/\[([0-9]+)\]/, "") # 斜体文字に変更 @sprite.bitmap.font.italic = ($1.to_i == 1) # インデックスを進める @text_index += 1 # メソッドを返す return true end # \BW の場合 if c == "\017" then # ボタン待ちフラグをオン @press = true # インデックスを進める @text_index += 1 # メソッドを返す return true end # \SP[n] の場合 if c == "\020" then # 制御文字を処理 @save_text.sub!(/\[([0-9]+)\]/, "") # 表示速度を変更 @speed = $1.to_i # インデックスを進める @text_index += 1 # メソッドを返す return true end # \TY[n] の場合 if c == "\021" then # 制御文字を処理 @save_text.sub!(/\[([0-9]+)\]/, "") # 文字の描写タイプを変更 @text_type = $1.to_i # インデックスを進める @text_index += 1 # メソッドを返す return true end # \ST の場合 if c == "\022" then # ホールドフラグをオン @hold = true # インデックスを進める @text_index += 1 # メソッドを返す return true end # 文字の描写タイプに応じて分岐 case @text_type # デフォルト when 0 then # 文字を描画 @sprite.bitmap.draw_text(@text_x, 32 * @text_y, 40, 26, c) # 影文字 when 1 then # 影文字を描画 draw_shadow_text(@text_x, 32 * @text_y, 40, 32, c) # 縁文字 when 2 then # 縁文字を描画 draw_frame_text(@text_x, 32 * @text_y, 40, 32, c) end # スプライトを可視状態にする @sprite.visible |= true # @text_x に描画した文字の幅を加算 @text_x += @bitmap.text_size(c).width # インデックスを進める @text_index += 1 return true end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update # ボタン入力待ちフラグがオンの場合 if @press == true then # C ボタンが押された場合 if Input.trigger?(Input::C) == true then # ボタン入力待ちフラグをオフ @press = false end # メソッドを返す return end # ウェイトカウントが 1 以上の場合 if @wait_count >= 1 then # ウェイトカウントを減らす @wait_count -= 1 # メソッドを返す return end # カウントが 0 の場合 if @message_duration == 0 then # メソッドを返す return end # 文章を更新中の場合 if text_update == true then # スピードが 0 の場合 if @speed == 0 then # 文章を更新(ループ) update end # メソッドを返す return # 文章の更新が終了した場合 else # 文章の表示速度を最速化 @speed = 1 end # 更新カウントが設定してある場合 if @message_duration >= 1 then # 更新カウントを減らす @message_duration -= 1 # 透明度を調節する @sprite.opacity -= 8 # 更新カウントが丁度 0 になった場合 if @message_duration == 0 then # テロップを不可視にする @sprite.visible = false end end end end #============================================================================== # ■ Window_Ct_Orders #------------------------------------------------------------------------------ # バトラーの行動順を表示するウィンドウです。 #============================================================================== class Window_Ct_Orders #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize return @sprite = Sprite.new @sprite.x = 0 @sprite.y = 0 @sprite.z = 10 @sprite.opacity = 116 @sprite.visible = false @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 = false @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") return # ピクチャーの読み込み 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) return # 行動者の名前を描写 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 return # 再描画開始 @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) return # 再描画開始 @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 return @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 #============================================================================== # ■ Window_BattleLog #------------------------------------------------------------------------------ #  戦闘の進行を実況表示するウィンドウです。枠は表示しませんが、便宜上ウィンド # ウとして扱います。 #============================================================================== class Window_BattleLog < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias mint_atb_initialize initialize def initialize # 元の処理を実行 mint_atb_initialize self.visible = MINTO.log_visible? end #-------------------------------------------------------------------------- # ● Y 座標の変更 #-------------------------------------------------------------------------- def y=(n) @back_sprite.y = n super(n) end #-------------------------------------------------------------------------- # ● 背景の不透明度を取得 #-------------------------------------------------------------------------- def back_opacity return 0 end #-------------------------------------------------------------------------- # ● ステート付加の表示 #-------------------------------------------------------------------------- alias mint_atb_display_added_states display_added_states def display_added_states(target) # ステートが付加された場合 unless target.result.added_state_objects.empty? # 付加したステートの表示 target.result.call_buff.push([3, target.result.added_state_objects]) end # 元の処理を実行 mint_atb_display_added_states(target) end #-------------------------------------------------------------------------- # ● ステート解除の表示 #-------------------------------------------------------------------------- alias mint_atb_display_removed_states display_removed_states def display_removed_states(target) # ステートが解除された場合 unless target.result.removed_state_objects.empty? # 解除したステートの表示 target.result.call_buff.push([2, target.result.removed_state_objects]) end # 元の処理を実行 mint_atb_display_removed_states(target) end #-------------------------------------------------------------------------- # ● 能力強化/弱体の表示 #-------------------------------------------------------------------------- alias mint_atb_display_changed_buffs display_changed_buffs def display_changed_buffs(target) # バフが付加された場合 unless target.result.added_buffs.empty? # 付加されたバフを取得 target.result.call_buff.push([0, target.result.added_buffs]) end # デバフが付加された場合 unless target.result.added_debuffs.empty? # 付加されたデバフを取得 target.result.call_buff.push([1, target.result.added_debuffs]) end # バフが解除された場合 unless target.result.removed_buffs.empty? # 解除されたバフを取得 target.result.call_buff.push([2, target.result.removed_buffs]) end # 元の処理を実行 mint_atb_display_changed_buffs(target) end end #============================================================================== # ■ Window_ActorCommand #------------------------------------------------------------------------------ #  バトル画面で、アクターの行動を選択するウィンドウです。 #============================================================================== class Window_ActorCommand < Window_Command #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias mint_ctb_initialize initialize def initialize # 元の処理を実行 mint_ctb_initialize @arrow = Sprite_BattlerArrow.new end #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- def dispose # スプライトを解放 @arrow.dispose @arrow = nil super end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super @arrow.update(@actor, self.open?) end end #============================================================================== # ■ Window_BattleStatus #------------------------------------------------------------------------------ #  バトル画面で、パーティメンバーのステータスを表示するウィンドウです。 #============================================================================== class Window_BattleStatus < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(0, 0, window_width, window_height) self.openness = 0 @index = 0 @sprites = [] self.z = 100 end #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- def dispose super # スプライトが有効な場合 unless @sprites.empty? # ループ処理 for i in 0...@sprites.size # スプライトを解放 @sprites[i].dispose @sprites[i] = nil end end end #-------------------------------------------------------------------------- # ● 桁数の取得 #-------------------------------------------------------------------------- def col_max return $game_party.battle_members.size end #-------------------------------------------------------------------------- # ● カーソルの更新 #-------------------------------------------------------------------------- def update_cursor if @cursor_all cursor_rect.set(0, 0, contents.width, row_max * item_height) self.top_row = 0 elsif @index.to_i < 0 cursor_rect.empty else ensure_cursor_visible cursor_rect.set(Rect.new(96 * @index, 0, 96, 96)) end end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh # ウィンドウの内容をクリア self.contents.clear # 最大人数を計算 party_size = $game_party.battle_members.size max_size = party_size > 4 ? $game_party.battle_members.size : 4 # 自身がバトルステータスウィンドウの場合 unless self.is_a?(Window_BattleActor) # ループ処理 for i in 0...max_size do # アクターを取得 actor = $game_party.battle_members[i] # スプライト未作成の場合 if @sprites[i].nil? # アクターが有効な場合 unless actor.nil? # スプライトを作成 @sprites[i] = Sprite_BattleStatus.new(actor, self.viewport, self) end # スプライト作成済みの場合 else # アクターが無効な場合 if actor.nil? # スプライトを解放 @sprites[i].dispose @sprites[i] = nil else # スプライトを再描写 @sprites[i].refresh end end end end @sprites.compact! # ループ処理 for i in 0...$game_party.battle_members.size do # その他の項目を描写 draw_item(i) end end #-------------------------------------------------------------------------- # ● 現在のCTの描画 #-------------------------------------------------------------------------- def draw_ct # スプライトが有効な場合 unless @sprites.empty? # ループ処理 for i in 0...@sprites.size # スプライトを更新 @sprites[i].draw_ct end end end #-------------------------------------------------------------------------- # ● 項目の描画 #-------------------------------------------------------------------------- def draw_item(index) # 空実行 end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super # スプライトが有効な場合 unless @sprites.empty? # ループ処理 for i in 0...@sprites.size # スプライトを更新 @sprites[i].update end end end end #============================================================================== # ■ Window_BattleActor #------------------------------------------------------------------------------ #  バトル画面で、行動対象のアクターを選択するウィンドウです。 #============================================================================== class Window_BattleActor < Window_BattleStatus #-------------------------------------------------------------------------- # ● オブジェクト初期化 # info_viewport : 情報表示用ビューポート #-------------------------------------------------------------------------- def initialize(info_viewport) super() self.y = 296 self.visible = false self.openness = 255 self.opacity = 0 @info_viewport = info_viewport end #-------------------------------------------------------------------------- # ● ウィンドウの表示 #-------------------------------------------------------------------------- def show if @info_viewport width_remain = Graphics.width - width #self.x = width_remain #@info_viewport.rect.width = width_remain select(0) end super end end #============================================================================== # ■ Window_BattleEnemy #------------------------------------------------------------------------------ #  バトル画面で、行動対象の敵キャラを選択するウィンドウです。 #============================================================================== class Window_BattleEnemy < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 # info_viewport : 情報表示用ビューポート #-------------------------------------------------------------------------- alias mint_ctb_initialize initialize def initialize(info_viewport) # 元の処理を実行 mint_ctb_initialize(info_viewport) self.z += 100 self.y = 296 @arrow = Sprite_BattlerArrow.new end #-------------------------------------------------------------------------- # ● 解放 #-------------------------------------------------------------------------- def dispose # スプライトを解放 @arrow.dispose @arrow = nil super end #-------------------------------------------------------------------------- # ● ウィンドウの表示 #-------------------------------------------------------------------------- def show if @info_viewport width_remain = Graphics.width - width #self.x = width_remain #@info_viewport.rect.width = width_remain select(0) end super end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super @arrow.update(self.enemy, self.visible) end end #============================================================================== # ■ Window_BattleSkill #------------------------------------------------------------------------------ #  バトル画面で、使用するスキルを選択するウィンドウです。 #============================================================================== class Window_BattleSkill < Window_SkillList #-------------------------------------------------------------------------- # ● オブジェクト初期化 # info_viewport : 情報表示用ビューポート #-------------------------------------------------------------------------- def initialize(help_window, info_viewport) y = help_window.height super(0, 72, Graphics.width, 224) self.visible = false @help_window = help_window @info_viewport = info_viewport end end #============================================================================== # ■ Window_BattleItem #------------------------------------------------------------------------------ #  バトル画面で、使用するアイテムを選択するウィンドウです。 #============================================================================== class Window_BattleItem < Window_ItemList #-------------------------------------------------------------------------- # ● オブジェクト初期化 # info_viewport : 情報表示用ビューポート #-------------------------------------------------------------------------- def initialize(help_window, info_viewport) y = help_window.height super(0, 72, Graphics.width, 224) self.visible = false @help_window = help_window @info_viewport = info_viewport end end #============================================================================== # ■ Scene_Battle #------------------------------------------------------------------------------ #  バトル画面の処理を行うクラスです。 #============================================================================== class Scene_Battle < Scene_Base #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :active_battler # アクティブバトラー attr_reader :action_battlers # アクションバトラーズ attr_reader :active_battlers # アクティブバトラーズ attr_reader :spriteset # スプライトセット attr_reader :status_window # ステータスウィンドウ attr_reader :info_viewport # ビューポート attr_accessor :call_blackout # 暗転呼び出しフラグ #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- alias mint_ctb_start start def start # 関連データ初期化 @action_battlers = [] @active_battlers = [] @special_battle_effect = {} @last_name = [] @battle_turn = nil @window_y = 136 + 160 @battle_turn = [] @battle_turn[0] = $game_troop.turn_count @battle_turn[1] = $game_troop.turn_count # 元の処理を実行 mint_ctb_start # CTウィンドウを作成 @ct_window = Window_Ct_Orders.new # バトルヘルプを作成 @bt_help = Window_Battle_Help.new # メンバーを作成 member_set # イニシアティブをリセット initiative_reset end #-------------------------------------------------------------------------- # ● 終了処理 #-------------------------------------------------------------------------- alias mint_ctb_terminate terminate def terminate # CTウィンドウを解放 @ct_window.dispose # バトルヘルプを解放 @bt_help.dispose # 元の処理を実行 mint_ctb_terminate end #-------------------------------------------------------------------------- # ● フレーム更新(ウェイト用) #-------------------------------------------------------------------------- def update_for_wait @bt_help.update update_basic end #-------------------------------------------------------------------------- # ● パーティコマンドウィンドウの作成 #-------------------------------------------------------------------------- alias mint_ctb_create_party_command_window create_party_command_window def create_party_command_window # 元の処理を実行 mint_ctb_create_party_command_window # Y 座標を再設定 @party_command_window.y = @window_y end #-------------------------------------------------------------------------- # ● アクターコマンドウィンドウの作成 #-------------------------------------------------------------------------- alias mint_ctb_create_actor_command_window create_actor_command_window def create_actor_command_window # 元の処理を実行 mint_ctb_create_actor_command_window # Y 座標を再設定 @actor_command_window.y = @window_y end #-------------------------------------------------------------------------- # ● 情報表示ビューポートの作成 #-------------------------------------------------------------------------- def create_info_viewport @info_viewport = Viewport.new(0, 0, 544, 416) @status_window.y = @window_y @info_viewport.z = 100 @info_viewport.ox = 64 @status_window.viewport = @info_viewport end #-------------------------------------------------------------------------- # ● コマンド[戦う] #-------------------------------------------------------------------------- def command_fight next_command # アクターコマンドを選択可能にする @active_battlers[0].command_call = true start_party_command_selection(1) end #-------------------------------------------------------------------------- # ● 敵キャラ選択の開始 #-------------------------------------------------------------------------- def select_enemy_selection @enemy_window.refresh @enemy_window.show.activate case @actor_command_window.current_symbol when :skill @skill_window.hide text = @skill_window.item.name + "\\bw" @bt_help.set_text(text, @subject.belong) when :item @item_window.hide end end #-------------------------------------------------------------------------- # ● 敵キャラ[キャンセル] #-------------------------------------------------------------------------- def on_enemy_cancel @enemy_window.hide case @actor_command_window.current_symbol when :attack @actor_command_window.activate when :skill @skill_window.activate @skill_window.show @bt_help.visible = false when :item @item_window.activate end end #-------------------------------------------------------------------------- # ● スキル[決定] #-------------------------------------------------------------------------- alias mint_ctb_on_skill_ok on_skill_ok def on_skill_ok @skill = @skill_window.item # スキルを設定 call_determine_skill(@subject, @skill) # 元の処理を実行 mint_ctb_on_skill_ok # 暗転フラグをクリア @call_blackout = false end #-------------------------------------------------------------------------- # ● スキル[キャンセル] #-------------------------------------------------------------------------- alias mint_ctb_on_skill_cancel on_skill_cancel def on_skill_cancel # 元の処理を実行 mint_ctb_on_skill_cancel # アクションをクリア @subject.actions.clear @subject.make_actions # ATをクリア @subject.action_skillclear # 暗転フラグをクリア @call_blackout = false end #-------------------------------------------------------------------------- # ● ターン開始 #-------------------------------------------------------------------------- def turn_start # 暗転フラグをクリア @call_blackout = false # ウィンドウを閉じる @party_command_window.close @actor_command_window.close @status_window.unselect BattleManager.turn_start # ログのウェイト処理 @log_window.wait @log_window.clear # アクティブバトラーが有効な場合 unless @subject.nil? # 詠唱中の場合 if @subject.at > 0 # 詠唱エフェクトの実行を予約 @subject.call_spell_effect = MINTO::Spell_Effect end end end #-------------------------------------------------------------------------- # ● ターン終了 #-------------------------------------------------------------------------- def turn_end # アクティブバトラーが存在する場合 unless @subject.nil? # 再生処理 @subject.regenerate_all # アクティブバトラーが無効な場合 else # アクションバトラーを詰める @action_battlers.clear end # ターンが経過した場合 if @battle_turn[0] != $game_troop.turn_count # ターン経過カウントを更新 @battle_turn[0] = $game_troop.turn_count # ループ処理 for battler in @member # ステートの自然解除(ターン終了) battler.on_turn_end @log_window.display_auto_affected_status(battler) @log_window.wait_and_clear end end # ステータスウィンドウをリフレッシュ refresh_status #BattleManager.turn_end # イベントを更新 process_event end #-------------------------------------------------------------------------- # ● パーティコマンド選択の開始 #-------------------------------------------------------------------------- def start_party_command_selection(order = 2) unless scene_changing? refresh_status @status_window.unselect @status_window.open if BattleManager.input_start and order == 0 @actor_command_window.close @party_command_window.setup elsif BattleManager.input_start and order == 1 next_command @party_command_window.close start_actor_command_selection elsif order == 2 @party_command_window.deactivate turn_start elsif order == 3 next_command @party_command_window.close start_actor_command_selection end end end #-------------------------------------------------------------------------- # ● アクターコマンド選択の開始 #-------------------------------------------------------------------------- def start_actor_command_selection # コマンド選択が可能な場合 if @active_battlers[0].command_call == true # アクターコマンドを選択不可能にする #@active_battlers[0].command_call = false # 自動戦闘の場合 if @active_battlers[0].auto_battle? # アクションを作成 @active_battlers[0].make_actions # メソッドを返す return end # 先頭のアクションバトラーをアクティブバトラーにする @subject = @action_battlers[0] # ステータスインデックスを設定 @status_window.select(@subject.index) @actor_command_window.setup(@subject) # メソッドを返す return # コマンド選択が不可能な場合 else # メイン処理を開始する turn_start # メソッドを返す return end end #-------------------------------------------------------------------------- # ● 前のコマンド入力へ #-------------------------------------------------------------------------- def prior_command # アクターコマンドを選択可能にする @active_battlers[0].command_call = true # ステータスインデックスを設定 #@status_window.index = @status_index # パーティーコマンドの選択を開始 start_party_command_selection(0) # メソッドを返す return end #-------------------------------------------------------------------------- # ● スキルの決定処理 # battler : 対象者 # skill : スキル #-------------------------------------------------------------------------- def call_determine_skill(battler, skill) # スキル情報を保存 battler.action_skill = skill.dec # エネミーの場合 if battler.enemy? battler.action_skill = battler.actions[0].item.dec end # 初期AT加算 battler.at = at_count(battler) # ノンチャージの場合 if battler.at >= 100.0 or battler.state_include?("ノンチャージ") or battler.action_skill.spell == 200 # ATを100にする battler.at = 100 # ノンチャージで無い場合 else # エネミーの場合 if battler.enemy? # 詠唱中の場合 if battler.at > 0 # 詠唱エフェクトの実行を予約 battler.call_spell_effect = MINTO::Spell_Effect end end end end #-------------------------------------------------------------------------- # ● 戦闘行動の処理 #-------------------------------------------------------------------------- def process_action # シーン変更中の場合 if scene_changing? # メソッドを返す return end @log_window.y = 0 @bt_help.visible = false # アクティブバトラーが有効な場合 unless @subject.nil? # 制約などで行動が出来ない場合 unless @subject.movable? # CTを減算 ct_consumption(@subject, 0, 0) end end # 未行動バトラーが存在しない場合 (全員行動した) if @action_battlers.empty? # バトルイベント実行中でない場合 unless $game_troop.interpreter.running? # 先頭のバトラーを削除 @active_battlers[0] = nil @active_battlers.compact! end # CTをカウント ct_count # メソッドを返す return turn_end end # アクティブバトラーが無効か行動が終了した場合 if not @subject or not @subject.current_action # アクティブバトラーを取得 @subject = BattleManager.next_subject end # アクティブバトラーが存在しない場合 unless @subject # メソッドを返す return turn_end end # 何らかのアクションが存在する場合 if @subject != nil and @subject.current_action @subject.current_action.prepare if @subject.current_action.valid? @status_window.open execute_action end @subject.remove_current_action end end #-------------------------------------------------------------------------- # ● 戦闘行動の実行 #-------------------------------------------------------------------------- alias mint_ctb_execute_action execute_action def execute_action # アクティブバトラーがエネミーの場合 unless @subject.actor? # スキル攻撃の場合 if @subject.actions[0].kind == 1 # スキル未取得の場合 if @subject.action_skill.nil? # スキルを設定 call_determine_skill(@subject, @skill) end end end # 元の処理を実行 mint_ctb_execute_action end #-------------------------------------------------------------------------- # ● スキル/アイテムの使用 #-------------------------------------------------------------------------- def use_item # 行動の取得(スキル/アイテムの分別) item = @subject.current_action.item # 行動がスキルの場合 if item.is_a?(RPG::Skill) @skill = item.dec # ATが溜まっていない場合 if @subject.at > 0 and @subject.at < 100.0 # ステータスを再描写 refresh_status # ターゲットの作成 targets = @subject.current_action.make_targets.compact targets.each { |target| @subject.last_target_index = target.index } @subject.target = targets.dup # アクションを詰める ct_consumption(@subject, 0, 0) # メソッドを返す return end # 詠唱エフェクトを解放 @subject.spell_effect.mode = 2 # 行動がスキルの場合 if item.is_a?(RPG::Skill) # 基本コマンド以外の場合 if item.id >= 3 # スキル名を表示 @bt_help.set_text(item.name, @subject.belong) @log_window.y = 32 # 背景を暗転 @call_blackout = true end end # ターゲットの更新 update_target # スキルが無効な場合(エネミー用) if @skill.nil? # スキルを再設定 @skill = @subject.action_skill end # CTチャージスキルの場合 if @skill.charge? # 保存用のターゲットが有効な場合 unless @subject.target.nil? # ターゲットを入れ替える targets = @subject.target.dup end # ループ処理(ターゲット) for target in targets # CTが100未満の場合 if target.ct < 100.0 # CTをチャージ target.ct = 100.0 end # ATが100未満の場合 if target.at > 0 # ATをチャージ target.at = 100.0 end end end # 連続行動スキルの場合 if @skill.multi_attack >= 1 # 保存用のターゲットが有効な場合 unless @subject.target.nil? # ターゲットを入れ替える targets = @subject.target.dup end # ループ処理(ターゲット) for target in targets # CTをチャージ target.ct = (@skill.multi_attack + 1) * 100 # アクティブバトラーズの先頭に追加 (@skill.multi_attack + 1).times do @active_battlers.unshift(target) end # ATが100未満の場合 if target.at >= 1 # ATをチャージ target.at = 100 end end end # アクティブバトラーのCTを減算 ct_consumption(@subject, @subject.actions[0].kind, @subject.actions[0].basic) # 行動がアイテムの場合 else # アクティブバトラーのCTを減算 ct_consumption(@subject, @subject.actions[0].kind, @subject.actions[0].basic) end # 行動を取得 item = @subject.current_action.item # ログを表示 @log_window.display_use_item(@subject, item) # アイテムを使用する @subject.use_item(item) # ステータスウィンドウを再描写 refresh_status # ターゲット作成 targets = @subject.current_action.make_targets.compact # 保存用のターゲットが有効な場合 unless @subject.target.nil? # ターゲットを入れ替える targets = @subject.target.dup @subject.target = nil end # アニメーションの表示 show_animation(targets, item.animation_id) # 行動の効果適用 targets.each {|target| item.repeats.times { invoke_item(target, item) } } end #-------------------------------------------------------------------------- # ● ターゲットの更新 #-------------------------------------------------------------------------- def update_target targets = [] # 保存用のターゲットが無効な場合 if @subject.target.nil? @subject.target = [] end # ループ処理(ターゲット) for target in @subject.target do # ターゲットが存在する場合 if target.alive? # 新しい配列にプッシュ targets.push(target) end end # ターゲットが無効な場合 if targets.empty? # 新しいターゲットを作成 targets = @subject.current_action.make_targets.compact end # 効果範囲が全体の場合 unless @subject.current_action.item.for_one? # ターゲットを再作成 targets = @subject.current_action.make_targets.compact end # ターゲットを更新 @subject.target = targets end #-------------------------------------------------------------------------- # ● CTの減算 # battler : 対象者 # kind : 行動 # basic : 基本行動の種類 #-------------------------------------------------------------------------- def ct_consumption(battler, kind, basic) # 特殊通常攻撃スクリプトが有効な場合 if MINTO::RGSS["特殊通常攻撃スクリプト"] == true # 特殊通常攻撃発動中の場合 unless @special_attack_skill[battler].nil? # 攻撃回数が残っている場合 if @special_attack_skill[battler].attack_bonus >= 1 # メソッドを返す return end end end # アクションバトラーを詰める @action_battlers.shift # 何らかのスキルをチャージ中の場合 if battler.at > 0.0 and battler.at < 100.0 # メソッドを返す return end # ターンが経過した場合 if @battle_turn[1] != $game_troop.turn_count # ターン経過カウントを更新 @battle_turn[1] = $game_troop.turn_count for target in @member # ステートの自然解除(行動終了) target.on_action_end # ログを表示 @log_window.display_auto_affected_status(target) @log_window.wait_and_clear @log_window.display_current_state(target) @log_window.wait_and_clear end end # 制約などで行動が出来ない場合 unless battler.movable? # CTからマイナス100 battler.ct -= 100.0 # 保存用のスキル情報をクリア battler.action_skillclear # メソッドを返す return end case kind # 基本行動 when 0 # 防御中の場合 if basic == 1 battler.ct -= $data_skills[2].wait # 防御以外の基本行動の場合 else battler.ct -= 100.0 end # スキル when 1 # CTからスキルの設定値分 battler.ct -= battler.action_skill.wait # 保存用のスキル情報をクリア battler.action_skillclear # アイテム when 2 # CTからマイナス100 battler.ct -= 100.0 end # 戦闘行動終了時の処理へ移行 process_action_end end #-------------------------------------------------------------------------- # ● 戦闘行動終了時の処理 #-------------------------------------------------------------------------- def process_action_end BattleManager.judge_win_loss end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- alias mint_ctb_update update def update # 元の処理を実行 mint_ctb_update # バトルヘルプを更新 @bt_help.update end #-------------------------------------------------------------------------- # ● メンバー作成 #-------------------------------------------------------------------------- def member_set # メンバー用の配列を初期化 @member = $game_party.battle_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.battle_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 = rand(25) battler.ct2 = 0 battler.at = 0 battler.at2 = 0 # メンバーの行動速度と # 素早さ分の乱数を足した値をイニシアティブに代入 battler.initiative = battler.spd + rand(battler.agi) # アクションをクリア battler.actions.clear battler.action_skillclear end # アクティブバトラーズを初期化 @active_battlers = [] # アクションバトラーズを初期化 @action_battlers = [] end #-------------------------------------------------------------------------- # ● スキルセット #-------------------------------------------------------------------------- def skill_set(battler) # アクティブバトラーにシフト @subject = battler # 制約などで、スキルを使用する事が出来なくなった場合 unless @subject.skill_conditions_met?(@subject.action_skill) # アクションを何もしないに変更 battler.action_skillclear # メインフェーズ開始 turn_start return end # アクションをクリア @subject.actions.clear @subject.make_skill_actions # アクションをスキルに設定 @subject.actions[0].set_skill(@subject.action_skill.id) # メインフェーズ開始 turn_start end #-------------------------------------------------------------------------- # ● 行動者を決定 #-------------------------------------------------------------------------- def set_action_battler # ステータスウィンドウをリフレッシュ @status_window.refresh # 先頭のバトラーが行動不能の場合 unless @active_battlers[0].alive? # CTを初期化 @subject.ct = 0.0 @subject.action_skillclear # 先頭のバトラーを削除 @active_battlers[0] = nil @active_battlers.compact! return end @subject = @active_battlers[0] # 行動者決定 case @active_battlers[0] # アクターの場合 when Game_Actor # アクションバトラーにプッシュ @action_battlers.push(@active_battlers[0]) # ATが100の場合 if @active_battlers[0].at.to_i >= 100 and not @active_battlers[0].action_skill.nil? # スキルを実行 skill_set(@active_battlers[0]) # それ以外の場合 else # バトルイベント実行中でなければ unless $game_troop.interpreter.running? # ATをクリア @active_battlers[0].action_skillclear # アクターコマンド呼び出し準備 @info_viewport.visible = true # アクターコマンドを選択不可能にする @active_battlers[0].command_call = false # コマンド入力が可能な場合 if @active_battlers[0].inputable? # アクターコマンドを選択可能にする @active_battlers[0].command_call = true # アクターコマンド選択開始 BattleManager.next_command start_party_command_selection(3) #start_actor_command_selection # SEデータを代入 data = MINTO::Command_SE # SEを演奏する Audio.se_play("Audio/SE/#{data[0]}", data[1], data[2]) # コマンド入力が不可能な場合 else # メインフェーズ開始 turn_start # 制約などで行動が出来ない場合 unless @active_battlers[0].movable? # CTを減算する ct_consumption(@active_battlers[0], 0, 0) end end end end # エネミーの場合 when Game_Enemy # アクションバトラーにプッシュ @action_battlers.push(@active_battlers[0]) # ATが100の場合 if @active_battlers[0].at.to_i >= 100 and not @active_battlers[0].action_skill.nil? # スキルを実行 skill_set(@active_battlers[0]) # それ以外ならメインフェーズ開始 else #@active_battlers[0].slip_ng = false # バトルイベント実行中でなければ unless $game_troop.interpreter.running? # ATをクリア @active_battlers[0].action_skillclear # アクションを作成 @active_battlers[0].make_actions # メインフェーズ開始 turn_start # 制約などで行動が出来ない場合 unless @active_battlers[0].movable? # CTを減算する ct_consumption(@active_battlers[0], 0, 0) end end end end end #-------------------------------------------------------------------------- # ● ATカウントを取得 # battler : 対象バトラー #-------------------------------------------------------------------------- def at_count(battler) return ((battler.action_skill.spell / 2.0) / MINTO::Battle_Speed) end #-------------------------------------------------------------------------- # ● CTカウント #-------------------------------------------------------------------------- def ct_count # クロック数 clock = 0 # 再描写フラグ refresh = false # アクションバトラーを初期化 @action_battlers.clear # ターン内先制の処理 #for battler in $game_party.battle_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 BattleManager.preemptive and not @preemptive # アクター側の処理 for battler in $game_party.battle_members # 初期CTを100にする battler.ct = 100.0 end # 再描写を行う refresh = true # フラグをクリア @preemptive = true # 敵の不意打ちの場合 elsif BattleManager.surprise and not @surprise # エネミー側の処理 for battler in $game_troop.members # 初期CTを100にする battler.ct = 100.0 end # 再描写を行う refresh = true # フラグをクリア @surprise = true end # 先制攻撃フラグを解除 BattleManager.preemptive = false # 不意打ちフラグを解除 BattleManager.surprise = false # 先頭の行動者が返るまで繰り返す while @active_battlers[0] == nil # クロック数を加算 clock += 1 @status_window.draw_ct @status_window.update @info_viewport.update @spriteset.update @bt_help.update update_info_viewport Graphics.update # CT加算処理開始 for battler in @member # ATがない場合 if battler.at == 0 # CTが100未満の場合 if battler.ct < 100.0 # CTにSPDを加算(戦闘不能か動けない場合は終了) if battler.alive? and battler.movable? battler.ct += battler.true_spd end # CTが100以上の場合 else # アクティブバトラーズにプッシュ(戦闘不能の場合は終了) if battler.alive? @active_battlers.push(battler) else # CTを初期化 battler.ct = 0.0 end end # スキルの場合 else # 詠唱演出を更新 battler.spell_effect.speed = ((100 - battler.at) / 10.0).to_min(1) # ATが100未満の場合 if battler.at < 100.0 # ATにスキルの詠唱値を加算(戦闘不能か動けない場合は終了) if battler.alive? and battler.movable? # ショートチャージならチャージタイムを半分に if battler.state_include?("ショートチャージ") battler.at += at_count(battler) * 2 else battler.at += at_count(battler) end else # ATを0に設定 battler.at = 0 end # ATが100以上の場合 else # アクティブバトラーズにプッシュ(戦闘不能の場合は終了) if battler.alive? @active_battlers.push(battler) else # ATを0に設定 battler.at = 0 end end end end end # 先頭のバトラーを行動させる set_action_battler # 極端な処理落ちを防止する Graphics.frame_reset end end Data_States.initialize($BTEST) end