幻想森林

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

话说...实用脚本收集

[复制链接]

845

主题

1万

帖子

214748万

积分

版主

脑残中……

Rank: 7Rank: 7Rank: 7

积分
2147483647

声命组金赏

发表于 2006-9-13 11:08:39 | 显示全部楼层 |阅读模式
楼顶留空
http://icv.cc声动音缘配音社
回复

使用道具 举报

845

主题

1万

帖子

214748万

积分

版主

脑残中……

Rank: 7Rank: 7Rank: 7

积分
2147483647

声命组金赏

 楼主| 发表于 2006-9-13 11:09:56 | 显示全部楼层

貌似是用步行图来横版战斗

  1. #==============================================================================
  2. # ++ アクティブタイムバトル ver. 2.57 ++
  3. #  Script by パラ犬
  4. #  [url]http://2d6.parasite.jp/[/url]
  5. #------------------------------------------------------------------------------
  6. # CTゲージが溜まったバトラーから順にコマンド入力する戦闘形式。
  7. # バトルステータス画面をサイドビューらしくする機能もあります。
  8. # バトラーをサイドビュータイプに表示するスクリプトは、お好きなものを
  9. # 用意してください。
  10. #------------------------------------------------------------------------------
  11. #[設置上の注意]
  12. # できるだけリストの上のほうに置いてください。(Scene_Debugよりは下)
  13. #------------------------------------------------------------------------------
  14. #[操作]
  15. #・逃走
  16. # 味方バトラーの一人以上がコマンド入力待ちのときにキャンセルボタンを押すことで
  17. # 「逃げる」コマンドが選択できます。
  18. # 敵の数が多かったり、コマンド入力待ちのバトラーが少ないと、
  19. # 逃走成功率が低くなります。
  20. #
  21. #・行動順の入れ替え
  22. # 複数のバトラーが行動可能のとき、
  23. # Rボタン(PageDownキー)で次のバトラーと順番を入れ替え、
  24. # Lボタン(PageUpキー)で行動順をいちばん最後に回します。
  25. #==============================================================================
  26. module PARA_CTB
  27.   
  28.   # コマンド入力時にCTのカウントを止めるか(true:止める / false:止めない)
  29.   COMMAND_WAIT = false
  30.   # アイテム、スキル、ターゲット選択時にCTのカウントを止めるか(true:止める / false:止めない)
  31.   SELECT_WAIT = true
  32.   # アニメーション表示時にCTのカウントを止めるか(true:止める / false:止めない)
  33.   ANIMATION_WAIT = false
  34.   
  35.   # バトルスピード(数値が大きいほどCTの溜まりが速くなる)
  36.   BATTLE_SPEED = 3
  37.   # バトルメンバーの最大数(多人数PTスクリプトを導入している時に設定)
  38.   PARTY_SIZE = 4
  39.   
  40.   # 行動終了時のCT減少パーセンテージ
  41.   ACT_ATTACK_CT = 100   # 通常攻撃
  42.   ACT_GUARD_CT = 100    # 防御
  43.   ACT_ESCAPE_CT = 100   # 逃走失敗
  44.   ACT_SKILL_CT = 100    # スキル
  45.   ACT_ITEM_CT = 100     # アイテム
  46.   
  47.   # 逃走失敗時のメッセージ
  48.   UNESCAPE_MES = "逃走失敗"
  49.   # CT満タン時の効果音(""で音を鳴らさない)
  50.   # 効果音は「Audio/SE」フォルダ内
  51.   FULL_CT_SE = "015-Jump01"
  52.   # 効果音のボリューム
  53.   FULL_CT_SE_VOL = 80
  54.   # CT満タン時のバトラーの色調((0,0,0)で変化なし)
  55.   FULL_CT_COLOR = Tone.new(32,0,0)
  56.   
  57.   # HPゲージの色(グラデーション左端)
  58.   HP_COLOR_LEFT = Color.new(128, 0, 0, 255)
  59.   # HPゲージの色(グラデーション右端)
  60.   HP_COLOR_RIGHT= Color.new(255, 0, 0, 255)
  61.   # SPゲージの色(グラデーション左端)
  62.   SP_COLOR_LEFT = Color.new(0, 0, 128, 255)
  63.   # SPゲージの色(グラデーション右端)
  64.   SP_COLOR_RIGHT= Color.new(0, 0, 255, 255)
  65.   # CTゲージの色(グラデーション左端)
  66.   COLOR_LEFT = Color.new(128, 128, 64, 255)
  67.   # CTゲージの色(グラデーション右端)
  68.   COLOR_RIGHT= Color.new(255, 255, 128, 255)
  69.   # CTが満タンになったときのゲージの色
  70.   COLOR_FULL = Color.new(255, 225, 128, 255)
  71.   
  72.   # ゲージ枠の色
  73.   FRAME_COLOR = Color.new(192, 192, 192, 255)
  74.   # ゲージ枠の太さ
  75.   FRAME_BORDER = 1
  76.   # ゲージの背景色
  77.   BACK_COLOR = Color.new(128, 128, 128, 128)
  78.   # 名前のフォントサイズ
  79.   NAME_FONT_SIZE = 16
  80.   # HP/SPのフォントサイズ
  81.   HPSP_FONT_SIZE = 18
  82.   # エネミー名のフォントサイズ
  83.   ENEMY_FONT_SIZE = 16
  84.   # 最大HP/SPを描画するか( true / false )
  85.   MAX_DRAW = false
  86.   # エネミー名をグループ化( true / false )
  87.   # (trueにすると「ゴースト 2」のようにまとめて表示します)
  88.   ENEMY_GROUPING = false
  89.   # エネミー名の下にゲージを表示( 0:なし / 1:HP / 2:CT )
  90.   # (エネミー名をグループ化している場合は無効)
  91.   ENEMY_DRAWING_MATER = 0
  92.   
  93.   # アクターのヘルプウインドウにHP/SPゲージを表示( true / false )
  94.   HELP_DRAWING_MATER_ACTOR = false
  95.   # エネミーのヘルプウインドウにHP/SPゲージを表示( true / false )
  96.   HELP_DRAWING_MATER_ENEMY = false
  97.   
  98.   # コマンドウインドウの位置を強制指定( true / false )
  99.   #(他の方のサイドビュースクリプトを併用していて
  100.   # コマンドウインドウの位置がどうしても不自然になるならtrueに)
  101.   # ※trueにしても適用されない場合、このスクリプトを
  102.   #  サイドビューよりも下に置いてみてください
  103.   WINDOWPOS_CHANGE = false
  104.   WINDOWPOS_X = 100   # X座標
  105.   WINDOWPOS_Y = 320   # Y座標
  106.   # コマンドウインドウの不透明度
  107.   WINDOW_OPACITY = 160
  108.   
  109.   # CTのカウント間隔。少ないほどゲージ描画がなめらかに。(最小値は0)
  110.   # 処理が重い場合は、この数値を上げてください。
  111.   CT_SKIP = 2
  112. end
  113. # ↑ 設定項目ここまで
  114. #------------------------------------------------------------------------------
  115. #==============================================================================
  116. # ■ Scene_Battle
  117. #==============================================================================
  118. class Scene_Battle
  119.   #--------------------------------------------------------------------------
  120.   # ○ CTのカウント
  121.   #--------------------------------------------------------------------------
  122.   def update_ct
  123.     # カウントアップが許可されているとき
  124.     if @countup
  125.       for actor in $game_party.actors
  126.         # 行動できるか
  127.         if actor.movable? == false and actor.ct_visible and @phase4_step != 5
  128.           # 不可視状態でカウントアップ
  129.           actor.ct_visible = false
  130.           actor.countup = true
  131.           actor.full_ct = false
  132.         elsif actor.movable? and actor.ct_visible == false
  133.           # 不可視カウントアップを解除
  134.           clear_ct(actor)
  135.           actor.ct_visible = true
  136.         end
  137.         # アクターの入れ替えに対応
  138.         if actor.max_ct == 0
  139.           actor.max_ct = @max_ct
  140.         end
  141.         # アクターのカウントアップ
  142.         if actor.countup
  143.           # CTがmaxになっており、コマンド入力待ちアクターに含まれない
  144.           if actor.now_ct >= @max_ct and !(@pre_action_battlers.include?(actor))
  145.             # コマンド入力待ちアクターに追加
  146.             @pre_action_battlers.push(actor)
  147.             @action_count += 1
  148.             # 効果音を鳴らす
  149.             if PARA_CTB::FULL_CT_SE != "" and actor.ct_visible
  150.               Audio.se_play("Audio/SE/" + PARA_CTB::FULL_CT_SE,PARA_CTB::FULL_CT_SE_VOL)
  151.             end
  152.             # それ以上カウントアップしない
  153.             actor.countup = false
  154.             actor.full_ct = true
  155.           else
  156.             # カウントアップ
  157.             actor.make_action_speed
  158.             ct_skip = PARA_CTB::CT_SKIP != 0 ? PARA_CTB::CT_SKIP : 1
  159.             actor.now_ct += actor.current_action.speed * PARA_CTB::BATTLE_SPEED * ct_skip
  160.           end
  161.         end
  162.       end
  163.       for enemy in $game_troop.enemies
  164.         # 行動できるか
  165.         if enemy.movable? == false and enemy.ct_visible and @phase4_step == 5
  166.           # 不可視状態でカウントアップ
  167.           enemy.ct_visible = false
  168.           enemy.countup = true
  169.           enemy.full_ct = false
  170.         elsif enemy.movable? and enemy.ct_visible == false
  171.           # 不可視カウントアップを解除
  172.           clear_ct(enemy)
  173.           enemy.ct_visible = true
  174.         end
  175.         # エネミーのカウントアップ
  176.         if enemy.countup
  177.           # CTがmaxになっており、行動待ちエネミーに含まれない
  178.           if enemy.now_ct >= @max_ct and ! @pre_action_battlers.include?(enemy)
  179.             # 行動待ちエネミーに追加
  180.             @pre_action_battlers.push(enemy)
  181.             @action_count += 1
  182.             # それ以上カウントアップしない
  183.             enemy.countup = false
  184.             enemy.full_ct = true
  185.           else
  186.             # カウントアップ
  187.             enemy.make_action_speed
  188.             enemy.now_ct += enemy.current_action.speed * PARA_CTB::BATTLE_SPEED
  189.           end
  190.         end
  191.       end
  192.       # CTゲージを再描画
  193.       @status_window.refresh_ct
  194.       @status_window2.refresh_ct
  195.     end
  196.   end
  197.   #--------------------------------------------------------------------------
  198.   # ○ バトラーのCTを0に
  199.   #--------------------------------------------------------------------------
  200.   def clear_ct(battler)
  201.     battler.countup = true
  202.     battler.now_ct = 0
  203.     battler.full_ct = false
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # ○ バトラーのCTを任意のパーセンテージに
  207.   #--------------------------------------------------------------------------
  208.   def declease_ct(battler,percent)
  209.     battler.countup = true
  210.     battler.now_ct = battler.now_ct * percent / 100
  211.     battler.full_ct = false
  212.   end
  213.   #--------------------------------------------------------------------------
  214.   # ○ CTの初期化
  215.   #--------------------------------------------------------------------------
  216.   def initialize_ct
  217.     # CTの基準値を決定
  218.     max_ct
  219.     for battler in $game_party.actors + $game_troop.enemies
  220.       if battler.movable?
  221.         n = $game_party.actors.size + $game_troop.enemies.size
  222.         # 戦闘開始時にある程度のCTを溜めておく
  223.         battler.now_ct = battler.agi * 60 * n
  224.         battler.ct_visible = true
  225.       else
  226.         clear_ct(battler)
  227.         battler.ct_visible = false
  228.       end
  229.       battler.countup = true
  230.       battler.full_ct = false
  231.       battler.max_ct = @max_ct
  232.     end
  233.   end
  234.   #--------------------------------------------------------------------------
  235.   # ○ バトラー全員の素早さからCTの基準値を決定
  236.   #--------------------------------------------------------------------------
  237.   def max_ct
  238.     for battler in $game_party.actors + $game_troop.enemies
  239.       @max_ct += battler.agi
  240.     end
  241.     @max_ct *= 100
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # ○ バトラーの行動順を変更
  245.   #--------------------------------------------------------------------------
  246.   def shift_activer(shift)
  247.     # 一つシフトする時で後ろのアクターが2人以上
  248.     if @pre_action_battlers != nil
  249.       if shift == 1 and @pre_action_battlers.size >= @actor_array_index + 3
  250.         # 現在のアクターを取得
  251.         act = @pre_action_battlers[@actor_array_index]
  252.         # 現在のアクターを二つ後ろに挿入
  253.         @pre_action_battlers.insert(@actor_array_index+2, act)
  254.         # 現在位置を消去
  255.         @pre_action_battlers.delete_at(@actor_array_index)
  256.         @actor_array_index -= 1
  257.         phase3_next_actor
  258.       else
  259.         act = @pre_action_battlers[@actor_array_index]
  260.         # 現在のアクターを一番後ろに追加
  261.         @pre_action_battlers.push(act)
  262.         # 現在位置を消去
  263.         @pre_action_battlers.delete_at(@actor_array_index)
  264.         @actor_array_index -= 1
  265.         phase3_next_actor
  266.       end
  267.     end
  268.   end
  269.   #--------------------------------------------------------------------------
  270.   # ● メイン処理
  271.   #--------------------------------------------------------------------------
  272.   alias main_ctb main
  273.   def main
  274.     # エネミー名ウインドウを作成
  275.     @status_window2 = Window_BattleStatus_enemy.new
  276.     @action_battlers = []
  277.     @pre_action_battlers = []
  278.     @max_ct = 0
  279.     @countup = false
  280.     @ct_wait = 0
  281.     @action_count = 0
  282.     main_ctb
  283.     # エネミー名ウインドウを破棄
  284.     @status_window2.dispose
  285.   end
  286.   #--------------------------------------------------------------------------
  287.   # ● フレーム更新
  288.   #--------------------------------------------------------------------------
  289.   alias ctb_update update
  290.   def update
  291.     # バトルイベント実行中の場合
  292.     if $game_system.battle_interpreter.running?
  293.       # インタプリタを更新
  294.       $game_system.battle_interpreter.update
  295.       # アクションを強制されているバトラーが存在しない場合
  296.       if $game_temp.forcing_battler == nil
  297.         # バトルイベントの実行が終わった場合
  298.         unless $game_system.battle_interpreter.running?
  299.           # 戦闘継続の場合、バトルイベントのセットアップを再実行
  300.           unless judge
  301.             setup_battle_event
  302.           end
  303.         end
  304.         # アフターバトルフェーズでなければ
  305.         if @phase != 5
  306.           # ステータスウィンドウをリフレッシュ
  307.           @status_window.refresh
  308.           # エネミー名リストを更新
  309.           @status_window2.refresh
  310.         end
  311.       end
  312.     else
  313.       if PARA_CTB::CT_SKIP == 0
  314.         update_ct
  315.       else
  316.         if @ct_wait > 0
  317.           @ct_wait -= 1
  318.         else
  319.           update_ct
  320.           @ct_wait = PARA_CTB::CT_SKIP
  321.         end
  322.       end
  323.     end
  324.     ctb_update
  325.   end
  326.   #--------------------------------------------------------------------------
  327.   # ● プレバトルフェーズ開始
  328.   #--------------------------------------------------------------------------
  329.   alias ctb_start_phase1 start_phase1
  330.   def start_phase1
  331.     # CTを初期化
  332.     initialize_ct
  333.     # カウントアップ開始
  334.     @countup = true
  335.     ctb_start_phase1
  336.   end
  337.   #--------------------------------------------------------------------------
  338.   # ● フレーム更新 (プレバトルフェーズ)
  339.   #--------------------------------------------------------------------------
  340.   def update_phase1
  341.     # エネミー名リストを更新
  342.     @status_window2.refresh
  343.     # 勝敗判定
  344.     if judge
  345.       # 勝利または敗北の場合 : メソッド終了
  346.       return
  347.     end
  348.     # パーティーコマンドフェーズを飛ばしてアクターコマンドフェーズ開始
  349.     start_phase3
  350.   end
  351.   #--------------------------------------------------------------------------
  352.   # ● パーティコマンドフェーズ開始
  353.   #--------------------------------------------------------------------------
  354.   def start_phase2
  355.     # フェーズ 2 に移行
  356.     @phase = 2
  357.     # アクターを非選択状態に設定
  358.     @actor_index = -1
  359.     @active_battler = nil
  360.     # パーティコマンドウィンドウを有効化
  361.     @party_command_window.active = true
  362.     @party_command_window.visible = true
  363.     # アクターコマンドウィンドウを無効化
  364.     @actor_command_window.active = false
  365.     @actor_command_window.visible = false
  366.     # メインフェーズフラグをクリア
  367.     $game_temp.battle_main_phase = false
  368.     # コマンド入力不可能な場合
  369.     unless $game_party.inputable?
  370.       # メインフェーズ開始
  371.       start_phase4
  372.     end
  373.   end
  374.   #--------------------------------------------------------------------------
  375.   # ● フレーム更新 (パーティコマンドフェーズ : 逃げる)
  376.   #--------------------------------------------------------------------------
  377.   def update_phase2_escape
  378.     # エネミーの素早さ合計を計算
  379.     enemies_agi = 0
  380.     for enemy in $game_troop.enemies
  381.       if enemy.exist?
  382.         enemies_agi += enemy.agi
  383.       end
  384.     end
  385.     # 行動可能アクターの素早さ合計を計算
  386.     actors_agi = 0
  387.     for actor in @pre_action_battlers
  388.       if actor.is_a?(Game_Actor) and actor.exist?
  389.         actors_agi += actor.agi
  390.       end
  391.     end
  392.     # 逃走成功判定
  393.     success = rand(100) < 50 * actors_agi / enemies_agi
  394.     # 逃走成功の場合
  395.     if success
  396.       # 逃走 SE を演奏
  397.       $game_system.se_play($data_system.escape_se)
  398.       # バトル開始前の BGM に戻す
  399.       $game_system.bgm_play($game_temp.map_bgm)
  400.       # CTをクリア
  401.       for battler in $game_party.actors
  402.         clear_ct(battler)
  403.       end
  404.       # バトル終了
  405.       battle_end(1)
  406.     # 逃走失敗の場合
  407.     else
  408.       # ヘルプウィンドウに "逃走失敗" をセット
  409.       @help_window.set_text(PARA_CTB::UNESCAPE_MES, 1)
  410.       # アクターのアクションとCTをクリア
  411.       pre_action_battlers = @pre_action_battlers.clone
  412.       for act in pre_action_battlers
  413.         if act.is_a?(Game_Actor)
  414.           declease_ct(act, 100-PARA_CTB::ACT_ESCAPE_CT)
  415.           act.current_action.clear
  416.           @pre_action_battlers.delete(act)
  417.         end
  418.       end
  419.       @party_command_window.visible = false
  420.       # ヘルプウィンドウを表示
  421.       @help_window.visible = true
  422.       @wait_count = 20
  423.       # メインフェーズ開始
  424.       start_phase4
  425.     end
  426.   end
  427.   #--------------------------------------------------------------------------
  428.   # ● アクターコマンドフェーズ開始
  429.   #--------------------------------------------------------------------------
  430.   def start_phase3
  431.     # フェーズ 3 に移行
  432.     @phase = 3
  433.     # アクターを非選択状態に設定
  434.     @actor_index = -1
  435.     @active_battler = nil
  436.     @actor_array_index = -1
  437.     # 次のアクターのコマンド入力へ
  438.     if @pre_action_battlers != []
  439.       phase3_next_actor
  440.     else
  441.       start_phase4
  442.     end
  443.   end
  444.   #--------------------------------------------------------------------------
  445.   # ● 次のアクターのコマンド入力へ
  446.   #--------------------------------------------------------------------------
  447.   def phase3_next_actor
  448.     # ループ
  449.     begin
  450.       # アクターの明滅エフェクト OFF
  451.       if @active_battler != nil
  452.         @active_battler.blink = false
  453.       end
  454.       # 最後のアクターの場合
  455.       if @actor_array_index + 1 == @pre_action_battlers.size
  456.         # メインフェーズ開始
  457.         start_phase4
  458.         return
  459.       #次がエネミーの場合
  460.       elsif $game_troop.enemies.include?(@pre_action_battlers[@actor_array_index + 1])
  461.         # メインフェーズ開始
  462.         start_phase4
  463.         return
  464.       end
  465.       # アクターのインデックスを進める
  466.       @actor_array_index += 1
  467.       @actor_index = @pre_action_battlers[@actor_array_index].index
  468.       @active_battler = $game_party.actors[@actor_index]
  469.       @active_battler.blink = true
  470.       @active_battler.current_action.clear
  471.     # アクターがコマンド入力を受け付けない状態ならもう一度
  472.     end until @active_battler.inputable?
  473.     # アクターコマンドウィンドウをセットアップ
  474.     phase3_setup_command_window
  475.   end
  476.   #--------------------------------------------------------------------------
  477.   # ● 前のアクターのコマンド入力へ
  478.   #--------------------------------------------------------------------------
  479.   def phase3_prior_actor
  480.     # ループ
  481.     begin
  482.       # アクターの明滅エフェクト OFF
  483.       if @active_battler != nil
  484.         @active_battler.blink = false
  485.       end
  486.       # 最初のアクターの場合
  487.       if @actor_array_index <= 0
  488.         # アクターコマンドフェーズ開始
  489.         start_phase2
  490.         return
  491.       end
  492.       # アクターのインデックスを戻す
  493.       @actor_array_index -= 1
  494.       @actor_index = @pre_action_battlers[@actor_array_index].index
  495.       @active_battler = $game_party.actors[@actor_index]
  496.       @active_battler.blink = true
  497.       @active_battler.current_action.clear
  498.     # アクターがコマンド入力を受け付けない状態ならもう一度
  499.     end until @active_battler.inputable?
  500.     # アクターコマンドウィンドウをセットアップ
  501.     phase3_setup_command_window
  502.   end
  503.   #--------------------------------------------------------------------------
  504.   # ● アクターコマンドウィンドウのセットアップ
  505.   #--------------------------------------------------------------------------
  506.   alias phase3_setup_command_window_ctb phase3_setup_command_window
  507.   def phase3_setup_command_window
  508.     @actor_command_window.back_opacity = PARA_CTB::WINDOW_OPACITY
  509.     phase3_setup_command_window_ctb
  510.     if PARA_CTB::WINDOWPOS_CHANGE
  511.       # アクターコマンドウィンドウの位置を設定
  512.       @actor_command_window.x = PARA_CTB::WINDOWPOS_X
  513.       @actor_command_window.y = PARA_CTB::WINDOWPOS_Y
  514.       # ステータスウインドウに隠れないように
  515.       @actor_command_window.z = 9999
  516.     end
  517.   end
  518.   #--------------------------------------------------------------------------
  519.   # ● フレーム更新 (アクターコマンドフェーズ)
  520.   #--------------------------------------------------------------------------
  521.   def update_phase3
  522.     # エネミーアローが有効の場合
  523.     if @enemy_arrow != nil
  524.       @countup = PARA_CTB::SELECT_WAIT ? false : true
  525.       update_phase3_enemy_select
  526.     # アクターアローが有効の場合
  527.     elsif @actor_arrow != nil
  528.       @countup = PARA_CTB::SELECT_WAIT ? false : true
  529.       update_phase3_actor_select
  530.     # スキルウィンドウが有効の場合
  531.     elsif @skill_window != nil
  532.       @countup = PARA_CTB::SELECT_WAIT ? false : true
  533.       update_phase3_skill_select
  534.     # アイテムウィンドウが有効の場合
  535.     elsif @item_window != nil
  536.       @countup = PARA_CTB::SELECT_WAIT ? false : true
  537.       update_phase3_item_select
  538.     # アクターコマンドウィンドウが有効の場合
  539.     elsif @actor_command_window.active
  540.       @countup = PARA_CTB::COMMAND_WAIT ? false : true
  541.       update_phase3_basic_command
  542.     end
  543.   end
  544.   #--------------------------------------------------------------------------
  545.   # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  546.   #--------------------------------------------------------------------------
  547.   alias ctb_update_phase3_basic_command update_phase3_basic_command
  548.   def update_phase3_basic_command
  549.     ctb_update_phase3_basic_command
  550.     # LRボタンで行動順を変更
  551.     if Input.trigger?(Input::R)
  552.       shift_activer(1)
  553.     end
  554.      if Input.trigger?(Input::L)
  555.       shift_activer(-1)
  556.     end
  557.   end
  558.   #--------------------------------------------------------------------------
  559.   # ● メインフェーズ開始
  560.   #--------------------------------------------------------------------------
  561.   def start_phase4
  562.     # フェーズ 4 に移行
  563.     @phase = 4
  564.     battler_count = $game_party.actors.size + $game_troop.enemies.size
  565.     if @action_count >= battler_count or $game_temp.battle_turn == 0
  566.       # バトルイベントの全ページを検索
  567.       for index in 0...$data_troops[@troop_id].pages.size
  568.         # イベントページを取得
  569.         page = $data_troops[@troop_id].pages[index]
  570.         # このページのスパンが [ターン] の場合
  571.         if page.span == 1
  572.           # 実行済みフラグをクリア
  573.           $game_temp.battle_event_flags[index] = false
  574.         end
  575.       end
  576.       # ターン数カウント
  577.       $game_temp.battle_turn += 1
  578.       @action_count = 0
  579.     end
  580.     # アクターを非選択状態に設定
  581.     @actor_index = -1
  582.     @active_battler = nil
  583.     # パーティコマンドウィンドウを有効化
  584.     @party_command_window.active = false
  585.     @party_command_window.visible = false
  586.     # アクターコマンドウィンドウを無効化
  587.     @actor_command_window.active = false
  588.     @actor_command_window.visible = false
  589.     # メインフェーズフラグをセット
  590.     $game_temp.battle_main_phase = true
  591.     # エネミーアクション作成
  592.     for enemy in $game_troop.enemies
  593.       enemy.make_action
  594.     end
  595.     # 行動順序作成
  596.     make_action_orders
  597.     # ステップ 1 に移行
  598.     @phase4_step = 1
  599.   end
  600.   #--------------------------------------------------------------------------
  601.   # ● 行動順序作成
  602.   #--------------------------------------------------------------------------
  603.   def make_action_orders
  604.     # 配列 @action_battlers を初期化
  605.     @action_battlers = []
  606.     if @pre_action_battlers != []
  607.       for i in 0..@actor_array_index
  608.         # アクターを配列 @action_battlers に追加
  609.         @action_battlers.push(@pre_action_battlers[0])
  610.         @pre_action_battlers.shift
  611.       end
  612.       if @pre_action_battlers.size != 0
  613.       loop do
  614.         if $game_troop.enemies.include?(@pre_action_battlers[0])
  615.           # エネミーを配列 @action_battlers に追加
  616.           @action_battlers.push(@pre_action_battlers[0])
  617.           @pre_action_battlers.shift
  618.         else
  619.           break
  620.         end
  621.       end
  622.       end
  623.     end
  624.   end
  625.   #--------------------------------------------------------------------------
  626.   # ● フレーム更新 (メインフェーズ ステップ 1 : アクション準備)
  627.   #--------------------------------------------------------------------------
  628.   alias ctb_update_phase4_step1 update_phase4_step1
  629.   def update_phase4_step1
  630.     @countup = true
  631.     # ヘルプウィンドウを隠す
  632.     @help_window.visible = false
  633.     # 勝敗判定
  634.     if judge
  635.       # 勝利または敗北の場合 : メソッド終了
  636.       return
  637.     end
  638.     # 未行動バトラーが存在しない場合 (全員行動した)
  639.     if @action_battlers.size == 0
  640.       # アクターコマンドフェーズ開始
  641.       start_phase3
  642.       return
  643.     end
  644.     ctb_update_phase4_step1
  645.   end
  646.   #--------------------------------------------------------------------------
  647.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  648.   #--------------------------------------------------------------------------
  649.   alias ctb_update_phase4_step2 update_phase4_step2
  650.   def update_phase4_step2
  651.     # 強制アクションでなければ
  652.     unless @active_battler.current_action.forcing
  653.       # 制約が [行動できない] の場合
  654.       if @active_battler.restriction == 4
  655.         # CTをクリア
  656.         clear_ct(@active_battler)
  657.         # アクション強制対象のバトラーをクリア
  658.         $game_temp.forcing_battler = nil
  659.         # ステップ 1 に移行
  660.         @phase4_step = 1
  661.         return
  662.       end
  663.     end
  664.     # アニメーション再生中にCTをカウントするか
  665.     if PARA_CTB::ANIMATION_WAIT == false
  666.       @countup = true
  667.     end
  668.     ctb_update_phase4_step2
  669.   end
  670.   #--------------------------------------------------------------------------
  671.   # ● 基本アクション 結果作成
  672.   #--------------------------------------------------------------------------
  673.   alias make_basic_action_result_ctb make_basic_action_result
  674.   def make_basic_action_result
  675.     # 何もしないの場合
  676.     if @active_battler.current_action.basic == 3
  677.       # CTをクリア
  678.       clear_ct(@active_battler)
  679.       # アクション強制対象のバトラーをクリア
  680.       $game_temp.forcing_battler = nil
  681.       # ステップ 1 に移行
  682.       @phase4_step = 1
  683.       return
  684.     end
  685.     make_basic_action_result_ctb
  686.   end
  687.   #--------------------------------------------------------------------------
  688.   # ● スキルアクション 結果作成
  689.   #--------------------------------------------------------------------------
  690.   def make_skill_action_result
  691.     # スキルを取得
  692.     @skill = $data_skills[@active_battler.current_action.skill_id]
  693.     # 強制アクションでなければ
  694.     unless @active_battler.current_action.forcing
  695.       # SP 切れなどで使用できなくなった場合
  696.       unless @active_battler.skill_can_use?(@skill.id)
  697.         # アクション強制対象のバトラーをクリア
  698.         $game_temp.forcing_battler = nil
  699.         # CTをクリア
  700.         declease_ct(@active_battler,100-PARA_CTB::ACT_SKILL_CT)
  701.         # ステップ 1 に移行
  702.         @phase4_step = 1
  703.         return
  704.       end
  705.     end
  706.     # SP 消費
  707.     @active_battler.sp -= @skill.sp_cost
  708.     # ステータスウィンドウをリフレッシュ
  709.     @status_window.refresh
  710.     # ヘルプウィンドウにスキル名を表示
  711.     @help_window.set_text(@skill.name, 1)
  712.     # アニメーション ID を設定
  713.     @animation1_id = @skill.animation1_id
  714.     @animation2_id = @skill.animation2_id
  715.     # コモンイベント ID を設定
  716.     @common_event_id = @skill.common_event_id
  717.     # 対象側バトラーを設定
  718.     set_target_battlers(@skill.scope)
  719.     # スキルの効果を適用
  720.     for target in @target_battlers
  721.       target.skill_effect(@active_battler, @skill)
  722.     end
  723.   end
  724.   #--------------------------------------------------------------------------
  725.   # ● アイテムアクション 結果作成
  726.   #--------------------------------------------------------------------------
  727.   alias ctb_make_item_action_result make_item_action_result
  728.   def make_item_action_result
  729.     # アイテムを取得
  730.     @item = $data_items[@active_battler.current_action.item_id]
  731.     # アイテム切れなどで使用できなくなった場合
  732.     unless $game_party.item_can_use?(@item.id)
  733.       # CTをクリア
  734.       declease_ct(@active_battler,100-PARA_CTB::ACT_ITEM_CT)
  735.       # ステップ 1 に移行
  736.       @phase4_step = 1
  737.       return
  738.     end
  739.     ctb_make_item_action_result
  740.   end
  741.   #--------------------------------------------------------------------------
  742.   # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  743.   #--------------------------------------------------------------------------
  744.   alias update_phase4_step5_ctb update_phase4_step5
  745.   def update_phase4_step5
  746.     # ダメージを記録
  747.     for target in @target_battlers
  748.       if target.damage != nil
  749.         target.movable_backup = target.movable?
  750.       end
  751.     end
  752.     update_phase4_step5_ctb
  753.   end
  754.   #--------------------------------------------------------------------------
  755.   # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  756.   #--------------------------------------------------------------------------
  757.   alias update_phase4_step6_ctb update_phase4_step6
  758.   def update_phase4_step6
  759.     @active_battler.countup = true
  760.     if @active_battler.current_action.basic == 1
  761.       # 防御
  762.       declease_ct(@active_battler,100-PARA_CTB::ACT_GUARD_CT)
  763.     else
  764.       case @active_battler.current_action.kind
  765.       # 攻撃
  766.       when 0
  767.         declease_ct(@active_battler,100-PARA_CTB::ACT_ATTACK_CT)
  768.       # スキル
  769.       when 1
  770.         declease_ct(@active_battler,100-PARA_CTB::ACT_SKILL_CT)
  771.       # アイテム
  772.       when 2
  773.         declease_ct(@active_battler,100-PARA_CTB::ACT_ITEM_CT)
  774.       else
  775.         clear_ct(@active_battler)
  776.       end
  777.     end
  778.     # ターゲットが行動不能になったらCTを0に
  779.     for target in @target_battlers
  780.       if target.movable? == false and target.movable_backup == true
  781.         clear_ct(target)
  782.         @status_window.refresh_ct
  783.       end
  784.     end
  785.     # エネミー名リストを更新
  786.     @status_window2.refresh
  787.     update_phase4_step6_ctb
  788.   end
  789.   #--------------------------------------------------------------------------
  790.   # ● アフターバトルフェーズ開始
  791.   #--------------------------------------------------------------------------
  792.   alias ctb_start_phase5 start_phase5
  793.   def start_phase5
  794.     @countup = false
  795.     ctb_start_phase5
  796.   end
  797. end
  798. #==============================================================================
  799. # ■ Window_BattleStatus
  800. #==============================================================================
  801. class Window_BattleStatus < Window_Base
  802.   #--------------------------------------------------------------------------
  803.   # ● オブジェクト初期化
  804.   #--------------------------------------------------------------------------
  805.   def initialize
  806.     super(160, 320, 480, 160)
  807.     self.contents = Bitmap.new(width - 32, height - 32)
  808.     @level_up_flags = [false, false, false, false]
  809.     @before_hp = []
  810.     @before_sp = []
  811.     @before_states = []
  812.     @now_hp = []
  813.     @now_sp = []
  814.     @now_states = []
  815.     refresh
  816.   end
  817.   #--------------------------------------------------------------------------
  818.   # ● リフレッシュ
  819.   #--------------------------------------------------------------------------
  820.   def refresh
  821.     @item_max = $game_party.actors.size
  822.     for i in 0...$game_party.actors.size
  823.       actor = $game_party.actors[i]
  824.       line_height = 120 / PARA_CTB::PARTY_SIZE
  825.       actor_y = i * line_height + 4
  826.       # 現在のステータスを配列に
  827.       @now_hp[i] = actor.hp
  828.       @now_sp[i] = actor.sp
  829.       @now_states[i] = actor.states
  830.       # レベルアップ
  831.       if @level_up_flags[i]
  832.         self.contents.fill_rect(344, actor_y+14, 100, 8, Color.new(0, 0, 0, 0))
  833.         self.contents.font.color = normal_color
  834.         self.contents.draw_text(344, actor_y, 120, 32, "LEVEL UP!")
  835.       end
  836.     end
  837.     # バトルステータスの軽量化処理
  838.     # ステータスの配列が変化したときのみ描画処理
  839.     if @before_hp == nil or @before_sp == nil or @before_states == nil or
  840.     @before_hp != @now_hp or @before_sp != @now_sp or @before_states != @now_states
  841.       self.contents.clear
  842.       for i2 in 0...$game_party.actors.size
  843.         actor = $game_party.actors[i2]
  844.         line_height = 120 / PARA_CTB::PARTY_SIZE
  845.         actor_y = i2 * line_height + 4
  846.         self.contents.font.size = PARA_CTB::NAME_FONT_SIZE
  847.         # 名前を描画
  848.         draw_actor_name(actor, 4, actor_y+16-PARA_CTB::NAME_FONT_SIZE)
  849.         # HPを描画
  850.         hp_color1 = PARA_CTB::HP_COLOR_LEFT
  851.         hp_color2 = PARA_CTB::HP_COLOR_RIGHT
  852.         draw_meter(actor.hp, actor.maxhp, 125, actor_y+14, 80, 8, hp_color1, hp_color2)
  853.         draw_actor_hp(actor, 102, actor_y+16-PARA_CTB::HPSP_FONT_SIZE, 100)
  854.         # SPを描画
  855.         sp_color1 = PARA_CTB::SP_COLOR_LEFT
  856.         sp_color2 = PARA_CTB::SP_COLOR_RIGHT
  857.         draw_meter(actor.sp, actor.maxsp, 245, actor_y+14, 80, 8, sp_color1, sp_color2)
  858.         draw_actor_sp(actor, 222, actor_y+16-PARA_CTB::HPSP_FONT_SIZE, 100)
  859.         # 変化後のステータスを配列に
  860.         @before_hp[i2] = actor.hp
  861.         @before_sp[i2] = actor.sp
  862.         @before_states[i2] = actor.states
  863.         # レベルアップ
  864.         if @level_up_flags[i2]
  865.           self.contents.fill_rect(344, actor_y, 100, 8, Color.new(0, 0, 0, 0))
  866.           self.contents.font.color = normal_color
  867.           self.contents.draw_text(344, actor_y, 120, 32, "LEVEL UP!")
  868.         end
  869.       end
  870.     end
  871.     refresh_ct
  872.   end
  873.   #--------------------------------------------------------------------------
  874.   # ● CTゲージのリフレッシュ
  875.   #--------------------------------------------------------------------------
  876.   def refresh_ct
  877.     for i in 0...$game_party.actors.size
  878.       actor = $game_party.actors[i]
  879.       line_height = 120 / PARA_CTB::PARTY_SIZE
  880.       actor_y = i * line_height + 4
  881.       # CTが満タンになったときのゲージの色
  882.       ct_color_full = PARA_CTB::COLOR_FULL
  883.       # CTゲージの色(左端)
  884.       ct_color_start = actor.full_ct ? ct_color_full : PARA_CTB::COLOR_LEFT
  885.       # CTゲージの色(右端)
  886.       ct_color_end = actor.full_ct ? ct_color_full : PARA_CTB::COLOR_RIGHT
  887.       if @level_up_flags[i] != true and actor.ct_visible
  888.         draw_meter(actor.now_ct, actor.max_ct, 344, actor_y+14, 100, 8, ct_color_start, ct_color_end)
  889.       elsif @level_up_flags[i] != true
  890.         draw_meter(0, actor.max_ct, 344, actor_y+14, 100, 8, ct_color_start, ct_color_end)
  891.       end
  892.     end
  893.   end
  894.   #--------------------------------------------------------------------------
  895.   # ● フレーム更新
  896.   #--------------------------------------------------------------------------
  897.   def update
  898.     super
  899.   end
  900.   #--------------------------------------------------------------------------
  901.   # ● HP の描画
  902.   #     actor : アクター
  903.   #     x     : 描画先 X 座標
  904.   #     y     : 描画先 Y 座標
  905.   #     width : 描画先の幅
  906.   #--------------------------------------------------------------------------
  907.   def draw_actor_hp(actor, x, y, width = 144)
  908.     # 文字列 "HP" を描画
  909.     self.contents.font.color = system_color
  910.     self.contents.font.size = 16
  911.     self.contents.draw_text(x, y+2, 32, 32, $data_system.words.hp)
  912.     self.contents.font.color = normal_color
  913.     self.contents.font.size = PARA_CTB::HPSP_FONT_SIZE
  914.     if PARA_CTB::MAX_DRAW
  915.       # MaxHP を描画
  916.       self.contents.draw_text(x, y, width, 32, actor.maxhp.to_s, 2)
  917.       text_size = self.contents.text_size(actor.maxhp.to_s)
  918.       text_x = x + width - text_size.width - 12
  919.       self.contents.draw_text(text_x, y, 12, 32, "/", 1)
  920.       # HP を描画
  921.       self.contents.font.color = actor.hp == 0 ? knockout_color :
  922.         actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  923.       text_x = text_x - text_size.width
  924.       self.contents.draw_text(text_x, y, text_size.width, 32, actor.hp.to_s, 2)
  925.     else
  926.       self.contents.font.color = actor.hp == 0 ? knockout_color :
  927.         actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
  928.       self.contents.draw_text(x, y, width, 32, actor.hp.to_s, 2)
  929.     end
  930.   end
  931.   #--------------------------------------------------------------------------
  932.   # ● SP の描画
  933.   #     actor : アクター
  934.   #     x     : 描画先 X 座標
  935.   #     y     : 描画先 Y 座標
  936.   #     width : 描画先の幅
  937.   #--------------------------------------------------------------------------
  938.   def draw_actor_sp(actor, x, y, width = 144)
  939.     # 文字列 "SP" を描画
  940.     self.contents.font.color = system_color
  941.     self.contents.font.size = 16
  942.     self.contents.draw_text(x, y+2, 32, 32, $data_system.words.sp)
  943.     self.contents.font.color = normal_color
  944.     self.contents.font.size = PARA_CTB::HPSP_FONT_SIZE
  945.     if PARA_CTB::MAX_DRAW
  946.     # MaxSP を描画
  947.       self.contents.draw_text(x, y, width, 32, actor.maxsp.to_s, 2)
  948.       text_size = self.contents.text_size(actor.maxsp.to_s)
  949.       text_x = x + width - text_size.width - 12
  950.       self.contents.draw_text(text_x, y, 12, 32, "/", 1)
  951.       # SP を描画
  952.       self.contents.font.color = actor.sp == 0 ? knockout_color :
  953.         actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  954.       text_x = text_x - text_size.width
  955.       self.contents.draw_text(text_x, y, text_size.width, 32, actor.sp.to_s, 2)
  956.     else
  957.       self.contents.font.color = actor.sp == 0 ? knockout_color :
  958.         actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
  959.       self.contents.draw_text(x, y, width, 32, actor.sp.to_s, 2)
  960.     end
  961.   end
  962. end
  963. #==============================================================================
  964. # □ 敵の名前を表示するウインドウ
  965. #==============================================================================
  966. class Window_BattleStatus_enemy < Window_Base
  967.   #--------------------------------------------------------------------------
  968.   # ○ オブジェクト初期化
  969.   #--------------------------------------------------------------------------
  970.   def initialize
  971.     super(0, 320, 160, 160)
  972.     self.contents = Bitmap.new(width - 32, height - 32)
  973.     refresh
  974.   end
  975.   #--------------------------------------------------------------------------
  976.   # ○ リフレッシュ
  977.   #--------------------------------------------------------------------------
  978.   def refresh
  979.     self.contents.clear
  980.     self.contents.font.color = normal_color
  981.     self.contents.font.size = PARA_CTB::ENEMY_FONT_SIZE
  982.     @exist_enemies = []
  983.     if $game_troop.enemies != nil
  984.       if PARA_CTB::ENEMY_GROUPING
  985.         ememy_list = []
  986.         ememy_list_index = []
  987.         # エネミーをグループ化
  988.         for i in 0...$game_troop.enemies.size
  989.           enemy = $game_troop.enemies[i]
  990.           if enemy.exist?
  991.             if ememy_list.include?(enemy.name)
  992.               ememy_list_index[ememy_list.index(enemy.name)] += 1
  993.             else
  994.               # エネミー名を記録
  995.               ememy_list.push(enemy.name)
  996.               ememy_list_index[ememy_list.index(enemy.name)] = 1
  997.             end
  998.           end
  999.         end
  1000.         # エネミーの名前と数を描画
  1001.         enemy_index = 0
  1002.         for enemy_name in ememy_list
  1003.           enemy_y = enemy_index * (PARA_CTB::ENEMY_FONT_SIZE+6) + 4
  1004.           if ememy_list_index[enemy_index] > 1
  1005.             enemy_name = enemy_name + " " + ememy_list_index[enemy_index].to_s
  1006.           end
  1007.           self.contents.draw_text(4, enemy_y, 160, 20, enemy_name)
  1008.           enemy_index += 1
  1009.         end
  1010.       else
  1011.         # エネミーの名前を描画
  1012.         enemy_index = 0
  1013.         for i in 0...$game_troop.enemies.size
  1014.           enemy = $game_troop.enemies[i]
  1015.           if enemy.exist?
  1016.             @exist_enemies.push(enemy)
  1017.             line_height = PARA_CTB::ENEMY_FONT_SIZE + 6
  1018.             if PARA_CTB::ENEMY_DRAWING_MATER != 0
  1019.               line_height += 10
  1020.             end
  1021.             enemy_y = enemy_index * line_height + 4
  1022.             self.contents.draw_text(4, enemy_y, 160, 20, enemy.name)
  1023.             enemy_index += 1
  1024.             if PARA_CTB::ENEMY_DRAWING_MATER == 1
  1025.               hp_color1 = PARA_CTB::HP_COLOR_LEFT
  1026.               hp_color2 = PARA_CTB::HP_COLOR_RIGHT
  1027.               y = enemy_y + PARA_CTB::ENEMY_FONT_SIZE + 3
  1028.               draw_meter(enemy.hp, enemy.maxhp, 4, y, 80, 8, hp_color1, hp_color2)
  1029.             end
  1030.           end
  1031.         end
  1032.       end
  1033.     end
  1034.     refresh_ct
  1035.   end
  1036.   #--------------------------------------------------------------------------
  1037.   # ● CTゲージのリフレッシュ
  1038.   #--------------------------------------------------------------------------
  1039.   def refresh_ct
  1040.     if PARA_CTB::ENEMY_DRAWING_MATER == 2 and @exist_enemies != nil
  1041.       enemy_index = 0
  1042.       for enemy in @exist_enemies
  1043.         line_height = PARA_CTB::ENEMY_FONT_SIZE + 16
  1044.         enemy_y = enemy_index * line_height + 4
  1045.         y = enemy_y + PARA_CTB::ENEMY_FONT_SIZE + 3
  1046.         # CTが満タンになったときのゲージの色
  1047.         ct_color_full = PARA_CTB::COLOR_FULL
  1048.         # CTゲージの色(左端)
  1049.         ct_color_start = enemy.full_ct ? ct_color_full : PARA_CTB::COLOR_LEFT
  1050.         # CTゲージの色(右端)
  1051.         ct_color_end = enemy.full_ct ? ct_color_full : PARA_CTB::COLOR_RIGHT
  1052.         if enemy.ct_visible
  1053.           draw_meter(enemy.now_ct, enemy.max_ct, 4, y, 100, 8, ct_color_start, ct_color_end)
  1054.         else
  1055.           draw_meter(0, enemy.max_ct, 4, y, 100, 8, ct_color_start, ct_color_end)
  1056.         end
  1057.         enemy_index += 1
  1058.       end
  1059.     end
  1060.   end
  1061. end
  1062. #==============================================================================
  1063. # ■ Window_Base
  1064. #==============================================================================
  1065. class Window_Base < Window
  1066.   
  1067.   #--------------------------------------------------------------------------
  1068.   # ○ ゲージを描画
  1069.   #--------------------------------------------------------------------------
  1070.   def draw_meter(now, max, x, y, width, height, start_color, end_color=start_color )
  1071.     self.contents.fill_rect(x, y, width, height, PARA_CTB::FRAME_COLOR)
  1072.     self.contents.fill_rect(x+PARA_CTB::FRAME_BORDER, y+PARA_CTB::FRAME_BORDER, width-
  1073. PARA_CTB::FRAME_BORDER*2, height-PARA_CTB::FRAME_BORDER*2, PARA_CTB::BACK_COLOR)
  1074.     now = now > max ? max : now
  1075.     percentage = max != 0 ? (width-2) * now / max.to_f : 0
  1076.     if start_color == end_color
  1077.       self.contents.fill_rect(x+1, y+1, percentage, height-2, start_color)
  1078.     else
  1079.       for i in 1..percentage
  1080.         r = start_color.red + (end_color.red - start_color.red) / percentage * i
  1081.         g = start_color.green + (end_color.green - start_color.green) / percentage * i
  1082.         b = start_color.blue + (end_color.blue - start_color.blue) / percentage * i
  1083.         a = start_color.alpha + (end_color.alpha - start_color.alpha) / percentage * i
  1084.         self.contents.fill_rect(x+i, y+1, 1, height-2, Color.new(r, g, b, a))
  1085.       end
  1086.     end
  1087.   end
  1088. end
  1089. #==============================================================================
  1090. # ■ Game_Battler
  1091. #==============================================================================
  1092. class Game_Battler
  1093.   #--------------------------------------------------------------------------
  1094.   # ● 公開インスタンス変数
  1095.   #--------------------------------------------------------------------------
  1096.   attr_accessor :max_ct
  1097.   attr_accessor :now_ct
  1098.   attr_accessor :full_ct
  1099.   attr_accessor :countup
  1100.   attr_accessor :ct_visible
  1101.   attr_accessor :movable_backup
  1102.   #--------------------------------------------------------------------------
  1103.   # ● オブジェクト初期化
  1104.   #--------------------------------------------------------------------------
  1105.   alias ctb_initialize initialize
  1106.   def initialize
  1107.     ctb_initialize
  1108.     @max_ct = 0
  1109.     @now_ct = 0
  1110.     @full_ct = false
  1111.     @countup = true
  1112.     @ct_visible = true
  1113.   end
  1114. end
  1115. #==============================================================================
  1116. # ■ Sprite_Battler
  1117. #==============================================================================
  1118. class Sprite_Battler < RPG::Sprite
  1119.   #--------------------------------------------------------------------------
  1120.   # ● フレーム更新
  1121.   #--------------------------------------------------------------------------
  1122.   alias ctb_update update
  1123.   def update
  1124.     ctb_update
  1125.     if @battler != nil
  1126.       if @battler.full_ct and @battler.ct_visible
  1127.         # CTが溜まったバトラーの色調を変化させる
  1128.         fullct_color = PARA_CTB::FULL_CT_COLOR
  1129.         self.tone = fullct_color
  1130.       else
  1131.         fullct_color = Tone.new(0,0,0)
  1132.         self.tone = fullct_color
  1133.       end
  1134.     end
  1135.   end
  1136. end
  1137. #==============================================================================
  1138. # ■ Window_Help
  1139. #==============================================================================
  1140. class Window_Help < Window_Base
  1141.   #--------------------------------------------------------------------------
  1142.   # ● アクター設定
  1143.   #     actor : ステータスを表示するアクター
  1144.   #--------------------------------------------------------------------------
  1145.   alias set_actor_ctb set_actor
  1146.   def set_actor(actor)
  1147.     if PARA_CTB::HELP_DRAWING_MATER_ACTOR
  1148.       self.contents.clear
  1149.       draw_actor_name(actor, 4, 0)
  1150.       draw_actor_state(actor, 140, 0)
  1151.       hp_color1 = PARA_CTB::HP_COLOR_LEFT
  1152.       hp_color2 = PARA_CTB::HP_COLOR_RIGHT
  1153.       draw_meter(actor.hp, actor.maxhp, 316, 18, 112, 8, hp_color1, hp_color2)
  1154.       draw_actor_hp(actor, 284, 0)
  1155.       sp_color1 = PARA_CTB::SP_COLOR_LEFT
  1156.       sp_color2 = PARA_CTB::SP_COLOR_RIGHT
  1157.       draw_meter(actor.sp, actor.maxsp, 492, 18, 112, 8, sp_color1, sp_color2)
  1158.       draw_actor_sp(actor, 460, 0)
  1159.       @actor = actor
  1160.       @text = nil
  1161.       self.visible = true
  1162.     else
  1163.       set_actor_ctb(actor)
  1164.     end
  1165.   end
  1166.   #--------------------------------------------------------------------------
  1167.   # ● エネミー設定
  1168.   #     enemy : 名前とステートを表示するエネミー
  1169.   #--------------------------------------------------------------------------
  1170.   alias set_enemy_ctb set_enemy
  1171.   def set_enemy(enemy)
  1172.     if PARA_CTB::HELP_DRAWING_MATER_ENEMY
  1173.       self.contents.clear
  1174.       draw_actor_name(enemy, 4, 0)
  1175.       draw_actor_state(enemy, 140, 0)
  1176.       hp_color1 = PARA_CTB::HP_COLOR_LEFT
  1177.       hp_color2 = PARA_CTB::HP_COLOR_RIGHT
  1178.       draw_meter(enemy.hp, enemy.maxhp, 316, 18, 112, 8, hp_color1, hp_color2)
  1179.       draw_actor_hp(enemy, 284, 0)
  1180.       sp_color1 = PARA_CTB::SP_COLOR_LEFT
  1181.       sp_color2 = PARA_CTB::SP_COLOR_RIGHT
  1182.       draw_meter(enemy.sp, enemy.maxsp, 492, 18, 112, 8, sp_color1, sp_color2)
  1183.       draw_actor_sp(enemy, 460, 0)
  1184.       self.visible = true
  1185.     else
  1186.       set_enemy_ctb(enemy)
  1187.     end
  1188.   end
  1189. end
复制代码
http://icv.cc声动音缘配音社
回复 支持 反对

使用道具 举报

845

主题

1万

帖子

214748万

积分

版主

脑残中……

Rank: 7Rank: 7Rank: 7

积分
2147483647

声命组金赏

 楼主| 发表于 2006-9-13 11:12:05 | 显示全部楼层

还是拿步行图做战斗图,可纵版和设定移动

  1. #==============================================================================
  2. # ++ サイドビューバトル(歩行グラフィック版) ver. 1.14 ++
  3. #  Script by パラ犬
  4. #  [url]http://2d6.parasite.jp/[/url]
  5. #------------------------------------------------------------------------------
  6. # バトルフィールドに歩行グラフィックを表示します。
  7. #==============================================================================
  8. module SDVA
  9.   
  10.   X_LINE = 500        # 横位置のバトラー表示座標
  11.   Y_LINE = 200        # 縦位置のバトラー表示座標
  12.   X_SPACE = 15        # 横位置のバトラー同士の間隔
  13.   Y_SPACE = 40        # 縦位置のバトラー同士の間隔
  14.   X_POSITION = 25     # 隊列[前衛・中衛・後衛]の横間隔
  15.   Y_POSITION = 0      # 隊列[前衛・中衛・後衛]の縦間隔
  16.   
  17.   ATTACK_MOVE = true  # 攻撃時に前へ踏み出すか( true / false )
  18.   SKILL_MOVE = true   # スキル使用時に前へ踏み出すか( true / false )
  19.   ITEM_MOVE = false   # アイテム使用時に前へ踏み出すか( true / false )
  20.   MOVE_STEP = 1       # 移動歩数
  21.   MOVE_PIXEL = 10     # 一歩あたりのピクセル数
  22.   
  23.   PARTY_POS = 1       # キャラクターの向き( 0:下 / 1:左 / 2:右 / 3:上 )
  24.   WINDOWPOS_CHANGE = true   # コマンドウインドウをバトラーの横に表示するか( true / false )
  25.   end
  26.   
  27. #==============================================================================
  28. # ■ Game_Actor
  29. #==============================================================================
  30. class Game_Actor < Game_Battler
  31.   #--------------------------------------------------------------------------
  32.   # ● バトル画面 X 座標の取得
  33.   #--------------------------------------------------------------------------
  34.   def screen_x
  35.     if self.index != nil
  36.       # 隊列を取得
  37.       pos = $data_classes[self.class_id].position
  38.       x_pos = pos * SDVA::X_POSITION
  39.       scr_x = self.index * SDVA::X_SPACE + SDVA::X_LINE + x_pos
  40.       # 移動アクションのとき
  41.       if self.current_action.move_action == true
  42.         # 横に移動
  43.         scr_x += @shift_x
  44.       end
  45.       return scr_x
  46.     else
  47.       return 0
  48.     end
  49.   end
  50.   #--------------------------------------------------------------------------
  51.   # ● バトル画面 Y 座標の取得
  52.   #--------------------------------------------------------------------------
  53.   def screen_y
  54.     if self.index != nil
  55.       # 隊列を取得
  56.       pos = $data_classes[self.class_id].position
  57.       y_pos = pos * SDVA::Y_POSITION
  58.       scr_y = self.index * SDVA::Y_SPACE + SDVA::Y_LINE + y_pos
  59.       # 移動アクションのとき
  60.       if self.current_action.move_action == true
  61.         # 縦に移動
  62.         scr_y += @shift_y
  63.       end
  64.       return scr_y
  65.     else
  66.       return 0
  67.     end
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # ● バトル画面 Z 座標の取得
  71.   #--------------------------------------------------------------------------
  72.   def screen_z
  73.     if self.index != nil
  74.       return self.index
  75.     else
  76.       return 0
  77.     end
  78.   end
  79. end
  80. #==============================================================================
  81. # ■ Game_Battler (分割定義 1)
  82. #==============================================================================
  83. class Game_Battler
  84.   #--------------------------------------------------------------------------
  85.   # ● 公開インスタンス変数
  86.   #--------------------------------------------------------------------------
  87.   attr_reader   :pattern        # 歩行パターン
  88.   attr_reader   :trans_x        # X方向の移動距離
  89.   attr_reader   :moving         # 移動中フラグ
  90.   #--------------------------------------------------------------------------
  91.   # ● オブジェクト初期化
  92.   #--------------------------------------------------------------------------
  93.   alias initialize_sdva initialize
  94.   def initialize
  95.     initialize_sdva
  96.     move_reset
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # ○ 移動カウント
  100.   #--------------------------------------------------------------------------
  101.   def move
  102.     @moving = 1
  103.       if @step < SDVA::MOVE_STEP
  104.         # 歩数を満たすまで移動
  105.         @pattern = (@pattern + 1) % 4
  106.         @step += 1
  107.         move_step
  108.       else
  109.         # 移動終了
  110.         @pattern = 1
  111.         @moving = 2
  112.       end
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ○ 移動処理
  116.   #--------------------------------------------------------------------------
  117.   def move_step
  118.   # パーティの向きによって移動座標を変える
  119.   case SDVA::PARTY_POS
  120.     when 0
  121.       @shift_y = @step * SDVA::MOVE_PIXEL
  122.     when 1
  123.       @shift_x = -(@step * SDVA::MOVE_PIXEL)
  124.     when 2
  125.       @shift_x = @step * SDVA::MOVE_PIXEL
  126.     when 3
  127.       @shift_y = -(@step * SDVA::MOVE_PIXEL)
  128.     end      
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   # ○ 移動のリセット
  132.   #--------------------------------------------------------------------------
  133.   def move_reset
  134.     @moving = 0
  135.     @pattern = 0
  136.     @step = 0
  137.     @shift_x = 0
  138.     @shift_y = 0
  139.   end
  140. end
  141. #==============================================================================
  142. # ■ Game_BattleAction
  143. #==============================================================================
  144. class Game_BattleAction
  145.   #--------------------------------------------------------------------------
  146.   # ● 公開インスタンス変数
  147.   #--------------------------------------------------------------------------
  148.   attr_accessor :move_action             # 移動するアクションか
  149.   #--------------------------------------------------------------------------
  150.   # ● クリア
  151.   #--------------------------------------------------------------------------
  152.   alias clear_sdva clear
  153.   def clear
  154.     clear_sdva
  155.     @move_action = false
  156.   end
  157. end
  158. #==============================================================================
  159. # ■ Sprite_Battler
  160. #==============================================================================
  161. class Sprite_Battler < RPG::Sprite
  162.   #--------------------------------------------------------------------------
  163.   # ● フレーム更新
  164.   #--------------------------------------------------------------------------
  165.   alias update_sdva update
  166.   def update
  167.     # バトラーがアクターに含まれるとき
  168.     if @battler.is_a?(Game_Actor)
  169.       # ファイル名か色相が現在のものと異なる場合
  170.       # 行動中の場合
  171.       if @battler.battler_name != @battler_name or
  172.          @battler.battler_hue != @battler_hue or
  173.          @battler.current_action.basic == 0 or
  174.          @battler.current_action.kind != 3
  175.         # ビットマップを取得、設定
  176.         @character_name = @battler.character_name
  177.         @character_hue = @battler.character_hue
  178.         # 歩行グラフィックを描画
  179.         self.bitmap = RPG::Cache.character(@character_name, @character_hue)
  180.         cw = self.bitmap.width / 4
  181.         ch = self.bitmap.height / 4
  182.         @width = cw
  183.         @height = ch
  184.         if @battler.current_action.move_action == true
  185.           # 歩かせる
  186.           @battler.move
  187.         else
  188.           @battler.move_reset
  189.         end
  190.         # 転送元の矩形を設定
  191.         sx = @battler.pattern * cw
  192.         sy = SDVA::PARTY_POS * ch
  193.         self.src_rect.set(sx, sy, cw, ch)
  194.         self.ox = @width / 2
  195.         self.oy = @height
  196.         # 隠れ状態なら不透明度を 0 にする
  197.         if @battler.hidden
  198.           self.opacity = 0
  199.         end
  200.       end
  201.     end
  202.     update_sdva
  203.   end
  204. end
  205.   
  206. #==============================================================================
  207. # ■ Scene_Battle
  208. #==============================================================================
  209. class Scene_Battle
  210.   #--------------------------------------------------------------------------
  211.   # ● アクターコマンドウィンドウのセットアップ
  212.   #--------------------------------------------------------------------------
  213.   alias phase3_setup_command_window_sdva phase3_setup_command_window
  214.   def phase3_setup_command_window
  215.     phase3_setup_command_window_sdva
  216.     if SDVA::WINDOWPOS_CHANGE
  217.       # アクターコマンドウィンドウの位置を設定
  218.       case SDVA::PARTY_POS
  219.         when 0
  220.           x_pos = @active_battler.screen_x - (@actor_command_window.width/2)
  221.           y_pos = @active_battler.screen_y
  222.         when 1
  223.           x_pos = @active_battler.screen_x - @actor_command_window.width - 16
  224.           y_pos = @active_battler.screen_y - @actor_command_window.height
  225.         when 2
  226.           x_pos = @active_battler.screen_x + 16
  227.           y_pos = @active_battler.screen_y - @actor_command_window.height
  228.         when 3
  229.           x_pos = @active_battler.screen_x - (@actor_command_window.width/2)
  230.           y_pos = @active_battler.screen_y - @actor_command_window.height - 48
  231.       end
  232.       @actor_command_window.x = x_pos >= 0 ? x_pos : 0
  233.       @actor_command_window.x = x_pos+@actor_command_window.width <= 640 ? x_pos : 640-@actor_command_window.width
  234.       @actor_command_window.y = y_pos >= 0 ? y_pos : 0
  235.       @actor_command_window.y = y_pos+@actor_command_window.height <= 480 ? y_pos : 480-@actor_command_window.height
  236.       # ステータスウインドウに隠れないように
  237.       @actor_command_window.z = 9999
  238.     end
  239.   end
  240.   #--------------------------------------------------------------------------
  241.   # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  242.   #--------------------------------------------------------------------------
  243.   alias update_phase4_step3_sdva update_phase4_step3
  244.   def update_phase4_step3
  245.     if SDVA::ATTACK_MOVE
  246.       if @active_battler.current_action.basic == 0
  247.         @active_battler.current_action.move_action = true
  248.       end
  249.     end
  250.     if SDVA::SKILL_MOVE
  251.       if @active_battler.current_action.kind == 1
  252.         @active_battler.current_action.move_action = true
  253.       end
  254.     end
  255.     if SDVA::ITEM_MOVE
  256.       if @active_battler.current_action.kind == 2
  257.         @active_battler.current_action.move_action = true
  258.       end
  259.     end
  260.     # バトラーがアクターに含まれ、移動アクション中
  261.     if @active_battler.is_a?(Game_Actor) and
  262.      @active_battler.current_action.move_action
  263.       # 移動終了時
  264.       if @active_battler.moving == 2
  265.         update_phase4_step3_sdva
  266.       end
  267.     elsif @active_battler.moving == 0
  268.       update_phase4_step3_sdva
  269.     end
  270.   end
  271.   #--------------------------------------------------------------------------
  272.   # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  273.   #--------------------------------------------------------------------------
  274.   alias update_phase4_step6_sdva update_phase4_step6
  275.   def update_phase4_step6
  276.     @active_battler.current_action.move_action = false
  277.     @active_battler.move_reset
  278.     update_phase4_step6_sdva
  279.   end
  280. end
  281. #==============================================================================
  282. # ■ Spriteset_Battle
  283. #==============================================================================
  284. class Spriteset_Battle
  285.   #--------------------------------------------------------------------------
  286.   # ● オブジェクト初期化
  287.   #--------------------------------------------------------------------------
  288.   alias initialize_sdva initialize
  289.   def initialize
  290.     initialize_sdva
  291.     @viewport2.z = 1
  292.   end
  293. end
  294. #==============================================================================
  295. # ■ Arrow_Actor
  296. #==============================================================================
  297. class Arrow_Actor < Arrow_Base
  298.   #--------------------------------------------------------------------------
  299.   # ● フレーム更新
  300.   #--------------------------------------------------------------------------
  301.   alias update_sdva update
  302.   def update
  303.     update_sdva
  304.     # カーソル下
  305.     if Input.repeat?(Input::DOWN)
  306.       $game_system.se_play($data_system.cursor_se)
  307.       @index += 1
  308.       @index %= $game_party.actors.size
  309.     end
  310.     # カーソル上
  311.     if Input.repeat?(Input::UP)
  312.       $game_system.se_play($data_system.cursor_se)
  313.       @index += $game_party.actors.size - 1
  314.       @index %= $game_party.actors.size
  315.     end
  316.   end
  317. end
  318. #==============================================================================
  319. # ■ Arrow_Enemy
  320. #==============================================================================
  321. class Arrow_Enemy < Arrow_Base
  322.   #--------------------------------------------------------------------------
  323.   # ● フレーム更新
  324.   #--------------------------------------------------------------------------
  325.   alias update_sdva update
  326.   def update
  327.     update_sdva
  328.     # カーソル下
  329.     if Input.repeat?(Input::DOWN)
  330.       $game_system.se_play($data_system.cursor_se)
  331.       $game_troop.enemies.size.times do
  332.         @index += 1
  333.         @index %= $game_troop.enemies.size
  334.         break if self.enemy.exist?
  335.       end
  336.     end
  337.     # カーソル上
  338.     if Input.repeat?(Input::UP)
  339.       $game_system.se_play($data_system.cursor_se)
  340.       $game_troop.enemies.size.times do
  341.         @index += $game_troop.enemies.size - 1
  342.         @index %= $game_troop.enemies.size
  343.         break if self.enemy.exist?
  344.       end
  345.     end
  346.   end
  347. end
复制代码
http://icv.cc声动音缘配音社
回复 支持 反对

使用道具 举报

845

主题

1万

帖子

214748万

积分

版主

脑残中……

Rank: 7Rank: 7Rank: 7

积分
2147483647

声命组金赏

 楼主| 发表于 2006-9-13 11:12:52 | 显示全部楼层

还是拿步行图做战斗图,可纵版和设定移动

  1. #==============================================================================
  2. # ++ サイドビューバトル(歩行グラフィック版) ver. 1.14 ++
  3. #  Script by パラ犬
  4. #  [url]http://2d6.parasite.jp/[/url]
  5. #------------------------------------------------------------------------------
  6. # バトルフィールドに歩行グラフィックを表示します。
  7. #==============================================================================
  8. module SDVA
  9.   
  10.   X_LINE = 500        # 横位置のバトラー表示座標
  11.   Y_LINE = 200        # 縦位置のバトラー表示座標
  12.   X_SPACE = 15        # 横位置のバトラー同士の間隔
  13.   Y_SPACE = 40        # 縦位置のバトラー同士の間隔
  14.   X_POSITION = 25     # 隊列[前衛・中衛・後衛]の横間隔
  15.   Y_POSITION = 0      # 隊列[前衛・中衛・後衛]の縦間隔
  16.   
  17.   ATTACK_MOVE = true  # 攻撃時に前へ踏み出すか( true / false )
  18.   SKILL_MOVE = true   # スキル使用時に前へ踏み出すか( true / false )
  19.   ITEM_MOVE = false   # アイテム使用時に前へ踏み出すか( true / false )
  20.   MOVE_STEP = 1       # 移動歩数
  21.   MOVE_PIXEL = 10     # 一歩あたりのピクセル数
  22.   
  23.   PARTY_POS = 1       # キャラクターの向き( 0:下 / 1:左 / 2:右 / 3:上 )
  24.   WINDOWPOS_CHANGE = true   # コマンドウインドウをバトラーの横に表示するか( true / false )
  25.   end
  26.   
  27. #==============================================================================
  28. # ■ Game_Actor
  29. #==============================================================================
  30. class Game_Actor < Game_Battler
  31.   #--------------------------------------------------------------------------
  32.   # ● バトル画面 X 座標の取得
  33.   #--------------------------------------------------------------------------
  34.   def screen_x
  35.     if self.index != nil
  36.       # 隊列を取得
  37.       pos = $data_classes[self.class_id].position
  38.       x_pos = pos * SDVA::X_POSITION
  39.       scr_x = self.index * SDVA::X_SPACE + SDVA::X_LINE + x_pos
  40.       # 移動アクションのとき
  41.       if self.current_action.move_action == true
  42.         # 横に移動
  43.         scr_x += @shift_x
  44.       end
  45.       return scr_x
  46.     else
  47.       return 0
  48.     end
  49.   end
  50.   #--------------------------------------------------------------------------
  51.   # ● バトル画面 Y 座標の取得
  52.   #--------------------------------------------------------------------------
  53.   def screen_y
  54.     if self.index != nil
  55.       # 隊列を取得
  56.       pos = $data_classes[self.class_id].position
  57.       y_pos = pos * SDVA::Y_POSITION
  58.       scr_y = self.index * SDVA::Y_SPACE + SDVA::Y_LINE + y_pos
  59.       # 移動アクションのとき
  60.       if self.current_action.move_action == true
  61.         # 縦に移動
  62.         scr_y += @shift_y
  63.       end
  64.       return scr_y
  65.     else
  66.       return 0
  67.     end
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # ● バトル画面 Z 座標の取得
  71.   #--------------------------------------------------------------------------
  72.   def screen_z
  73.     if self.index != nil
  74.       return self.index
  75.     else
  76.       return 0
  77.     end
  78.   end
  79. end
  80. #==============================================================================
  81. # ■ Game_Battler (分割定義 1)
  82. #==============================================================================
  83. class Game_Battler
  84.   #--------------------------------------------------------------------------
  85.   # ● 公開インスタンス変数
  86.   #--------------------------------------------------------------------------
  87.   attr_reader   :pattern        # 歩行パターン
  88.   attr_reader   :trans_x        # X方向の移動距離
  89.   attr_reader   :moving         # 移動中フラグ
  90.   #--------------------------------------------------------------------------
  91.   # ● オブジェクト初期化
  92.   #--------------------------------------------------------------------------
  93.   alias initialize_sdva initialize
  94.   def initialize
  95.     initialize_sdva
  96.     move_reset
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # ○ 移動カウント
  100.   #--------------------------------------------------------------------------
  101.   def move
  102.     @moving = 1
  103.       if @step < SDVA::MOVE_STEP
  104.         # 歩数を満たすまで移動
  105.         @pattern = (@pattern + 1) % 4
  106.         @step += 1
  107.         move_step
  108.       else
  109.         # 移動終了
  110.         @pattern = 1
  111.         @moving = 2
  112.       end
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ○ 移動処理
  116.   #--------------------------------------------------------------------------
  117.   def move_step
  118.   # パーティの向きによって移動座標を変える
  119.   case SDVA::PARTY_POS
  120.     when 0
  121.       @shift_y = @step * SDVA::MOVE_PIXEL
  122.     when 1
  123.       @shift_x = -(@step * SDVA::MOVE_PIXEL)
  124.     when 2
  125.       @shift_x = @step * SDVA::MOVE_PIXEL
  126.     when 3
  127.       @shift_y = -(@step * SDVA::MOVE_PIXEL)
  128.     end      
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   # ○ 移動のリセット
  132.   #--------------------------------------------------------------------------
  133.   def move_reset
  134.     @moving = 0
  135.     @pattern = 0
  136.     @step = 0
  137.     @shift_x = 0
  138.     @shift_y = 0
  139.   end
  140. end
  141. #==============================================================================
  142. # ■ Game_BattleAction
  143. #==============================================================================
  144. class Game_BattleAction
  145.   #--------------------------------------------------------------------------
  146.   # ● 公開インスタンス変数
  147.   #--------------------------------------------------------------------------
  148.   attr_accessor :move_action             # 移動するアクションか
  149.   #--------------------------------------------------------------------------
  150.   # ● クリア
  151.   #--------------------------------------------------------------------------
  152.   alias clear_sdva clear
  153.   def clear
  154.     clear_sdva
  155.     @move_action = false
  156.   end
  157. end
  158. #==============================================================================
  159. # ■ Sprite_Battler
  160. #==============================================================================
  161. class Sprite_Battler < RPG::Sprite
  162.   #--------------------------------------------------------------------------
  163.   # ● フレーム更新
  164.   #--------------------------------------------------------------------------
  165.   alias update_sdva update
  166.   def update
  167.     # バトラーがアクターに含まれるとき
  168.     if @battler.is_a?(Game_Actor)
  169.       # ファイル名か色相が現在のものと異なる場合
  170.       # 行動中の場合
  171.       if @battler.battler_name != @battler_name or
  172.          @battler.battler_hue != @battler_hue or
  173.          @battler.current_action.basic == 0 or
  174.          @battler.current_action.kind != 3
  175.         # ビットマップを取得、設定
  176.         @character_name = @battler.character_name
  177.         @character_hue = @battler.character_hue
  178.         # 歩行グラフィックを描画
  179.         self.bitmap = RPG::Cache.character(@character_name, @character_hue)
  180.         cw = self.bitmap.width / 4
  181.         ch = self.bitmap.height / 4
  182.         @width = cw
  183.         @height = ch
  184.         if @battler.current_action.move_action == true
  185.           # 歩かせる
  186.           @battler.move
  187.         else
  188.           @battler.move_reset
  189.         end
  190.         # 転送元の矩形を設定
  191.         sx = @battler.pattern * cw
  192.         sy = SDVA::PARTY_POS * ch
  193.         self.src_rect.set(sx, sy, cw, ch)
  194.         self.ox = @width / 2
  195.         self.oy = @height
  196.         # 隠れ状態なら不透明度を 0 にする
  197.         if @battler.hidden
  198.           self.opacity = 0
  199.         end
  200.       end
  201.     end
  202.     update_sdva
  203.   end
  204. end
  205.   
  206. #==============================================================================
  207. # ■ Scene_Battle
  208. #==============================================================================
  209. class Scene_Battle
  210.   #--------------------------------------------------------------------------
  211.   # ● アクターコマンドウィンドウのセットアップ
  212.   #--------------------------------------------------------------------------
  213.   alias phase3_setup_command_window_sdva phase3_setup_command_window
  214.   def phase3_setup_command_window
  215.     phase3_setup_command_window_sdva
  216.     if SDVA::WINDOWPOS_CHANGE
  217.       # アクターコマンドウィンドウの位置を設定
  218.       case SDVA::PARTY_POS
  219.         when 0
  220.           x_pos = @active_battler.screen_x - (@actor_command_window.width/2)
  221.           y_pos = @active_battler.screen_y
  222.         when 1
  223.           x_pos = @active_battler.screen_x - @actor_command_window.width - 16
  224.           y_pos = @active_battler.screen_y - @actor_command_window.height
  225.         when 2
  226.           x_pos = @active_battler.screen_x + 16
  227.           y_pos = @active_battler.screen_y - @actor_command_window.height
  228.         when 3
  229.           x_pos = @active_battler.screen_x - (@actor_command_window.width/2)
  230.           y_pos = @active_battler.screen_y - @actor_command_window.height - 48
  231.       end
  232.       @actor_command_window.x = x_pos >= 0 ? x_pos : 0
  233.       @actor_command_window.x = x_pos+@actor_command_window.width <= 640 ? x_pos : 640-@actor_command_window.width
  234.       @actor_command_window.y = y_pos >= 0 ? y_pos : 0
  235.       @actor_command_window.y = y_pos+@actor_command_window.height <= 480 ? y_pos : 480-@actor_command_window.height
  236.       # ステータスウインドウに隠れないように
  237.       @actor_command_window.z = 9999
  238.     end
  239.   end
  240.   #--------------------------------------------------------------------------
  241.   # ● フレーム更新 (メインフェーズ ステップ 3 : 行動側アニメーション)
  242.   #--------------------------------------------------------------------------
  243.   alias update_phase4_step3_sdva update_phase4_step3
  244.   def update_phase4_step3
  245.     if SDVA::ATTACK_MOVE
  246.       if @active_battler.current_action.basic == 0
  247.         @active_battler.current_action.move_action = true
  248.       end
  249.     end
  250.     if SDVA::SKILL_MOVE
  251.       if @active_battler.current_action.kind == 1
  252.         @active_battler.current_action.move_action = true
  253.       end
  254.     end
  255.     if SDVA::ITEM_MOVE
  256.       if @active_battler.current_action.kind == 2
  257.         @active_battler.current_action.move_action = true
  258.       end
  259.     end
  260.     # バトラーがアクターに含まれ、移動アクション中
  261.     if @active_battler.is_a?(Game_Actor) and
  262.      @active_battler.current_action.move_action
  263.       # 移動終了時
  264.       if @active_battler.moving == 2
  265.         update_phase4_step3_sdva
  266.       end
  267.     elsif @active_battler.moving == 0
  268.       update_phase4_step3_sdva
  269.     end
  270.   end
  271.   #--------------------------------------------------------------------------
  272.   # ● フレーム更新 (メインフェーズ ステップ 6 : リフレッシュ)
  273.   #--------------------------------------------------------------------------
  274.   alias update_phase4_step6_sdva update_phase4_step6
  275.   def update_phase4_step6
  276.     @active_battler.current_action.move_action = false
  277.     @active_battler.move_reset
  278.     update_phase4_step6_sdva
  279.   end
  280. end
  281. #==============================================================================
  282. # ■ Spriteset_Battle
  283. #==============================================================================
  284. class Spriteset_Battle
  285.   #--------------------------------------------------------------------------
  286.   # ● オブジェクト初期化
  287.   #--------------------------------------------------------------------------
  288.   alias initialize_sdva initialize
  289.   def initialize
  290.     initialize_sdva
  291.     @viewport2.z = 1
  292.   end
  293. end
  294. #==============================================================================
  295. # ■ Arrow_Actor
  296. #==============================================================================
  297. class Arrow_Actor < Arrow_Base
  298.   #--------------------------------------------------------------------------
  299.   # ● フレーム更新
  300.   #--------------------------------------------------------------------------
  301.   alias update_sdva update
  302.   def update
  303.     update_sdva
  304.     # カーソル下
  305.     if Input.repeat?(Input::DOWN)
  306.       $game_system.se_play($data_system.cursor_se)
  307.       @index += 1
  308.       @index %= $game_party.actors.size
  309.     end
  310.     # カーソル上
  311.     if Input.repeat?(Input::UP)
  312.       $game_system.se_play($data_system.cursor_se)
  313.       @index += $game_party.actors.size - 1
  314.       @index %= $game_party.actors.size
  315.     end
  316.   end
  317. end
  318. #==============================================================================
  319. # ■ Arrow_Enemy
  320. #==============================================================================
  321. class Arrow_Enemy < Arrow_Base
  322.   #--------------------------------------------------------------------------
  323.   # ● フレーム更新
  324.   #--------------------------------------------------------------------------
  325.   alias update_sdva update
  326.   def update
  327.     update_sdva
  328.     # カーソル下
  329.     if Input.repeat?(Input::DOWN)
  330.       $game_system.se_play($data_system.cursor_se)
  331.       $game_troop.enemies.size.times do
  332.         @index += 1
  333.         @index %= $game_troop.enemies.size
  334.         break if self.enemy.exist?
  335.       end
  336.     end
  337.     # カーソル上
  338.     if Input.repeat?(Input::UP)
  339.       $game_system.se_play($data_system.cursor_se)
  340.       $game_troop.enemies.size.times do
  341.         @index += $game_troop.enemies.size - 1
  342.         @index %= $game_troop.enemies.size
  343.         break if self.enemy.exist?
  344.       end
  345.     end
  346.   end
  347. end
复制代码
http://icv.cc声动音缘配音社
回复 支持 反对

使用道具 举报

845

主题

1万

帖子

214748万

积分

版主

脑残中……

Rank: 7Rank: 7Rank: 7

积分
2147483647

声命组金赏

 楼主| 发表于 2006-9-13 11:14:32 | 显示全部楼层

好象是升级提示,貌似很有用

  1. #==============================================================================
  2. # ++ 戦闘終了時にステータスUP ver. 1.40 ++
  3. #  Script by パラ犬
  4. #  [url]http://2d6.parasite.jp/[/url]
  5. #------------------------------------------------------------------------------
  6. # 戦闘時の行動により、バトル終了時にステータスがアップします。
  7. #------------------------------------------------------------------------------
  8. #[設置上の注意]
  9. # アクティブタイムバトルと併用する時は、このスクリプトを下に置いてください。
  10. #==============================================================================
  11. module PARA_STSUP
  12.   
  13.   # 各行動時に能力値がアップする確率
  14.   # (戦闘終了時に全ての行動の平均値で計算します)
  15.   # [最大HP/最大SP/腕力/器用さ/素早さ/魔力]
  16.   ACT_ATK = [10, 0, 10, 5, 5, 0]      # 通常攻撃
  17.   ACT_SKILL = [5, 10, 5, 5, 5, 5]     # スキル
  18.   ACT_GUARD = [20, 0, 0, 0, 0, 0]     # 防御
  19.   ACT_ITEM = [5, 5, 5, 5, 5, 5]       # アイテム
  20.   ACT_NONE = [0, 0, 0, 0, 0, 0]       # コマンド未入力または行動不能
  21.   # 武器属性で通常攻撃の成長率を変化
  22.   # (書式は「 "属性名"=>成長率 」。最終行は「 } 」で閉じる)
  23.   ATK_ELEMENTS = {  "剣" => [10, 0, 10, 5, 5, 0],
  24.                     "槍" => [10, 0, 10, 5, 5, 0],
  25.                     "斧" => [10, 0, 20, 0, 0, 0]}
  26.   # スキルの属性で成長率を変化
  27.   SKILL_ELEMENTS = {  "剣" => [5, 10, 10, 5, 5, 0],
  28.                       "槍" => [5, 10, 5, 5, 10, 0],
  29.                       "斧" => [10, 10, 20, 0, 0, 0],
  30.                       "黒魔法\\" => [0, 15, 0, 5, 0, 15],
  31.                       "神聖魔法" => [0, 15, 0, 0, 5, 15]}
  32.   # 上昇値 [最小値,最大値]
  33.   # [最大HP/最大SP/腕力/器用さ/素早さ/魔力]
  34.   UP_POINT = [ [5,20], [5,20], [1,5], [1,5], [1,5], [1,5] ]
  35.   
  36.   # 能力値限界
  37.   # [最大HP/最大SP/腕力/器用さ/素早さ/魔力]
  38.   LIMIT = [ 999999, 9999, 999, 999, 999, 999 ]
  39.   # ステータスアップを行わないアクターのID
  40.   #(アクターIDをコンマで区切って記述。 例:[ 0, 2, 3 ] )
  41.   EXC_ACTOR = []
  42.   # ステータスアップ結果の表示順( 0:アクターごと / 1:能力値ごと )
  43.   THREAD_TYPE = 0
  44.   # ステータス上昇ウインドウを表示するか( true / false )
  45.   VIEW_VISIBLE = true
  46.   # ステータス上昇ウインドウの書式
  47.   # {name} :アクター名
  48.   # {param} :パラメータ
  49.   # {point} :上昇値
  50.   VIEW_TEXT = "{name}の{param}が{point}ポイントアップ"
  51.   # ステータス上昇ウインドウの表示時間
  52.   VIEW_TIME = 40
  53.   # ステータス上昇ウインドウを表示しないときのアニメーション表示間隔
  54.   VIEW_ANM_TIME = 8
  55.   
  56.   # 敵との強さに差があるとき、成長率に影響を与えるか( true / false )
  57.   # (補正率は「敵の能力値÷アクターの能力値」の平均)
  58.   LVEF = true
  59.   # 能力値アップ率に対する補正率の適用パーセント
  60.   LVEF_PER = 50
  61.   # 上昇値に対する補正率の適用パーセント
  62.   LVEF_POINT = 0
  63.   # 人数差が補正率に与える影響(パーセント)
  64.   LVEF_PARTIES = 50
  65.   
  66.   # ステータスアップ時にアニメーションを表示( true / false )
  67.   ANM_USE = true
  68.   # 表示するアニメーションのID
  69.   ANM_HP = 98    # 最大HP
  70.   ANM_SP = 98    # 最大SP
  71.   ANM_STR = 98   # 腕力
  72.   ANM_DEX = 98   # 器用さ
  73.   ANM_AGI = 98   # 素早さ
  74.   ANM_INT = 98   # 魔力
  75.   
  76. end
  77. # ↑ 設定項目ここまで
  78. #------------------------------------------------------------------------------
  79. #==============================================================================
  80. # ■ Scene_Battle
  81. #==============================================================================
  82. class Scene_Battle
  83.   #--------------------------------------------------------------------------
  84.   # ● プレバトルフェーズ開始
  85.   #--------------------------------------------------------------------------
  86.   alias start_phase1_stsup start_phase1
  87.   def start_phase1
  88.     for actor in $game_party.actors
  89.       # 行動履歴を初期化
  90.       actor.act_history = []
  91.     end
  92.     @stsup = []
  93.     @now_stsup_anm = -1
  94.     @btl_lv = 0
  95.     enemy_sts = [0,0,0,0,0,0]
  96.     actor_sts = [0,0,0,0,0,0]
  97.     btl_lv = [0,0,0,0,0,0]
  98.     # エネミーの強さを記録
  99.     for enemy in $game_troop.enemies
  100.       enemy_sts[0] += enemy.base_maxhp
  101.       enemy_sts[1] += enemy.base_maxsp
  102.       enemy_sts[2] += enemy.base_str
  103.       enemy_sts[3] += enemy.base_dex
  104.       enemy_sts[4] += enemy.base_agi
  105.       enemy_sts[5] += enemy.base_int
  106.     end
  107.     # アクターの強さを記録
  108.     for actor in $game_party.actors
  109.       actor_sts[0] += actor.base_maxhp
  110.       actor_sts[1] += actor.base_maxsp
  111.       actor_sts[2] += actor.base_str
  112.       actor_sts[3] += actor.base_dex
  113.       actor_sts[4] += actor.base_agi
  114.       actor_sts[5] += actor.base_int
  115.     end
  116.     # 一体あたりの強さを計算
  117.     for i in 0..5
  118.       enemy_sts[i] /= $game_troop.enemies.size.to_f
  119.       actor_sts[i] /= $game_party.actors.size.to_f
  120.     end
  121.     # 敵の強さの倍率
  122.     for i in 0..5
  123.       btl_lv[i] = enemy_sts[i] / actor_sts[i]
  124.       @btl_lv += btl_lv[i]
  125.     end
  126.     @btl_lv /= btl_lv.size
  127.     # 人数差による補正
  128.     m = $game_troop.enemies.size.to_f / $game_party.actors.size.to_f
  129.     if m >= 1
  130.       m = 1 + (m - 1) * PARA_STSUP::LVEF_PARTIES / 100
  131.     else
  132.       m = 1 - (1 - m) * PARA_STSUP::LVEF_PARTIES / 100
  133.     end
  134.     if @btl_lv >= 1
  135.       @btl_lv = (@btl_lv - 1) * m + 1
  136.     else
  137.       @btl_lv = @btl_lv * m
  138.     end
  139.     start_phase1_stsup
  140.   end
  141.   #--------------------------------------------------------------------------
  142.   # ● 次のアクターのコマンド入力へ
  143.   #--------------------------------------------------------------------------
  144.   alias phase3_next_actor_stsup phase3_next_actor
  145.   def phase3_next_actor
  146.     if @active_battler != nil
  147.       # アクションを行動履歴に追加
  148.       act_kind = @active_battler.current_action.kind
  149.       act_basic = @active_battler.current_action.basic
  150.       act = [act_kind,act_basic]
  151.       if act == [0,0]  # 攻撃
  152.         # 武器属性によって成長率を変更
  153.         if @active_battler.element_set.size != 0
  154.           for element_id in @active_battler.element_set
  155.             element_name = $data_system.elements[element_id]
  156.             if PARA_STSUP::ATK_ELEMENTS.include?(element_name)
  157.               per = PARA_STSUP::ATK_ELEMENTS[element_name]
  158.             end
  159.           end
  160.         end
  161.         if per == nil
  162.           per = PARA_STSUP::ACT_ATK
  163.         end
  164.       elsif act == [0,1]  # 防御
  165.         per = PARA_STSUP::ACT_GUARD
  166.       elsif act == [1,3] or act == [1,0]  # スキル
  167.         # スキル属性によって成長率を変更
  168.         skill_id = @active_battler.current_action.skill_id
  169.         skill_elements = $data_skills[skill_id].element_set
  170.         if skill_elements.size != 0
  171.           for element_id in skill_elements
  172.             element_name = $data_system.elements[element_id]
  173.             if PARA_STSUP::SKILL_ELEMENTS.include?(element_name)
  174.               per = PARA_STSUP::SKILL_ELEMENTS[element_name]
  175.             end
  176.           end
  177.         end
  178.         if per == nil
  179.           per = PARA_STSUP::ACT_SKILL
  180.         end
  181.       elsif act == [2,3] or act == [2,0]  # アイテム
  182.         per = PARA_STSUP::ACT_ITEM
  183.       else
  184.         per = PARA_STSUP::ACT_NONE
  185.       end
  186.       @active_battler.act_history.push(per)
  187.     end
  188.     phase3_next_actor_stsup
  189.   end
  190.   #--------------------------------------------------------------------------
  191.   # ● 前のアクターのコマンド入力へ
  192.   #--------------------------------------------------------------------------
  193.   alias phase3_prior_actor_stsup phase3_prior_actor
  194.   def phase3_prior_actor
  195.     phase3_prior_actor_stsup
  196.     if @active_battler != nil
  197.       # 行動履歴を削除
  198.       @active_battler.act_history.pop
  199.     end
  200.   end
  201.   #--------------------------------------------------------------------------
  202.   # ● アフターバトルフェーズ開始
  203.   #--------------------------------------------------------------------------
  204.   alias start_phase5_stsup start_phase5
  205.   def start_phase5
  206.     start_phase5_stsup
  207.     # ステータスアップ処理
  208.     status_up
  209.   end
  210.   #--------------------------------------------------------------------------
  211.   # ● フレーム更新 (アフターバトルフェーズ)
  212.   #--------------------------------------------------------------------------
  213.   alias update_phase5_stsup update_phase5
  214.   def update_phase5
  215.     # ステータス上昇ウインドウ表示待ちのアイテムがある場合
  216.     if @stsup != nil and @stsup != []
  217.       # C ボタンが押された場合
  218.       if Input.trigger?(Input::C)
  219.         # 次のステータスアップウインドウを表示
  220.         result_stsup
  221.       end
  222.       # ウェイトカウントが 0 より大きい場合
  223.       if @phase5_wait_count > 0
  224.         # ウェイトカウントを減らす
  225.         @phase5_wait_count -= 1
  226.         # ウェイトカウントが 0 になった場合
  227.         if @phase5_wait_count == 0
  228.           # 次のステータスアップウインドウを表示
  229.           result_stsup
  230.         end
  231.         return
  232.       end
  233.     # ステータス上昇ウインドウ表示中の場合
  234.     elsif @help_window.visible
  235.       # C ボタンが押された場合
  236.       if Input.trigger?(Input::C)
  237.         @help_window.visible = false
  238.         @phase5_wait_count = 1
  239.       end
  240.       # ウェイトカウントが 0 より大きい場合
  241.       if @phase5_wait_count > 0
  242.         # ウェイトカウントを減らす
  243.         @phase5_wait_count -= 1
  244.         # ウェイトカウントが 0 になった場合
  245.         if @phase5_wait_count == 0
  246.           @help_window.visible = false
  247.           @phase5_wait_count = 1
  248.         end
  249.         return
  250.       end
  251.     else
  252.       update_phase5_stsup
  253.     end
  254.   end
  255.   #--------------------------------------------------------------------------
  256.   # ○ ステータスアップウインドウを表示
  257.   #--------------------------------------------------------------------------
  258.   def result_stsup
  259.     if @stsup[0] != nil and @stsup[0] != []
  260.       # 配列の先頭から値を取り出す
  261.       stsup = @stsup[0]
  262.       # 能力値の名前を取得
  263.       case stsup[1]
  264.         when 0  # 最大HP
  265.         stsup_sts = $data_system.words.hp
  266.         when 1  # 最大SP
  267.         stsup_sts = $data_system.words.sp
  268.         when 2  # 腕力
  269.         stsup_sts = $data_system.words.str
  270.         when 3  # 器用さ
  271.         stsup_sts = $data_system.words.dex
  272.         when 4  # 素早さ
  273.         stsup_sts = $data_system.words.agi
  274.         when 5  # 魔力
  275.         stsup_sts = $data_system.words.int
  276.       end
  277.       name = stsup[0].name
  278.       param = stsup_sts
  279.       point = stsup[2]
  280.       # 表示する文字列を設定
  281.       text = PARA_STSUP::VIEW_TEXT.dup
  282.       begin
  283.         text[/{name}/] = "#{name}"
  284.       rescue
  285.       end
  286.       begin
  287.         text[/{param}/] = "#{param}"
  288.       rescue
  289.       end
  290.       begin
  291.         text[/{point}/] = "#{point.to_s}"
  292.       rescue
  293.       end
  294.       # ヘルプウィンドウに文字列をセット
  295.       @help_window.set_text(text, 1)
  296.       # アニメーションを表示
  297.       if PARA_STSUP::ANM_USE
  298.         # アニメーションをまとめて表示
  299.         if PARA_STSUP::THREAD_TYPE == 1
  300.           if @now_stsup_anm != stsup[1]
  301.             @now_stsup_anm = stsup[1]
  302.             actors = []
  303.             for sts_group in @stsup
  304.               if sts_group[1] == @now_stsup_anm
  305.                 actors.push(sts_group[0])
  306.               end
  307.             end
  308.             for actor in actors
  309.               case @now_stsup_anm
  310.                 when 0  # 最大HP
  311.                 actor.animation_id = PARA_STSUP::ANM_HP
  312.                 when 1  # 最大SP
  313.                 actor.animation_id = PARA_STSUP::ANM_SP
  314.                 when 2  # 腕力
  315.                 actor.animation_id = PARA_STSUP::ANM_STR
  316.                 when 3  # 器用さ
  317.                 actor.animation_id = PARA_STSUP::ANM_DEX
  318.                 when 4  # 素早さ
  319.                 actor.animation_id = PARA_STSUP::ANM_AGI
  320.                 when 5  # 魔力
  321.                 actor.animation_id = PARA_STSUP::ANM_INT
  322.               end
  323.             end
  324.           end
  325.         else
  326.           actor = stsup[0]
  327.           case stsup[1]
  328.             when 0  # 最大HP
  329.             actor.animation_id = PARA_STSUP::ANM_HP
  330.             when 1  # 最大SP
  331.             actor.animation_id = PARA_STSUP::ANM_SP
  332.             when 2  # 腕力
  333.             actor.animation_id = PARA_STSUP::ANM_STR
  334.             when 3  # 器用さ
  335.             actor.animation_id = PARA_STSUP::ANM_DEX
  336.             when 4  # 素早さ
  337.             actor.animation_id = PARA_STSUP::ANM_AGI
  338.             when 5  # 魔力
  339.             actor.animation_id = PARA_STSUP::ANM_INT
  340.           end
  341.         end
  342.       end
  343.       @stsup.shift
  344.       # ヘルプウィンドウを表示
  345.       if PARA_STSUP::VIEW_VISIBLE
  346.         @help_window.visible = true
  347.         @phase5_wait_count = PARA_STSUP::VIEW_TIME
  348.       else
  349.         @help_window.visible = false
  350.         @phase5_wait_count = PARA_STSUP::VIEW_ANM_TIME
  351.       end
  352.     end
  353.   end
  354.   #--------------------------------------------------------------------------
  355.   # ○ ステータスアップ処理
  356.   #--------------------------------------------------------------------------
  357.   def status_up
  358.     for actor in $game_party.actors
  359.       # EXPを取得できないステート時もしくは
  360.       # 除外アクターは処理をスキップ
  361.       if actor.cant_get_exp? or PARA_STSUP::EXC_ACTOR.include?(actor.id)
  362.         next
  363.       end
  364.       stsup_percent = [0,0,0,0,0,0]
  365.       # コマンド未入力だった場合
  366.       if actor.act_history == []
  367.         # ダミーコマンドを追加
  368.         actor.act_history.push(PARA_STSUP::ACT_NONE)
  369.       end
  370.       for act in actor.act_history
  371.         # 上昇パーセンテージを合計
  372.         for i in 0...stsup_percent.size
  373.           stsup_percent[i] += act[i]
  374.         end
  375.       end
  376.       # 敵の強さによる補正
  377.       if PARA_STSUP::LVEF
  378.         for i in 0..stsup_percent.size-1
  379.           if @btl_lv >= 1
  380.             btl_per = 1 + (@btl_lv - 1) * PARA_STSUP::LVEF_PER / 100
  381.           else
  382.             btl_per = 1 - (1 - @btl_lv) * PARA_STSUP::LVEF_PER / 100
  383.           end
  384.           stsup_percent[i] *= btl_per
  385.         end
  386.       end
  387.       # 上昇パーセンテージを算出
  388.       for i in 0..stsup_percent.size-1
  389.         stsup_percent[i] /= actor.act_history.size
  390.       end
  391.       # 各ステータスで上昇判定
  392.       for s in 0..stsup_percent.size-1
  393.         rnd = rand(100)
  394.         if stsup_percent[s] > rnd
  395.           # 上昇値を決定
  396.           up_point = PARA_STSUP::UP_POINT[s].dup
  397.           # 敵の強さによる補正
  398.           if PARA_STSUP::LVEF
  399.             if @btl_lv >= 1
  400.               btl_point = 1 + (@btl_lv - 1) * PARA_STSUP::LVEF_POINT / 100
  401.             else
  402.               btl_point = 1 - (1 - @btl_lv) * PARA_STSUP::LVEF_POINT / 100
  403.             end
  404.             up_point[0] *= @btl_lv * btl_point
  405.             up_point[1] *= @btl_lv * btl_point
  406.           end
  407.           # ランダマイズ
  408.           rnd_val = (up_point[1] - up_point[0]).floor
  409.           rnd_pt = rand(rnd_val)
  410.           stsup_pt = (rnd_pt + up_point[0]).floor
  411.           # 能力値を上昇
  412.           case s
  413.             when 0  # 最大HP
  414.               if actor.stsup_maxhp + stsup_pt > PARA_STSUP::LIMIT[0]
  415.                 stsup_pt = PARA_STSUP::LIMIT[0] - actor.stsup_maxhp
  416.                 stsup_pt = stsup_pt < 0 ? 0 : stsup_pt
  417.               end
  418.               actor.stsup_maxhp += stsup_pt
  419.             when 1  # 最大SP
  420.               if actor.stsup_maxsp + stsup_pt > PARA_STSUP::LIMIT[1]
  421.                 stsup_pt = PARA_STSUP::LIMIT[1] - actor.stsup_maxsp
  422.                 stsup_pt = stsup_pt < 0 ? 0 : stsup_pt
  423.               end
  424.               actor.stsup_maxsp += stsup_pt
  425.             when 2  # 腕力
  426.               if actor.stsup_str + stsup_pt > PARA_STSUP::LIMIT[2]
  427.                 stsup_pt = PARA_STSUP::LIMIT[2] - actor.stsup_str
  428.                 stsup_pt = stsup_pt < 0 ? 0 : stsup_pt
  429.               end
  430.               actor.stsup_str += stsup_pt
  431.             when 3  # 器用さ
  432.               if actor.stsup_dex + stsup_pt > PARA_STSUP::LIMIT[3]
  433.                 stsup_pt = PARA_STSUP::LIMIT[3] - actor.stsup_dex
  434.                 stsup_pt = stsup_pt < 0 ? 0 : stsup_pt
  435.               end
  436.               actor.stsup_dex += stsup_pt
  437.             when 4  # 素早さ
  438.               if actor.stsup_agi + stsup_pt > PARA_STSUP::LIMIT[4]
  439.                 stsup_pt = PARA_STSUP::LIMIT[4] - actor.stsup_agi
  440.                 stsup_pt = stsup_pt < 0 ? 0 : stsup_pt
  441.               end
  442.               actor.stsup_agi += stsup_pt
  443.             when 5  # 魔力
  444.               if actor.stsup_int + stsup_pt > PARA_STSUP::LIMIT[5]
  445.                 stsup_pt = PARA_STSUP::LIMIT[5] - actor.stsup_int
  446.                 stsup_pt = stsup_pt < 0 ? 0 : stsup_pt
  447.               end
  448.               actor.stsup_int += stsup_pt
  449.           end
  450.           # 上昇ポイントが0のときはスキップ
  451.           if stsup_pt <= 0
  452.             next
  453.           end
  454.           # 配列に追加
  455.           @stsup.push([actor,s,stsup_pt])
  456.         end
  457.       end
  458.     end
  459.     if PARA_STSUP::THREAD_TYPE == 1 and @stsup != []
  460.       # 能力値ごとにソート
  461.       @stsup.sort! do |a, b|
  462.         if a[1] > b[1]
  463.           +1
  464.         elsif a[1] < b[1]
  465.           -1
  466.         elsif a[0].index > b[0].index
  467.           +1
  468.         elsif a[0].index < b[0].index
  469.           -1
  470.         else
  471.           a <=> b
  472.         end
  473.       end
  474.     end
  475.   end
  476. end
  477. #==============================================================================
  478. # ■ Game_Battler
  479. #==============================================================================
  480. class Game_Battler
  481.   #--------------------------------------------------------------------------
  482.   # ● 公開インスタンス変数
  483.   #--------------------------------------------------------------------------
  484.   attr_accessor :act_history          # 行動履歴
  485.   #--------------------------------------------------------------------------
  486.   # ● オブジェクト初期化
  487.   #--------------------------------------------------------------------------
  488.   alias initialize_stsup initialize
  489.   def initialize
  490.     initialize_stsup
  491.     @act_history = []
  492.   end
  493. end
  494. #==============================================================================
  495. # ■ Game_Actor
  496. #==============================================================================
  497. class Game_Actor < Game_Battler
  498.   #--------------------------------------------------------------------------
  499.   # ● 公開インスタンス変数
  500.   #--------------------------------------------------------------------------
  501.   attr_accessor :stsup_maxhp
  502.   attr_accessor :stsup_maxsp
  503.   attr_accessor :stsup_str
  504.   attr_accessor :stsup_dex
  505.   attr_accessor :stsup_agi
  506.   attr_accessor :stsup_int
  507.   #--------------------------------------------------------------------------
  508.   # ● セットアップ
  509.   #     actor_id : アクター ID
  510.   #--------------------------------------------------------------------------
  511.   alias setup_stsup setup
  512.   def setup(actor_id)
  513.     setup_stsup(actor_id)
  514.     @stsup_maxhp = 0
  515.     @stsup_maxsp = 0
  516.     @stsup_str = 0
  517.     @stsup_dex = 0
  518.     @stsup_agi = 0
  519.     @stsup_int = 0
  520.   end
  521.   #--------------------------------------------------------------------------
  522.   # ● 基本 MaxHP の取得
  523.   #--------------------------------------------------------------------------
  524.   alias base_maxhp_stsup base_maxhp
  525.   def base_maxhp
  526.     n = base_maxhp_stsup
  527.     if @stsup_maxhp != nil
  528.       n += @stsup_maxhp
  529.     end
  530.     return n
  531.   end
  532.   #--------------------------------------------------------------------------
  533.   # ● 基本 MaxSP の取得
  534.   #--------------------------------------------------------------------------
  535.   alias base_maxsp_stsup base_maxsp
  536.   def base_maxsp
  537.     n = base_maxsp_stsup
  538.     if @stsup_maxsp != nil
  539.       n += @stsup_maxsp
  540.     end
  541.     return n
  542.   end
  543.   #--------------------------------------------------------------------------
  544.   # ● 基本腕力の取得
  545.   #--------------------------------------------------------------------------
  546.   alias base_str_stsup base_str
  547.   def base_str
  548.     n = base_str_stsup
  549.     if @stsup_str != nil
  550.       n += @stsup_str
  551.     end
  552.     return n
  553.   end
  554.   #--------------------------------------------------------------------------
  555.   # ● 基本器用さの取得
  556.   #--------------------------------------------------------------------------
  557.   alias base_dex_stsup base_dex
  558.   def base_dex
  559.     n = base_dex_stsup
  560.     if @stsup_dex != nil
  561.       n += @stsup_dex
  562.     end
  563.     return n
  564.   end
  565.   #--------------------------------------------------------------------------
  566.   # ● 基本素早さの取得
  567.   #--------------------------------------------------------------------------
  568.   alias base_agi_stsup base_agi
  569.   def base_agi
  570.     n = base_agi_stsup
  571.     if @stsup_agi != nil
  572.       n += @stsup_agi
  573.     end
  574.     return n
  575.   end
  576.   #--------------------------------------------------------------------------
  577.   # ● 基本魔力の取得
  578.   #--------------------------------------------------------------------------
  579.   alias base_int_stsup base_int
  580.   def base_int
  581.     n = base_int_stsup
  582.     if @stsup_int != nil
  583.       n += @stsup_int
  584.     end
  585.     return n
  586.   end
  587. end
复制代码
http://icv.cc声动音缘配音社
回复 支持 反对

使用道具 举报

845

主题

1万

帖子

214748万

积分

版主

脑残中……

Rank: 7Rank: 7Rank: 7

积分
2147483647

声命组金赏

 楼主| 发表于 2006-9-13 11:16:06 | 显示全部楼层
  1. #==============================================================================
  2. # ++ メッセージふきだし表示 ver. 1.40 ++
  3. #  Script by パラ犬
  4. #  [url]http://2d6.parasite.jp/[/url]
  5. #------------------------------------------------------------------------------
  6. # ふきだし表示をするには、
  7. # テール用画像「(スキン名)-top」「(スキン名)-under」を
  8. # 「Graphics/Windowskins」フォルダにインポートしておく必要があります。
  9. #------------------------------------------------------------------------------
  10. #
  11. # [ふきだし表示の使い方]
  12. # イベントコマンド「スクリプト」で「$mes_id」にイベントIDを代入することで
  13. # そのイベントにふきだしがポップするようになります。
  14. # (記述例: $mes_id=4 )
  15. # IDに-1を代入するとプレイヤー、0でそのイベント自身。
  16. # nilまたは""を代入すると、通常のメッセージ表示に戻ります。
  17. # 表示位置はイベント「文章オプション」で変更できます。
  18. # 表示位置に「中央」を指定すると、イベントの位置に関係なく
  19. # 画面中央に表示されます。
  20. #
  21. # [名前ウインドウの使い方]
  22. # イベントコマンド「スクリプト」で「$mes_name」に文字列を代入することで
  23. # 名前ウインドウを表示します。
  24. # (記述例: $mes_name="アルシェス" )
  25. # 制御文字 \\N[n] を使用する場合、\\は\\\\と記述してください。
  26. # (記述例: $mes_name="\\\\N[1]"  $mes_name="\\\\N[\\\\V[1]]")
  27. # ""またはnilを代入すると、非表示になります。
  28. #
  29. # 二つの機能は独立していますので、それぞれ単体で使えます。
  30. #  $mes_id=(ID) + $mes_name="名前"  :ふきだし表示 + 名前ウインドウ
  31. #  $mes_id=(ID) + $mes_name=""      :ふきだし表示 (名前なし)
  32. #  $mes_id=nil + $mes_name="名前"   :デフォルトウインドウ + 名前ウインドウ
  33. #  $mes_id=nil + $mes_name=""       :デフォルトウインドウ (名前なし)
  34. #
  35. # [メッセージ表示スピードの変更法]
  36. # イベントコマンド「スクリプト」で「$mes_speed」に数値を代入します。
  37. # (記述例: $mes_speed=1 )
  38. #==============================================================================
  39. module FUKI
  40.   
  41.   # スキンの設定
  42.   # ウインドウスキンと同じものを使うときは「""」
  43.   FUKI_SKIN_NAME = "001-Blue01"   # ふきだし用スキン
  44.   NAME_SKIN_NAME = "001-Blue01"   # 名前表示用スキン
  45.   
  46.   # フォントサイズ
  47.   MES_FONT_SIZE = 22    # ふきだし
  48.   NAME_FONT_SIZE = 14   # 名前ウインドウ
  49.   
  50.   # 文字色
  51.   #( Color.new(0, 0, 0, 0)を指定すると、通常文字色を使用します )
  52.   FUKI_COLOR = Color.new(255, 255, 255, 255)  # ふきだしウインドウ
  53.   NAME_COLOR = Color.new(255, 255, 255, 255)  # 名前ウインドウ
  54.   
  55.   # ウインドウの透明度
  56.   FUKI_OPACITY = 255    # ふきだしウインドウ
  57.   MES_OPACITY = 255     # 通常のメッセージウインドウ
  58.   NAME_OPACITY = 255    # 名前ウインドウ
  59.   
  60.   # 名前ウインドウの相対位置
  61.   NAME_SHIFT_X = 0    # 横位置
  62.   NAME_SHIFT_Y = 16   # 縦位置
  63.   
  64.   # 画面上下からウインドウがはみ出す時は、
  65.   # 自動で表示位置(上下)をチェンジ( true / false )
  66.   POS_FIX = true
  67.   # 画面の一番端ではふきだしを少しずらす
  68.   # 角の丸いスキンを使っていて、枠の角がふきだしと重なる場合に true にする
  69.   CORNER_SHIFT = false
  70.   SHIFT_PIXEL = 4   # trueの時にずらすピクセル数
  71.   
  72.   # キャラクターの縦のサイズ
  73.   CHARACTOR_HEIGHT = 48
  74.   # ふきだしの相対位置(縦位置)
  75.   POP_SHIFT_TOP = 0     # 表示位置が上のとき
  76.   POP_SHIFT_UNDER = -16   # 表示位置が下のとき
  77.   
  78.   # メッセージ表示速度(数字が小さいほど速い。0で瞬間表示)
  79.   # $mes_speedに数値を代入することで、ゲーム中に変更可。
  80.   MES_SPEED = 1
  81. end
  82.   
  83. #==============================================================================
  84. # □ Window_FukiMessage
  85. #==============================================================================
  86. class Window_FukiMessage < Window_Selectable
  87.   #--------------------------------------------------------------------------
  88.   # ● オブジェクト初期化
  89.   #--------------------------------------------------------------------------
  90.   def initialize
  91.     super(80, 304, 480, 160)
  92.     self.contents = Bitmap.new(width - 32, height - 32)
  93.     self.visible = false
  94.     self.z = 9998
  95.     @fade_in = false
  96.     @fade_out = false
  97.     @contents_showing = false
  98.     @cursor_width = 0
  99.     self.active = false
  100.     self.index = -1
  101.     @w = 0
  102.     @h = 0
  103.     @wait = 0
  104.     @dx = 0
  105.     @dy = 0
  106.     $mes_speed = FUKI::MES_SPEED
  107.   end
  108.   #--------------------------------------------------------------------------
  109.   # ○ サイズを決定してウインドウを作成
  110.   #--------------------------------------------------------------------------
  111.   def refresh_create
  112.     self.contents.clear
  113.     self.contents.font.color = normal_color
  114.     self.contents.font.size = FUKI::MES_FONT_SIZE
  115.     # ウインドウサイズを取得
  116.     get_windowsize
  117.     w = @w + 32 + 8
  118.     h = @h * (self.contents.font.size + 10) + 26
  119.     # ふきだしウインドウを作成
  120.     set_fukidasi(self.x, self.y, w, h)
  121.     # 名前ウインドウを作成
  122.     set_namewindow
  123.     # メッセージ表示用変数の初期化
  124.     @dx = @dy = 0
  125.     @cursor_width = 0
  126.     @contents_drawing = true
  127.     # 瞬間表示の場合、ここで表示処理
  128.     if $mes_speed == 0
  129.       # 描画処理をループ
  130.       while $game_temp.message_text != ""
  131.         draw_massage
  132.       end
  133.       draw_opt_text
  134.       @contents_showing_end = true
  135.       @contents_drawing = false
  136.     else
  137.       # 一文字ずつ描画
  138.       refresh_drawtext
  139.     end
  140.   end
  141.   #--------------------------------------------------------------------------
  142.   # ○ 一文字ずつ描画
  143.   #--------------------------------------------------------------------------
  144.   def refresh_drawtext
  145.     if $game_temp.message_text != nil
  146.       if @wait > 0
  147.         @wait -= 1
  148.       elsif @wait == 0
  149.         # 描画処理
  150.         draw_massage
  151.         @wait = $mes_speed
  152.       end
  153.     end
  154.     # 描画終了
  155.     if $game_temp.message_text == ""
  156.       draw_opt_text
  157.       @contents_showing_end = true
  158.       @contents_drawing = false
  159.     end
  160.   end
  161.   #--------------------------------------------------------------------------
  162.   # ○ ウインドウサイズを取得
  163.   #--------------------------------------------------------------------------
  164.   def get_windowsize
  165.     x = y = 0
  166.     @h = @w = 0
  167.     @cursor_width = 0
  168.     # 選択肢なら字下げを行う
  169.     if $game_temp.choice_start == 0
  170.       x = 16
  171.     end
  172.     # 表示待ちのメッセージがある場合
  173.     if $game_temp.message_text != nil
  174.     text = $game_temp.message_text.clone
  175.       # 制御文字処理
  176.       begin
  177.         last_text = text.clone
  178.         text.gsub!(/\\\\[Vv]\\[([0-9]+)\\]/) { $game_variables[$1.to_i] }
  179.       end until text == last_text
  180.       text.gsub!(/\\\\[Nn]\\[([0-9]+)\\]/) do
  181.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  182.       end
  183.       # 便宜上、"\\\\\\\\" を "\\000" に変換
  184.       text.gsub!(/\\\\\\\\/) { "\\000" }
  185.       # "\\\\C" を "\\001" に、"\\\\G" を "\\002" に変換
  186.       text.gsub!(/\\\\[Cc]\\[([0-9]+)\\]/) { "\\001" }
  187.       text.gsub!(/\\\\[Gg]/) { "\\002" }
  188.       # c に 1 文字を取得 (文字が取得できなくなるまでループ)
  189.       while ((c = text.slice!(/./m)) != nil)
  190.         # \\\\ の場合
  191.         if c == "\\000"
  192.           # 本来の文字に戻す
  193.           c = "\\\\"
  194.         end
  195.         # \\C[n] または \\G の場合
  196.         if c == "\\001" or c == "\\002"
  197.           # 次の文字へ
  198.           next
  199.         end
  200.         # 改行文字の場合
  201.         if c == "\\n"
  202.           # y に 1 を加算
  203.           y += 1
  204.           # 縦横サイズを取得
  205.           @h = y
  206.           @w = x > @w ? x : @w
  207.           if y >= $game_temp.choice_start
  208.             @w = x + 8 > @w ? x + 8 : @w
  209.           end
  210.           x = 0
  211.           # 選択肢なら字下げを行う
  212.           if y >= $game_temp.choice_start
  213.             x = 8
  214.           end
  215.           # 次の文字へ
  216.           next
  217.         end
  218.         # x に描画した文字の幅を加算
  219.         x += self.contents.text_size(c).width
  220.       end
  221.     end
  222.     # 数値入力の場合
  223.     if $game_temp.num_input_variable_id > 0
  224.       digits_max = $game_temp.num_input_digits_max
  225.       number = $game_variables[$game_temp.num_input_variable_id]
  226.       @h += 1
  227.       x = digits_max * self.contents.font.size + 16
  228.       @w = x > @w ? x : @w
  229.     end
  230.   end
  231.   #--------------------------------------------------------------------------
  232.   # ○ 描画処理
  233.   #--------------------------------------------------------------------------
  234.   def draw_massage
  235.     self.contents.font.color = normal_color
  236.     # 表示待ちのメッセージがある場合
  237.     if $game_temp.message_text != nil
  238.       text = $game_temp.message_text
  239.       # 制御文字処理
  240.       begin
  241.         last_text = text.clone
  242.         text.gsub!(/\\\\[Vv]\\[([0-9]+)\\]/) { $game_variables[$1.to_i] }
  243.       end until text == last_text
  244.       text.gsub!(/\\\\[Nn]\\[([0-9]+)\\]/) do
  245.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  246.       end
  247.       # 便宜上、"\\\\\\\\" を "\\000" に変換
  248.       text.gsub!(/\\\\\\\\/) { "\\000" }
  249.       # "\\\\C" を "\\001" に、"\\\\G" を "\\002" に変換
  250.       text.gsub!(/\\\\[Cc]\\[([0-9]+)\\]/) { "\\001[#{$1}]" }
  251.       text.gsub!(/\\\\[Gg]/) { "\\002" }
  252.       # c に 1 文字を取得
  253.       if ((c = text.slice!(/./m)) != nil)
  254.         # 選択肢の場合
  255.         if @dy >= $game_temp.choice_start
  256.           # 字下げを行う
  257.           @dx = 8
  258.           # 文字を描画
  259.           font_size = self.contents.font.size
  260.           self.contents.draw_text(4+@dx, (font_size+10)*@dy, font_size, font_size, c)
  261.           # x に描画した文字の幅を加算
  262.           @dx += self.contents.text_size(c).width
  263.           # ループ
  264.           while ((c = text.slice!(/./m)) != "\\n")
  265.             # 文字を描画
  266.             font_size = self.contents.font.size
  267.             self.contents.draw_text(4+@dx, (font_size+10)*@dy, font_size, font_size, c)
  268.             # x に描画した文字の幅を加算
  269.             @dx += self.contents.text_size(c).width
  270.           end
  271.           if c == "\\n"
  272.             # カーソルの幅を更新
  273.             @cursor_width = [@cursor_width, @dx].max
  274.             # y に 1 を加算
  275.             @dy += 1
  276.             @dx = 0
  277.           end
  278.           return
  279.         end
  280.         # \\\\ の場合
  281.         if c == "\\000"
  282.           # 本来の文字に戻す
  283.           c = "\\\\"
  284.         end
  285.         # \\C[n] の場合
  286.         if c == "\\001"
  287.           # 文字色を変更
  288.           text.sub!(/\\[([0-9]+)\\]/, "")
  289.           color = $1.to_i
  290.           if color >= 0 and color <= 7
  291.             self.contents.font.color = text_color(color)
  292.           end
  293.         end
  294.         # \\G の場合
  295.         if c == "\\002"
  296.           # ゴールドウィンドウを作成
  297.           if @gold_window == nil
  298.             @gold_window = Window_Gold.new
  299.             @gold_window.x = 560 - @gold_window.width
  300.             if $game_temp.in_battle
  301.               @gold_window.y = 192
  302.             else
  303.               @gold_window.y = self.y >= 128 ? 32 : 384
  304.             end
  305.             @gold_window.opacity = self.opacity
  306.             @gold_window.back_opacity = self.back_opacity
  307.           end
  308.         end
  309.         # 改行文字の場合
  310.         if c == "\\n"
  311.           # y に 1 を加算
  312.           @dy += 1
  313.           @dx = 0
  314.         end
  315.         # 文字を描画
  316.         self.contents.font.size = FUKI::MES_FONT_SIZE
  317.         font_size = self.contents.font.size
  318.         self.contents.draw_text(4+@dx, (font_size+10)*@dy, font_size, font_size, c)
  319.         # x に描画した文字の幅を加算
  320.         @dx += self.contents.text_size(c).width
  321.       end
  322.     end
  323.   end
  324.   #--------------------------------------------------------------------------
  325.   # ○ 選択肢と数値入力を有効に
  326.   #--------------------------------------------------------------------------
  327.   def draw_opt_text
  328.     # 選択肢の場合
  329.     if $game_temp.choice_max > 0
  330.       @item_max = $game_temp.choice_max
  331.       self.active = true
  332.       self.index = 0
  333.     end
  334.     # 数値入力の場合
  335.     if $game_temp.num_input_variable_id > 0
  336.       digits_max = $game_temp.num_input_digits_max
  337.       number = $game_variables[$game_temp.num_input_variable_id]
  338.       @input_number_window = Window_InputNumber.new(digits_max)
  339.       @input_number_window.number = number
  340.       @input_number_window.x = self.x + 8
  341.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  342.     end
  343.   end
  344.   #--------------------------------------------------------------------------
  345.   # ○ ふきだしを表示
  346.   #--------------------------------------------------------------------------
  347.   def set_fukidasi(x, y, width, height)
  348.     # $mes_id が空のときはふきだしを表示しない
  349.     if $mes_id == nil or $mes_id == ""
  350.       del_fukidasi
  351.       reset_window
  352.     else
  353.       # ポーズサインを非表示
  354.       self.pause = false
  355.       # 位置を取得
  356.       pos = get_fuki_pos(width, height)
  357.       x = pos[0]
  358.       y = pos[1]
  359.       skin = FUKI::FUKI_SKIN_NAME != "" ? FUKI::FUKI_SKIN_NAME : $game_system.windowskin_name
  360.       # ふきだし用メッセージウインドウを作成
  361.       self.windowskin = RPG::Cache.windowskin(skin)
  362.       self.x = x
  363.       self.y = y
  364.       self.height = height
  365.       self.width = width
  366.       self.contents.dispose
  367.       self.contents = Bitmap.new(width - 32, height - 32)
  368.       self.back_opacity = FUKI::FUKI_OPACITY
  369.       self.contents.clear
  370.       self.contents.font.color = normal_color
  371.       self.contents.font.size = FUKI::MES_FONT_SIZE
  372.       # ふきだしのテールを描画
  373.       if $game_system.message_frame == 0
  374.         # 位置を取得
  375.         tale_pos = get_tale_pos
  376.         @tale = Sprite.new
  377.         case @message_position
  378.           when 0  # 上
  379.             @tale.bitmap = RPG::Cache.windowskin(skin + "-top")
  380.             @tale.x = tale_pos[0]
  381.             @tale.y = tale_pos[1]
  382.             @tale.z = self.z + 1
  383.           when 1  # 中
  384.             @tale.dispose
  385.             @tale = nil
  386.           when 2  # 下
  387.             @tale.bitmap = RPG::Cache.windowskin(skin + "-under")
  388.             @tale.x = tale_pos[0]
  389.             @tale.y = tale_pos[1]
  390.             @tale.z = self.z + 1
  391.         end
  392.       end
  393.     end
  394.   end
  395.   #--------------------------------------------------------------------------
  396.   # ○ ふきだしの位置を計算
  397.   #--------------------------------------------------------------------------
  398.   def get_fuki_pos(width, height)
  399.     # キャラクターを取得
  400.     @character = get_character($mes_id)
  401.     if @character == nil
  402.       # キャラクターが存在しないときは通常のメッセージウインドウに
  403.       del_fukidasi
  404.       reset_window
  405.       return
  406.     end
  407.     # 座標処理
  408.     x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - (width / 2)
  409.     # はみ出すときは画面内に収まるように移動
  410.     if x + width > 640
  411.       x = 640 - width
  412.     elsif x < 0
  413.       x = 0
  414.     end
  415.     # ウインドウの位置を決定
  416.     case $game_system.message_position
  417.       when 0  # 上
  418.         y = ( @character.real_y - $game_map.display_y + 64) * 32 / 128 - height - FUKI::CHARACTOR_HEIGHT + FUKI::POP_SHIFT_TOP
  419.       when 1  # 中
  420.         y = (480 - height) / 2
  421.         x = (640 - width) / 2
  422.       when 2  # 下
  423.         y =  ( @character.real_y - $game_map.display_y + 64) * 32 / 128 + 32 + FUKI::POP_SHIFT_UNDER
  424.     end
  425.     #メッセージポジション一時記憶
  426.     @message_position = $game_system.message_position
  427.     # 画面外にはみ出す時はウインドウの上下をチェンジ
  428.     if FUKI::POS_FIX
  429.       case @message_position
  430.         when 0  # 上
  431.           if y <= 0
  432.             @message_position = 2
  433.             y =  ( @character.real_y - $game_map.display_y + 64) * 32 / 128 + FUKI::POP_SHIFT_UNDER
  434.           end
  435.         when 2  # 下
  436.           if y + height >= 480
  437.             @message_position = 0
  438.             y = ( @character.real_y - $game_map.display_y + 64) * 32 / 128 - height + 32 - FUKI::CHARACTOR_HEIGHT + FUKI::POP_SHIFT_TOP
  439.           end
  440.       end
  441.     end
  442.     return [x,y]
  443.   end
  444.   #--------------------------------------------------------------------------
  445.   # ○ テールの位置を計算
  446.   #--------------------------------------------------------------------------
  447.   def get_tale_pos
  448.     case @message_position
  449.       when 0  # 上
  450.         # 座標処理
  451.         x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16
  452.         # 画面端では位置をずらす
  453.         if FUKI::CORNER_SHIFT
  454.           if x == 0
  455.             x = FUKI::SHIFT_PIXEL
  456.           elsif x == 640 - 32
  457.             x = 640 - 32 - FUKI::SHIFT_PIXEL
  458.           end
  459.         end
  460.         y = self.y + self.height - 16
  461.       when 1  # 中
  462.         x = nil
  463.         y = nil
  464.       when 2  # 下
  465.         # 座標処理
  466.         x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16
  467.         # 画面端では位置をずらす
  468.         if FUKI::CORNER_SHIFT
  469.           if x == 0
  470.             x = FUKI::SHIFT_PIXEL
  471.           elsif @tale.x == 640 - 32
  472.             x = 640 - 32 - FUKI::SHIFT_PIXEL
  473.           end
  474.         end
  475.         y = self.y - 16
  476.     end
  477.     return [x,y]
  478.   end
  479.   #--------------------------------------------------------------------------
  480.   # ○ 名前ウインドウを表示
  481.   #--------------------------------------------------------------------------
  482.   def set_namewindow
  483.     # $mes_name が空のときは名前ウインドウを表示しない
  484.     if $mes_name == nil or $mes_name == ""
  485.       return
  486.     else
  487.       # 変数をセット
  488.       mes_name = $mes_name
  489.       # 制御文字処理
  490.       begin
  491.         last_text = mes_name.clone
  492.         mes_name.gsub!(/\\\\[Vv]\\[([0-9]+)\\]/) { $game_variables[$1.to_i] }
  493.       end until mes_name == last_text
  494.       mes_name.gsub!(/\\\\[Nn]\\[([0-9]+)\\]/) do
  495.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  496.       end
  497.       name_width = mes_name.size / 2 * FUKI::NAME_FONT_SIZE
  498.       name_height = FUKI::NAME_FONT_SIZE
  499.       name_x = self.x + FUKI::NAME_SHIFT_X
  500.       name_y = self.y - name_height - 16 + FUKI::NAME_SHIFT_Y
  501.       # 名前ウインドウ(枠のみ)を作成
  502.       @name_win = Window_Base.new(name_x, name_y, name_width + 16, name_height + 16)
  503.       skin = FUKI::NAME_SKIN_NAME != "" ? FUKI::NAME_SKIN_NAME : $game_system.windowskin_name
  504.       @name_win.windowskin = RPG::Cache.windowskin(skin)
  505.       @name_win.back_opacity = FUKI::NAME_OPACITY
  506.       @name_win.z = self.z + 1
  507.       # 余白をwindowクラスの限界よりも小さくするため、二重構造に
  508.       @name_contents = Sprite.new
  509.       @name_contents.x = name_x + 12
  510.       @name_contents.y = name_y + 8
  511.       @name_contents.bitmap = Bitmap.new(name_width, name_height)
  512.       @name_contents.z = @name_win.z + 2
  513.       # 文字色の設定
  514.       nil_color = Color.new(0,0,0,0)
  515.       if FUKI::NAME_COLOR != nil_color
  516.         @name_contents.bitmap.font.color = FUKI::NAME_COLOR
  517.       else
  518.         @name_contents.bitmap.font.color = normal_color
  519.       end
  520.       @name_contents.bitmap.font.size = FUKI::NAME_FONT_SIZE
  521.       # ウインドウサイズを調整
  522.       rect = @name_contents.bitmap.text_size(mes_name)
  523.       @name_win.width = rect.width + 32
  524.       # 名前を描画
  525.       @name_contents.bitmap.draw_text(rect, mes_name)
  526.     end
  527.   end
  528.   #--------------------------------------------------------------------------
  529.   # ○ ふきだしと名前ウインドウを破棄
  530.   #--------------------------------------------------------------------------
  531.   def del_fukidasi
  532.     if @tale != nil
  533.       @tale.dispose
  534.       @tale = nil
  535.     end
  536.     if @name_win != nil
  537.       @name_win.dispose
  538.       @name_win = nil
  539.       @name_contents.dispose
  540.       @name_contents = nil
  541.     end
  542.     self.opacity = 0
  543.     self.x = 80
  544.     self.width = 480
  545.     self.height = 160
  546.     self.contents.dispose
  547.     self.contents = Bitmap.new(width - 32, height - 32)
  548.     self.pause = true
  549.   end
  550.   #--------------------------------------------------------------------------
  551.   # ○ キャラクターの取得
  552.   #     parameter : パラメータ
  553.   #--------------------------------------------------------------------------
  554.   def get_character(parameter)
  555.     # パラメータで分岐
  556.     case parameter
  557.     when -1  # プレイヤー
  558.       return $game_player
  559.     when 0  # このイベント
  560.       events = $game_map.events
  561.       return events == nil ? nil : events[$active_event_id]
  562.     else  # 特定のイベント
  563.       events = $game_map.events
  564.       return events == nil ? nil : events[parameter]
  565.     end
  566.   end
  567.   #--------------------------------------------------------------------------
  568.   # ● ウィンドウの位置と不透明度の設定
  569.   #--------------------------------------------------------------------------
  570.   def reset_window
  571.     if $game_temp.in_battle
  572.       self.y = 16
  573.     else
  574.       case $game_system.message_position
  575.       when 0  # 上
  576.         self.y = 16
  577.       when 1  # 中
  578.         self.y = 160
  579.       when 2  # 下
  580.         self.y = 304
  581.       end
  582.     end
  583.     if $game_system.message_frame == 0
  584.       self.opacity = 255
  585.     else
  586.       self.opacity = 0
  587.     end
  588.     self.back_opacity = FUKI::MES_OPACITY
  589.   end
  590.   #--------------------------------------------------------------------------
  591.   # ● フレーム更新
  592.   #--------------------------------------------------------------------------
  593.   def update
  594.     super
  595.     # ふきだしモードではイベントの動きに追従
  596.     if @tale != nil
  597.       pos = get_fuki_pos(self.width, self.height)
  598.       self.x = pos[0]
  599.       self.y = pos[1]
  600.       tale_pos = get_tale_pos
  601.       @tale.x = tale_pos[0]
  602.       @tale.y = tale_pos[1]
  603.       if @name_win != nil
  604.         name_height = FUKI::NAME_FONT_SIZE
  605.         @name_win.x = self.x + FUKI::NAME_SHIFT_X
  606.         @name_win.y = self.y - name_height - 16 + FUKI::NAME_SHIFT_Y
  607.         @name_contents.x = @name_win.x + 12
  608.         @name_contents.y = @name_win.y + 8
  609.       end
  610.     end
  611.     # フェードインの場合
  612.     if @fade_in
  613.       self.contents_opacity += 24
  614.       if @name_win != nil
  615.         @name_win.opacity += 24
  616.       end
  617.       if @tale != nil
  618.         @tale.opacity += 24
  619.       end
  620.       if @input_number_window != nil
  621.         @input_number_window.contents_opacity += 24
  622.       end
  623.       if self.contents_opacity == 255
  624.         @fade_in = false
  625.       end
  626.       return
  627.     end
  628.     # メッセージ表示中の場合
  629.     if @contents_drawing
  630.       refresh_drawtext
  631.       return
  632.     end
  633.     # 数値入力中の場合
  634.     if @input_number_window != nil
  635.       @input_number_window.update
  636.       # 決定
  637.       if Input.trigger?(Input::C)
  638.         $game_system.se_play($data_system.decision_se)
  639.         $game_variables[$game_temp.num_input_variable_id] =
  640.           @input_number_window.number
  641.         $game_map.need_refresh = true
  642.         # 数値入力ウィンドウを解放
  643.         @input_number_window.dispose
  644.         @input_number_window = nil
  645.         terminate_message
  646.       end
  647.       return
  648.     end
  649.     # メッセージ表示終了の場合
  650.     if @contents_showing_end
  651.       # 選択肢の表示中でなければポーズサインを表示
  652.       # ふきだしモードでは非表示
  653.       if $game_temp.choice_max == 0 and @tale == nil
  654.         self.pause = true
  655.       else
  656.         self.pause = false
  657.       end
  658.       # キャンセル
  659.       if Input.trigger?(Input::B)
  660.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  661.           $game_system.se_play($data_system.cancel_se)
  662.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  663.           terminate_message
  664.         end
  665.       end
  666.       # 決定
  667.       if Input.trigger?(Input::C)
  668.         if $game_temp.choice_max > 0
  669.           $game_system.se_play($data_system.decision_se)
  670.           $game_temp.choice_proc.call(self.index)
  671.         end
  672.         terminate_message
  673.         # ふきだしを破棄
  674.         del_fukidasi
  675.       end
  676.       return
  677.     end
  678.     # フェードアウト中以外で表示待ちのメッセージか選択肢がある場合
  679.     if @fade_out == false and $game_temp.message_text != nil
  680.       @contents_showing = true
  681.       $game_temp.message_window_showing = true
  682.       reset_window
  683.       refresh_create
  684.       if @name_win != nil
  685.         @name_win.opacity = 0
  686.       end
  687.       if @tale != nil
  688.         @tale.opacity = 0
  689.       end
  690.       Graphics.frame_reset
  691.       self.visible = true
  692.       self.contents_opacity = 0
  693.       if @input_number_window != nil
  694.         @input_number_window.contents_opacity = 0
  695.       end
  696.       @fade_in = true
  697.       return
  698.     end
  699.     # 表示すべきメッセージがないが、ウィンドウが可視状態の場合
  700.     if self.visible
  701.       @fade_out = true
  702.       self.opacity -= 48
  703.       if @name_win != nil
  704.         @name_win.opacity -= 48
  705.       end
  706.       if @tale != nil
  707.         @tale.opacity -= 48
  708.       end
  709.       if self.opacity == 0
  710.         self.visible = false
  711.         @fade_out = false
  712.         $game_temp.message_window_showing = false
  713.         del_fukidasi
  714.       end
  715.       return
  716.     end
  717.   end
  718.   #--------------------------------------------------------------------------
  719.   # ●解放
  720.   #--------------------------------------------------------------------------
  721.   def dispose
  722.     terminate_message
  723.     $game_temp.message_window_showing = false
  724.     if @input_number_window != nil
  725.       @input_number_window.dispose
  726.     end
  727.     super
  728.   end
  729.   #--------------------------------------------------------------------------
  730.   # ● メッセージ終了処理
  731.   #--------------------------------------------------------------------------
  732.   def terminate_message
  733.     self.active = false
  734.     self.pause = false
  735.     self.index = -1
  736.     self.contents.clear
  737.     # 表示中フラグをクリア
  738.     @contents_showing = false
  739.     @contents_showing_end = false
  740.     # メッセージ コールバックを呼ぶ
  741.     if $game_temp.message_proc != nil
  742.       $game_temp.message_proc.call
  743.     end
  744.     # 文章、選択肢、数値入力に関する変数をクリア
  745.     $game_temp.message_text = nil
  746.     $game_temp.message_proc = nil
  747.     $game_temp.choice_start = 99
  748.     $game_temp.choice_max = 0
  749.     $game_temp.choice_cancel_type = 0
  750.     $game_temp.choice_proc = nil
  751.     $game_temp.num_input_start = 99
  752.     $game_temp.num_input_variable_id = 0
  753.     $game_temp.num_input_digits_max = 0
  754.     # ゴールドウィンドウを開放
  755.     if @gold_window != nil
  756.       @gold_window.dispose
  757.       @gold_window = nil
  758.     end
  759.   end
  760.   #--------------------------------------------------------------------------
  761.   # ● カーソルの矩形更新
  762.   #--------------------------------------------------------------------------
  763.   def update_cursor_rect
  764.     if @index >= 0
  765.       n = $game_temp.choice_start + @index
  766.       font_size = self.contents.font.size
  767.       self.cursor_rect.set(8, n*(font_size+10)-5, @cursor_width, (font_size+10))
  768.     else
  769.       self.cursor_rect.empty
  770.     end
  771.   end
  772.   #--------------------------------------------------------------------------
  773.   # ● 通常文字色の取得
  774.   #--------------------------------------------------------------------------
  775.   def normal_color
  776.     # ふきだしモード時に設定を適用
  777.     if $mes_id != nil and $mes_id != ""
  778.       nil_color = Color.new(0,0,0,0)
  779.       if FUKI::FUKI_COLOR != nil_color
  780.         color = FUKI::FUKI_COLOR
  781.       else
  782.         color = super
  783.       end
  784.       return color
  785.     else
  786.       # 非ふきだし時には通常文字色
  787.       return super
  788.     end
  789.   end
  790. end
  791. #==============================================================================
  792. # ■ Interpreter
  793. #==============================================================================
  794. class Interpreter
  795.   #--------------------------------------------------------------------------
  796.   # ● イベントのセットアップ
  797.   #     event_id : イベント ID
  798.   #--------------------------------------------------------------------------
  799.   alias setup_fuki setup
  800.   def setup(list, event_id)
  801.     setup_fuki(list, event_id)
  802.     # 戦闘中でなければ
  803.     if !($game_temp.in_battle)
  804.       # イベントIDを記録
  805.       $active_event_id = event_id
  806.     end
  807.   end
  808. end
  809. #==============================================================================
  810. # ■ Scene_Map
  811. #==============================================================================
  812. class Scene_Map
  813.   #--------------------------------------------------------------------------
  814.   # ● メイン処理
  815.   #--------------------------------------------------------------------------
  816.   def main
  817.     # スプライトセットを作成
  818.     @spriteset = Spriteset_Map.new
  819.     # メッセージウィンドウを作成
  820.     @message_window = Window_FukiMessage.new
  821.     # トランジション実行
  822.     Graphics.transition
  823.     # メインループ
  824.     loop do
  825.       # ゲーム画面を更新
  826.       Graphics.update
  827.       # 入力情報を更新
  828.       Input.update
  829.       # フレーム更新
  830.       update
  831.       # 画面が切り替わったらループを中断
  832.       if $scene != self
  833.         break
  834.       end
  835.     end
  836.     # トランジション準備
  837.     Graphics.freeze
  838.     # スプライトセットを解放
  839.     @spriteset.dispose
  840.     # メッセージウィンドウを解放
  841.     @message_window.dispose
  842.     # タイトル画面に切り替え中の場合
  843.     if $scene.is_a?(Scene_Title)
  844.       # 画面をフェードアウト
  845.       Graphics.transition
  846.       Graphics.freeze
  847.     end
  848.   end
  849. end
  850. #==============================================================================
  851. # ■ Window_InputNumber
  852. #==============================================================================
  853. class Window_InputNumber < Window_Base
  854.   #--------------------------------------------------------------------------
  855.   # ● オブジェクト初期化
  856.   #     digits_max : 桁数
  857.   #--------------------------------------------------------------------------
  858.   def initialize(digits_max)
  859.     @digits_max = digits_max
  860.     @number = 0
  861.     # 数字の幅からカーソルの幅を計算 (0~9 は等幅と仮定)
  862.     dummy_bitmap = Bitmap.new(32, 32)
  863.     dummy_bitmap.font.size = FUKI::MES_FONT_SIZE
  864.     @cursor_width = dummy_bitmap.text_size("0").width + 8
  865.     dummy_bitmap.dispose
  866.     super(0, 0, @cursor_width * @digits_max + 32, 64)
  867.     self.contents = Bitmap.new(width - 32, height - 32)
  868.     self.contents.font.size = FUKI::MES_FONT_SIZE
  869.     self.z += 9999
  870.     self.opacity = 0
  871.     @index = 0
  872.     refresh
  873.     update_cursor_rect
  874.   end
  875. end
复制代码
http://icv.cc声动音缘配音社
回复 支持 反对

使用道具 举报

845

主题

1万

帖子

214748万

积分

版主

脑残中……

Rank: 7Rank: 7Rank: 7

积分
2147483647

声命组金赏

 楼主| 发表于 2006-9-13 11:18:26 | 显示全部楼层

好象|| 是同时呼出2个对话框

  1. #==============================================================================
  2. # +++ コラボレーション「+ふきだし表示」 ver.1.13 +++
  3. # Script by
  4. #    パラ犬  [url]http://2d6.parasite.jp/[/url]
  5. #      ×
  6. #    桜雅 在土 [url]http://xms.rdy.jp/[/url]
  7. #
  8. #------------------------------------------------------------------------------
  9. #   ほぼどんなメッセージウィンドウに対しても後付け可能な「ふきだし表示」です。
  10. #  また、テール部分のみの自動追尾機能を持ちます。
  11. #==============================================================================
  12. # ふきだし表示をするには、
  13. # テール用画像「(スキン名)-top」「(スキン名)-under」を
  14. # 「Graphics/Windowskins」フォルダにインポートしておく必要があります。
  15. #------------------------------------------------------------------------------
  16. #
  17. # [ふきだし表示の使い方]
  18. # イベントコマンド「スクリプト」で「$mes_id」にイベントIDを代入することで
  19. # そのイベントにふきだしがポップするようになります。
  20. # (記述例: $mes_id=4 )
  21. # IDに0を代入するとプレイヤー、 nil代入すると、通常のメッセージ表示に戻ります。
  22. # 表示位置はイベント「文章オプション」で変更できます。
  23. # 表示位置に「中央」を指定すると、イベントの位置に関係なく
  24. # 画面中央に表示されます。
  25. #
  26. #==============================================================================
  27. #==============================================================================
  28. # □ カスタマイズポイント
  29. #==============================================================================
  30. class Window_Message < Window_Selectable
  31.   #--------------------------------------------------------------------------
  32.   # ふきだしモード時のスキン設定
  33.   #--------------------------------------------------------------------------
  34.   # スキン名(元のウインドウスキンと同じものを使うときは「""」)
  35.   FUKI_SKIN_NAME = "001-Blue01"
  36.   # ウインドウ背景の不透明度(デフォルトは160)
  37.   FUKI_OPACITY = 255
  38. end
  39. #==============================================================================
  40. # ■ Window_Message
  41. #==============================================================================
  42. class Window_Message < Window_Selectable
  43.   #--------------------------------------------------------------------------
  44.   # ● メッセージ終了処理
  45.   #--------------------------------------------------------------------------
  46.   alias parashelf_terminate_message terminate_message
  47.   def terminate_message
  48.     # 呼び戻す
  49.     parashelf_terminate_message
  50.     # ふきだしの消去
  51.     del_tail
  52.   end
  53.   #--------------------------------------------------------------------------
  54.   # ● リフレッシュ
  55.   #--------------------------------------------------------------------------
  56.   alias parashelf_refresh refresh
  57.   def refresh
  58.     # 呼び戻す
  59.     parashelf_refresh
  60.     # ふきだしの再設定
  61.     del_tail
  62.     set_tail
  63.   end
  64.   #--------------------------------------------------------------------------
  65.   # ● ウィンドウの位置と不透明度の設定
  66.   #--------------------------------------------------------------------------
  67.   alias parashelf_reset_window reset_window
  68.   def reset_window
  69.     # 呼び戻す
  70.     parashelf_reset_window
  71.     # テールの位置を変更
  72.     if $mes_id != nil and @tail != nil
  73.       tale_pos = get_tale_pos
  74.       @tail.x = tale_pos[0]
  75.       @tail.y = tale_pos[1]
  76.     end
  77.   end
  78.   #--------------------------------------------------------------------------
  79.   # ● フレーム更新
  80.   #--------------------------------------------------------------------------
  81.   alias parashelf_update update
  82.   def update
  83.     # 呼び戻す
  84.     parashelf_update
  85.     # ふきだしテールの更新
  86.     update_tail
  87.     # メッセージ表示中の場合
  88.     if @contents_showing
  89.       # テールがある場合はポーズサインを非表示
  90.       if @tail != nil
  91.         self.pause = false
  92.       end
  93.     end
  94.     # メッージ終了時にスキン設定が戻っていない場合
  95.     if $game_temp.message_window_showing == false and @def_skin_name != nil
  96.       # スキンを戻す
  97.       reset_fuki_skin
  98.     end
  99.   end
  100.   #--------------------------------------------------------------------------
  101.   # ○ フレーム更新 (ふきだしテール)
  102.   #--------------------------------------------------------------------------
  103.   def update_tail
  104.     # ふきだしモードではイベントの動きに追従
  105.     if $mes_id != nil and @tail != nil
  106.       tale_pos = get_tale_pos
  107.       @tail.x = tale_pos[0]
  108.       @tail.y = tale_pos[1]
  109.       skin = $game_system.windowskin_name
  110.       case @message_position
  111.       when 0  # 上
  112.         @tail.bitmap = RPG::Cache.windowskin(skin + "-top")
  113.       when 2  # 下
  114.         @tail.bitmap = RPG::Cache.windowskin(skin + "-under")
  115.       end
  116.     end
  117.   end
  118.   #--------------------------------------------------------------------------
  119.   # ○ ふきだしテールを表示
  120.   #--------------------------------------------------------------------------
  121.   def set_tail
  122.     # $mes_id が空のときと戦闘中はふきだしを表示しない
  123.     if $mes_id == nil or $game_temp.in_battle
  124.       del_tail
  125.       # スキンを戻す
  126.       reset_fuki_skin
  127.     else
  128.       # スキンをセット
  129.       set_fuki_skin
  130.       # ふきだしのテールを描画
  131.       skin = $game_system.windowskin_name
  132.       if $game_system.message_frame == 0
  133.         # 位置を取得
  134.         tale_pos = get_tale_pos
  135.         @tail = Sprite.new
  136.         case $game_system.message_position
  137.         when 0  # 上
  138.           @tail.bitmap = RPG::Cache.windowskin(skin + "-top")
  139.           @tail.x = tale_pos[0]
  140.           @tail.y = tale_pos[1]
  141.           @tail.z = self.z + 1
  142.         when 1  # 中
  143.           @tail.dispose
  144.           @tail = nil
  145.         when 2  # 下
  146.           @tail.bitmap = RPG::Cache.windowskin(skin + "-under")
  147.           @tail.x = tale_pos[0]
  148.           @tail.y = tale_pos[1]
  149.           @tail.z = self.z + 1
  150.         end
  151.         # エクストラスプライトに登録
  152.         @extra_sprites = [] if @extra_sprites.nil?
  153.         @extra_sprites.push(@tail) if @tail != nil
  154.       end
  155.     end
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   # ○ テールの位置を計算
  159.   #--------------------------------------------------------------------------
  160.   def get_tale_pos
  161.     character = get_character($mes_id)
  162.     x = [[character.screen_x - 16, self.x].max, self.x + self.width - 32].min
  163.     case $game_system.message_position
  164.     when 0
  165.       y = self.y + self.height - 16
  166.     else
  167.       y = self.y - 16
  168.     end
  169.     return [x, y]
  170.   end
  171.   #--------------------------------------------------------------------------
  172.   # ○ キャラクターの取得
  173.   #     parameter : パラメータ
  174.   #--------------------------------------------------------------------------
  175.   def get_character(parameter)
  176.     # パラメータで分岐
  177.     case parameter
  178.     when 0  # プレイヤー
  179.       return $game_player
  180.     else  # 特定のイベント
  181.       events = $game_map.events
  182.       return events == nil ? nil : events[parameter]
  183.     end
  184.   end
  185.   #--------------------------------------------------------------------------
  186.   # ○ ふきだしを破棄
  187.   #--------------------------------------------------------------------------
  188.   def del_tail
  189.     if @tail != nil
  190.       @tail.dispose
  191.       @tail = nil
  192.     end
  193.   end
  194.   #--------------------------------------------------------------------------
  195.   # ○ スキンの設定
  196.   #--------------------------------------------------------------------------
  197.   def set_fuki_skin
  198.     # ウインドウスキンを変更
  199.     if FUKI_SKIN_NAME != "" and FUKI_SKIN_NAME != $game_system.windowskin_name
  200.       @def_skin_name = $game_system.windowskin_name
  201.       $game_system.windowskin_name = FUKI_SKIN_NAME
  202.       self.windowskin = RPG::Cache.windowskin($game_system.windowskin_name)
  203.     end
  204.     # 不透明度を変更
  205.     if self.back_opacity != FUKI_OPACITY
  206.       @def_back_opacity = self.back_opacity
  207.       self.back_opacity = FUKI_OPACITY
  208.     end
  209.   end
  210.   #--------------------------------------------------------------------------
  211.   # ○ スキンを戻す
  212.   #--------------------------------------------------------------------------
  213.   def reset_fuki_skin
  214.     # ウインドウスキンを戻す
  215.     if @def_skin_name != nil
  216.       $game_system.windowskin_name = @def_skin_name
  217.       self.windowskin = RPG::Cache.windowskin($game_system.windowskin_name)
  218.       @def_skin_name = nil
  219.     end
  220.     # 不透明度を戻す
  221.     if @def_back_opacity != nil
  222.       self.back_opacity = @def_back_opacity
  223.       @def_back_opacity = nil
  224.     end
  225.   end
  226. end
复制代码
http://icv.cc声动音缘配音社
回复 支持 反对

使用道具 举报

845

主题

1万

帖子

214748万

积分

版主

脑残中……

Rank: 7Rank: 7Rank: 7

积分
2147483647

声命组金赏

 楼主| 发表于 2006-10-17 10:36:02 | 显示全部楼层

类似于风林系列的地图[走过的会被标亮]

  1. #==============================================================================
  2. # ■ オートマッピング
  3. #------------------------------------------------------------------------------
  4. # ver 1.00(05/04/27) by 箱入小屋 http://aea.to/hako/
  5. #==============================================================================
  6. =begin
  7. ■ 主に使用するメソッド
  8. automaps[id]       : id番のオートマップを参照。
  9. visible            : 真のとき表示。
  10. scope              : 描画範囲。
  11. complete           : すべて通行した状態にする。
  12. delete             : 通行記録を消す。
  13. move(x,y[,center]) : (x,y)に移動。centerが真のとき原点中心。
  14. =end
  15. class Game_AutoMap
  16.   #--------------------------------------------------------------------------
  17.   # ● 定数
  18.   #--------------------------------------------------------------------------
  19.   # オートマップの作成を許可するマップIDの配列
  20.   AUTOMAPS_ID = [1, 2, 3, 4, 5]
  21.   # 1タイルあたりの一辺の長さ(pixel単位)
  22.   TILE_SIZE = 5
  23.   # 通行済みと判断される範囲の大きさ(タイル単位)
  24.   SCOPE = 0
  25. end
  26. class Sprite_AutoMap < Sprite
  27.   #--------------------------------------------------------------------------
  28.   # ● 定数
  29.   #--------------------------------------------------------------------------
  30.   # ※不透明度(アルファ値)を0にすると無効になります。
  31.   #-----------------------------------------------
  32.   # 通行済みエリアの色(Red, Green, Blue[, Alpha])
  33.   COLOR_FLOOR = Color.new(100, 100, 255, 120)
  34.   # 未通行/通行不可のエリアの色
  35.   COLOR_WALL = Color.new(0, 0, 50, 100)
  36.   # プレイヤーシンボルの色
  37.   COLOR_PLAYER = Color.new(255, 255, 0, 255)
  38.   #-----------------------------------------------
  39.   # 通行済みエリアに貼り付けるピクチャファイル, 不透明度
  40.   PASSED_FILE = ["filename", 0]
  41.   # 未通行/通行不可エリアに貼り付けるピクチャファイル, 不透明度
  42.   IMPASSABLE_FILE = ["filename", 0]
  43.   # プレイヤーシンボルとして表示するピクチャファイル, 不透明度
  44.   PLAYER_FILE = ["filename", 0]
  45. end
  46. #==============================================================================
  47. # ■ Interpreter
  48. #==============================================================================
  49. class Interpreter
  50.   #--------------------------------------------------------------------------
  51.   # ● オートマップのデータを取得
  52.   #--------------------------------------------------------------------------
  53.   def automaps
  54.     $game_screen.automaps
  55.   end
  56. end
  57. #==============================================================================
  58. # ■ Game_Screen
  59. #==============================================================================
  60. class Game_Screen
  61.   attr_accessor :automaps   # Game_AutoMapオブジェクトを格納するHash
  62.   alias automapping_100_initialize initialize
  63.   def initialize
  64.     @automaps = {}
  65.     automapping_100_initialize
  66.   end
  67. end
  68. #==============================================================================
  69. # ■ Game_AutoMap
  70. #==============================================================================
  71. class Game_AutoMap
  72.   attr_accessor :player_pos   # プレイヤー座標
  73.   attr_accessor :showing      # オートマップ表示フラグ
  74.   attr_accessor :scope        # 描画範囲(プレイヤーからの距離)
  75.   attr_accessor :recording    # オートマップ記録開始フラグ
  76.   attr_reader :calling        # 外部オートマップ呼び出しフラグ
  77.   attr_reader :drawn_floor    # オートマップの描画情報
  78.   attr_reader :x              # 表示位置x
  79.   attr_reader :y              # 表示位置y
  80.   attr_reader :tile_size    # タイルの大きさ
  81.   attr_reader :width          # マップの幅
  82.   attr_reader :height         # マップの高さ
  83.   attr_reader :passable       # 通行可能座標
  84.   attr_reader :id             # マップのID
  85.   attr_reader :name           # マップの名前
  86.   attr_reader :permission     # オートマップ作成許可フラグ
  87.   #--------------------------------------------------------------------------
  88.   # ● オブジェクト初期化(新しいマップに移動したとき実行)
  89.   #--------------------------------------------------------------------------
  90.   def initialize
  91.     @permission = AUTOMAPS_ID.include?($game_map.map_id)
  92.     return if not @permission
  93.     @recording = false
  94.     @showing = false
  95.     @calling = false
  96.     @player_pos  = [-1, -1]
  97.     @drawn_floor = Table.new($game_map.width, $game_map.height)
  98.     @x = 0
  99.     @y = 0
  100.     @scope = SCOPE
  101.     @tile_size = TILE_SIZE
  102.     @width = $game_map.width
  103.     @height = $game_map.height
  104.     @passable = Table.new(@width, @height)
  105.     for x in 0..@width
  106.       for y in 0..@height
  107.         if $game_map.passable?(x, y, 0)
  108.           @passable[x, y] = 1 # 通行可能であれば 1
  109.         end
  110.       end
  111.     end
  112.     @id = $game_map.map_id
  113.     mapinfo = load_data("Data/MapInfos.rxdata") # RPG::MapInfo(Hash, key:id)
  114.     @name = mapinfo[$game_map.map_id].name.dup
  115.   end
  116.   #--------------------------------------------------------------------------
  117.   # ● オートマップの記録開始
  118.   #--------------------------------------------------------------------------
  119.   def setup
  120.     @calling = false
  121.     @player_pos  = [-1, -1]
  122.     @recording = true
  123.     return true
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # ● オートマップの表示/非表示
  127.   #--------------------------------------------------------------------------
  128.   def visible
  129.     return @showing
  130.   end
  131.   def visible=(visible)
  132.     @calling = (@id != $game_map.map_id)
  133.     @recording = true
  134.     @player_pos = [-1, -1]
  135.     @showing = visible
  136.   end
  137.   #--------------------------------------------------------------------------
  138.   # ● オートマップの完成
  139.   #--------------------------------------------------------------------------
  140.   def complete
  141.     for x in 0..@width
  142.       for y in 0..@height
  143.         @drawn_floor[x, y] = 1 if @passable[x, y] == 1
  144.       end
  145.     end
  146.     return true
  147.   end
  148.   #--------------------------------------------------------------------------
  149.   # ● オートマップの消去
  150.   #--------------------------------------------------------------------------
  151.   def delete
  152.     for x in 0..@width
  153.       for y in 0..@height
  154.         @drawn_floor[x, y] = 0
  155.       end
  156.     end
  157.     @showing = false
  158.     @player_pos = [-1, -1]
  159.     @calling = false
  160.     return true
  161.   end
  162.   #--------------------------------------------------------------------------
  163.   # ● オートマップの移動
  164.   #--------------------------------------------------------------------------
  165.   def move(x, y, center = false)
  166.     if center
  167.       @x = (640 - @width  * @tile_size) / 2
  168.       @y = (480 - @height * @tile_size) / 2
  169.     else
  170.       @x = x
  171.       @y = y
  172.     end
  173.     return true
  174.   end
  175. end
  176. #==============================================================================
  177. # ■ Spriteset_Map
  178. #==============================================================================
  179. class Spriteset_Map
  180.   alias automapping_100_initialize initialize
  181.   def initialize
  182.     amaps = $game_screen.automaps
  183.     # 現在のマップのオートマップが存在しない
  184.     if not amaps.include?($game_map.map_id)
  185.       # マップIDをキーとして、Game_AutoMapオブジェクトを生成
  186.       amaps[$game_map.map_id] = Game_AutoMap.new
  187.       # オートマップの作成が許可されていない場合
  188.       if not amaps[$game_map.map_id].permission
  189.         amaps.delete($game_map.map_id)
  190.       end
  191.     end
  192.     if amaps.include?($game_map.map_id)
  193.       # 0番に現在のマップを関連付ける
  194.       amaps.delete(0)
  195.       amaps[0] = amaps[$game_map.map_id]
  196.       # プレイヤー位置の記録を開始
  197.       amaps[$game_map.map_id].setup
  198.     end
  199.     @viewport_automap = Viewport.new(0, 0, 640, 480)
  200.     @viewport_automap.z = 198 # オートマップのZ座標
  201.     @automap_sprites = []
  202.     # これまでに作成されたすべてのオートマップのスプライト生成
  203.     for map_id in amaps.keys
  204.       next if map_id == 0
  205.       @automap_sprites << Sprite_AutoMap.new(@viewport_automap, amaps[map_id])
  206.     end
  207.     automapping_100_initialize
  208.   end
  209.   alias automapping_100_dispose dispose
  210.   def dispose
  211.     for sprite in @automap_sprites
  212.       sprite.dispose
  213.     end
  214.     automapping_100_dispose
  215.     @viewport_automap.dispose
  216.   end
  217.   alias automapping_100_update update
  218.   def update
  219.     for sprite in @automap_sprites
  220.       sprite.update
  221.     end
  222.     automapping_100_update
  223.     @viewport_automap.update
  224.   end
  225. end
  226. #==============================================================================
  227. # ■ Sprite_AutoMap
  228. #==============================================================================
  229. class Sprite_AutoMap < Sprite
  230.   #--------------------------------------------------------------------------
  231.   # ● オブジェクト初期化
  232.   #   viewport :ビューポート,  automap :Game_AutoMap
  233.   #--------------------------------------------------------------------------
  234.   def initialize(viewport, automap)
  235.     super(viewport)
  236.     @automap = automap
  237.     w = @automap.width * @automap.tile_size
  238.     h = @automap.height * @automap.tile_size
  239.     self.bitmap = Bitmap.new(w, h)
  240.     # 転送用の矩形
  241.     @rect = Rect.new(0, 0, 0, 0)
  242.     # オートマップの画像
  243.     if PASSED_FILE[1] > 0
  244.       @floor_bitmap = RPG::Cache.picture(PASSED_FILE[0])
  245.     end
  246.     if IMPASSABLE_FILE[1] > 0
  247.       @wall_bitmap = RPG::Cache.picture(IMPASSABLE_FILE[0])
  248.     end
  249.     # プレイヤーシンボル描画
  250.     @player_symbol = Sprite.new(viewport)
  251.     if PLAYER_FILE[1] > 0
  252.       @player_symbol.bitmap = RPG::Cache.picture(PLAYER_FILE[0])
  253.       @player_symbol.ox=(@player_symbol.bitmap.width - @automap.tile_size)/2
  254.       @player_symbol.oy = @player_symbol.bitmap.height / 2
  255.       @player_symbol.visible = false
  256.     else
  257.       @player_symbol.bitmap = Bitmap.new(w, h)
  258.     end
  259.     update
  260.   end
  261.   #--------------------------------------------------------------------------
  262.   # ● フレーム更新
  263.   #--------------------------------------------------------------------------
  264.   def update
  265.     if not @automap.recording
  266.       return
  267.     end
  268.     # プレイヤーの位置が同じ(移動していない)場合
  269.     if @automap.player_pos == [$game_player.x, $game_player.y]
  270.       return
  271.     end
  272.     self.x = @player_symbol.x = @automap.x
  273.     self.y = @player_symbol.y = @automap.y
  274.     self.visible = @player_symbol.visible = @automap.showing
  275.     @automap.player_pos = [$game_player.x, $game_player.y]
  276.     len = @automap.tile_size
  277.     # 別マップからの呼び出しの場合
  278.     if @automap.calling
  279.       # 通行済みエリア描画
  280.       if PASSED_FILE[1] > 0
  281.         draw_passable_picture(len)
  282.       elsif COLOR_FLOOR.alpha > 0
  283.         draw_passable(len)
  284.       end
  285.       # 未通行/通行不可エリア描画
  286.       if IMPASSABLE_FILE[1] > 0
  287.         draw_impassable_picture(len)
  288.       elsif COLOR_WALL.alpha > 0
  289.         draw_impassable(len)
  290.       end
  291.       return
  292.     end
  293.     # 描画範囲取得
  294.     x_min = [0, $game_player.x - @automap.scope].max
  295.     x_max = [@automap.width, $game_player.x + @automap.scope].min
  296.     y_min = [0, $game_player.y - @automap.scope].max
  297.     y_max = [@automap.height, $game_player.y + @automap.scope].min
  298.     for x in x_min..x_max
  299.       for y in y_min..y_max
  300.         # 未通行 and 通行可能
  301.         if @automap.drawn_floor[x, y] == 0 and @automap.passable[x, y] == 1
  302.           # その座標を保存
  303.           @automap.drawn_floor[x, y] = 1
  304.         end
  305.       end
  306.     end
  307.     if @automap.showing
  308.       self.bitmap.clear
  309.       # 通行済みエリア描画
  310.       if PASSED_FILE[1] > 0
  311.         draw_passable_picture(len)
  312.       elsif COLOR_FLOOR.alpha > 0
  313.         draw_passable(len)
  314.       end
  315.       # 未通行/通行不可エリア描画
  316.       if IMPASSABLE_FILE[1] > 0
  317.         draw_impassable_picture(len)
  318.       elsif COLOR_WALL.alpha > 0
  319.         draw_impassable(len)
  320.       end
  321.       # プレイヤーシンボル更新
  322.       if PLAYER_FILE[1] > 0 or COLOR_PLAYER.alpha > 0
  323.         player_symbol_update
  324.       end
  325.     end
  326.   end
  327.   #--------------------------------------------------------------------------
  328.   # ● 通行エリア描画
  329.   #--------------------------------------------------------------------------
  330.   def draw_passable(len)
  331.     for x in 0..@automap.width
  332.       for y in 0..@automap.height
  333.         # 保存された座標が 1 の場合
  334.         if @automap.drawn_floor[x, y] == 1
  335.           # タイル描画
  336.           self.bitmap.fill_rect(x*len, y*len, len, len, COLOR_FLOOR)
  337.         end
  338.       end
  339.     end
  340.   end
  341.   #--------------------------------------------------------------------------
  342.   # ● 通行エリア(ピクチャ)描画
  343.   #--------------------------------------------------------------------------
  344.   def draw_passable_picture(len)
  345.     for x in 0..@automap.width
  346.       for y in 0..@automap.height
  347.         # 保存された座標が 1 の場合
  348.         if @automap.drawn_floor[x, y] == 1
  349.           @rect.set((x*len)%@floor_bitmap.width, (y*len)%@floor_bitmap.height,
  350.                     len, len)
  351.           # タイル描画
  352.           self.bitmap.blt(x*len, y*len,
  353.             @floor_bitmap, @rect, PASSED_FILE[1])
  354.         end
  355.       end
  356.     end
  357.   end
  358.   #--------------------------------------------------------------------------
  359.   # ● 未通行/通行不可エリア描画
  360.   #--------------------------------------------------------------------------
  361.   def draw_impassable(len)
  362.     for x in 0..@automap.width
  363.       for y in 0..@automap.height
  364.         # 保存された座標が 0 の場合
  365.         if @automap.drawn_floor[x, y] == 0
  366.           # タイル描画
  367.           self.bitmap.fill_rect(x*len, y*len, len, len, COLOR_WALL)
  368.         end
  369.       end
  370.     end
  371.   end
  372.   #--------------------------------------------------------------------------
  373.   # ● 未通行/通行不可エリア(ピクチャ)描画
  374.   #--------------------------------------------------------------------------
  375.   def draw_impassable_picture(len)
  376.     for x in 0..@automap.width
  377.       for y in 0..@automap.height
  378.         # 保存された座標が 0 の場合
  379.         if @automap.drawn_floor[x, y] == 0
  380.           @rect.set((x*len)%@wall_bitmap.width, (y*len)%@wall_bitmap.height,
  381.                     len, len)
  382.           # タイル描画
  383.           self.bitmap.blt(x*len, y*len, @wall_bitmap, @rect, IMPASSABLE_FILE[1])
  384.         end
  385.       end
  386.     end
  387.   end
  388.   #--------------------------------------------------------------------------
  389.   # ● プレイヤーシンボル更新
  390.   #--------------------------------------------------------------------------
  391.   def player_symbol_update
  392.     len = @automap.tile_size
  393.     x = $game_player.x * len
  394.     y = $game_player.y * len
  395.     # ピクチャ
  396.     if PLAYER_FILE[1] > 0
  397.       @player_symbol.x += x
  398.       @player_symbol.y += y
  399.       @player_symbol.opacity = PLAYER_FILE[1]
  400.     else
  401.       @player_symbol.bitmap.clear
  402.       @player_symbol.bitmap.fill_rect(x, y, len, len, COLOR_PLAYER)
  403.     end
  404.   end
  405.   #--------------------------------------------------------------------------
  406.   # ● 解放
  407.   #--------------------------------------------------------------------------
  408.   def dispose
  409.     if self.bitmap != nil
  410.       # 別のマップに移動した場合は非表示にする
  411.       if $scene.is_a?(Scene_Map)
  412.         @automap.showing = false
  413.         @automap.recording = false
  414.       end
  415.       @automap.player_pos = [-1, -1]
  416.       self.bitmap.dispose
  417.       self.bitmap = nil
  418.       @player_symbol.bitmap.dispose
  419.       @player_symbol.bitmap = nil
  420.     end
  421.     super
  422.   end
  423. end
复制代码
http://icv.cc声动音缘配音社
回复 支持 反对

使用道具 举报

845

主题

1万

帖子

214748万

积分

版主

脑残中……

Rank: 7Rank: 7Rank: 7

积分
2147483647

声命组金赏

 楼主| 发表于 2006-10-17 11:04:08 | 显示全部楼层
使用行走图做战斗图

本帖子中包含更多资源

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

x
http://icv.cc声动音缘配音社
回复 支持 反对

使用道具 举报

10

主题

443

帖子

4964

积分

⑥精研

L-Zone人

积分
4964
发表于 2006-10-17 18:31:24 | 显示全部楼层
那个,这些脚本要放哪里,是说那个升级提示的,我蛮喜欢的 [s:4]
不知道写什么,打了这行字
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-28 16:42 , Processed in 0.021525 second(s), 22 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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