设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1156|回复: 0
打印 上一主题 下一主题

[已经过期] class Scene_Battle改class Scene_map是不是战斗处理变地图处理

[复制链接]

Lv4.逐梦者

梦石
0
星屑
6291
在线时间
1103 小时
注册时间
2015-8-15
帖子
658
跳转到指定楼层
1
发表于 2022-11-14 16:00:48 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

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

x
RUBY 代码复制
  1. class Scene_Battle #类场景_战斗
  2.   #--------------------------------------------------------------------------
  3.   # ● メイン処理●主处理
  4.   #--------------------------------------------------------------------------
  5.   alias xrxs65_main main#主处理名称xrxs65
  6.   def main            #开始主处理
  7.     # エクストラスプライトの初期化 初始化附加精灵
  8.     @extra_sprites = [] if @extra_sprites == nil
  9.     # CP の初期化
  10.     cp_preset_party
  11.     # CP メーターの作成  创建CP仪表
  12.     @cp_meters = CP_Meters.new
  13.     # CP メーターをエクストラスプライトへ登録 将CP仪表注册到附加精灵
  14.     @extra_sprites.push(@cp_meters)
  15.     # 呼び戻す 重新调用
  16.     xrxs65_main
  17.     # メーターの解放 释放仪表
  18.     @cp_meters.dispose
  19.   end
  20.   #--------------------------------------------------------------------------
  21.   # ● プレバトルフェーズ開始
  22.   #--------------------------------------------------------------------------
  23.   alias xrxs65_start_phase1 start_phase1
  24.   def start_phase1
  25.     # 呼び戻す
  26.     xrxs65_start_phase1
  27.     # CP の初期化
  28.     cp_preset_troop
  29.     # CP メーターの更新
  30.     @cp_meters.refresh
  31.     # インデックスを計算
  32.     @cp_escape_actor_command_index = @actor_command_window.height/32 - 1
  33.     # アクターコマンドウィンドウに追加
  34.     @actor_command_window.add_command("逃げる")
  35.     if !$game_temp.battle_can_escape
  36.       @actor_command_window.disable_item(@cp_escape_actor_command_index)
  37.     end
  38.   end
  39.   #--------------------------------------------------------------------------
  40.   # ● パーティコマンドフェーズ開始
  41.   #--------------------------------------------------------------------------
  42.   alias xrxs65_start_phase2 start_phase2
  43.   def start_phase2
  44.     # 呼び戻す
  45.     xrxs65_start_phase2
  46.     # パーティコマンドウィンドウを無効化
  47.     @party_command_window.active  = false
  48.     @party_command_window.visible = false
  49.     # 強制的にフェイズ 2 を保持
  50.     @phase = 2
  51.     # ただし、既に行動可能者が存在する場合は 3 へ
  52.     start_phase3 if anybody_movable?
  53.   end
  54.   #--------------------------------------------------------------------------
  55.   # ○ CP制での ターンのカウント
  56.   #--------------------------------------------------------------------------
  57.   def cp_turn_count
  58.     $game_temp.battle_turn += 1
  59.     # バトルイベントの全ページを検索
  60.     for index in 0...$data_troops[@troop_id].pages.size
  61.       # このページのスパンが [ターン] の場合
  62.       if $data_troops[@troop_id].pages[index].span == 1
  63.         # 実行済みフラグをクリア
  64.         $game_temp.battle_event_flags[index] = false
  65.       end
  66.     end
  67.   end
  68.   #--------------------------------------------------------------------------
  69.   # ● フレーム更新 (パーティコマンドフェーズ)
  70.   #--------------------------------------------------------------------------
  71.   alias xrxs65_update_phase2 update_phase2
  72.   def update_phase2
  73.     # パーティコマンドウィンドウのインデックスを無効化
  74.     @party_command_window.index = -1
  75.     # 呼び戻す
  76.     xrxs65_update_phase2
  77.     # 例外補正
  78.     @turn_count_time = 1 if @turn_count_time == nil
  79.     # ターンのカウント
  80.     if @turn_count_time > 0
  81.       @turn_count_time -= 1
  82.       if @turn_count_time == 0
  83.         cp_turn_count
  84.         @turn_count_time = XRXS65::CPT if XRXS65::TC == nil
  85.       end
  86.     end
  87.     # CP のフレーム更新
  88.     cp_update
  89.     @cp_meters.refresh
  90.     # フル CP のバトラーが存在する場合、ターン開始
  91.     start_phase3 if anybody_movable?
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # ○ フル CP バトラーが存在するか?
  95.   #--------------------------------------------------------------------------
  96.   def anybody_movable?
  97.     for battler in $game_party.actors + $game_troop.enemies
  98.       return true if battler.cp_full?
  99.     end
  100.     return false
  101.   end
  102.   #--------------------------------------------------------------------------
  103.   # ● アクターコマンドウィンドウのセットアップ
  104.   #--------------------------------------------------------------------------
  105.   alias xrxs65_phase3_setup_command_window phase3_setup_command_window
  106.   def phase3_setup_command_window
  107.     # 効果音の再生
  108.     Audio.se_play(XRXS65::COMMAND_UP_SE) rescue nil
  109.     # 呼び戻す
  110.     xrxs65_phase3_setup_command_window
  111.   end
  112.   #--------------------------------------------------------------------------
  113.   # ● フレーム更新 (アクターコマンドフェーズ : 基本コマンド)
  114.   #--------------------------------------------------------------------------
  115.   alias xrxs_bsp1_update_phase3_basic_command update_phase3_basic_command
  116.   def update_phase3_basic_command
  117.     # C ボタンが押された場合
  118.     if Input.trigger?(Input::C)
  119.       # アクターコマンドウィンドウのカーソル位置で分岐
  120.       case @actor_command_window.index
  121.       when @cp_escape_actor_command_index # 逃げる
  122.         if $game_temp.battle_can_escape
  123.           # 決定 SE を演奏
  124.           $game_system.se_play($data_system.decision_se)
  125.           # アクションを設定
  126.           @active_battler.current_action.kind = 0
  127.           @active_battler.current_action.basic = 4
  128.           # 次のアクターのコマンド入力へ
  129.           phase3_next_actor
  130.         else
  131.           # ブザー SE を演奏
  132.           $game_system.se_play($data_system.buzzer_se)
  133.         end
  134.         return
  135.       end
  136.     end
  137.     # 呼び戻す
  138.     xrxs_bsp1_update_phase3_basic_command
  139.   end
  140.   #--------------------------------------------------------------------------
  141.   # ● メインフェーズ開始
  142.   #--------------------------------------------------------------------------
  143.   alias xrxs65_start_phase4 start_phase4
  144.   def start_phase4
  145.     # ターン数を引くことによって擬似的にカウントに変化を起こさせない
  146.     $game_temp.battle_turn -= 1
  147.     # フラグを退避
  148.     save_flags = $game_temp.battle_event_flags.dup
  149.     # 呼び戻す
  150.     xrxs65_start_phase4
  151.     # フラグを復旧
  152.     $game_temp.battle_event_flags = save_flags
  153.   end
  154.   #--------------------------------------------------------------------------
  155.   # ● 行動順序作成
  156.   #--------------------------------------------------------------------------
  157.   alias xrxs65_make_action_orders make_action_orders
  158.   def make_action_orders
  159.     # 呼び戻す
  160.     xrxs65_make_action_orders
  161.     # CPが不足している場合は @action_battlers から除外する
  162.     for battler in @action_battlers.dup
  163.       @action_battlers.delete(battler) unless battler.cp_full?
  164.     end
  165.   end
  166.   #--------------------------------------------------------------------------
  167.   # ● フレーム更新 (メインフェーズ ステップ 2 : アクション開始)
  168.   #--------------------------------------------------------------------------
  169.   alias xrxs65_update_phase4_step2 update_phase4_step2
  170.   def update_phase4_step2
  171.     # ガードの解除
  172.     @active_battler.guarding = false
  173.     # CPの消費
  174.     @active_battler.cp = 0
  175.     # CP メーターの更新
  176.     @cp_meters.refresh
  177.     # 呼び戻す
  178.     xrxs65_update_phase4_step2
  179.     # 例外補正
  180.     return if @active_battler == nil
  181.     # ターンコントローラ
  182.     if @active_battler.is_a?(Game_Enemy) and @active_battler.index == XRXS65::TC
  183.       cp_turn_count
  184.     end
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # ● 基本アクション 結果作成
  188.   #--------------------------------------------------------------------------
  189.   alias xrxs65_make_basic_action_result make_basic_action_result
  190.   def make_basic_action_result
  191.     # 呼び戻す
  192.     xrxs65_make_basic_action_result
  193.     # 防御の場合
  194.     if @active_battler.current_action.basic == 1
  195.       @active_battler.guarding = true
  196.       return
  197.     end
  198.     # パーティの逃亡の場合
  199.     if @active_battler.current_action.basic == 4
  200.       # 逃走可能ではない場合
  201.       if $game_temp.battle_can_escape == false
  202.         # ブザー SE を演奏
  203.         $game_system.se_play($data_system.buzzer_se)
  204.         return
  205.       end
  206.       # パーティ全員の CP をクリア
  207.       for actor in $game_party.actors
  208.         actor.cp = 0
  209.       end
  210.       # CP メーターの更新
  211.       @cp_meters.refresh
  212.       # 逃走処理
  213.       update_phase2_escape
  214.       return
  215.     end
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # ● フレーム更新 (メインフェーズ ステップ 5 : ダメージ表示)
  219.   #--------------------------------------------------------------------------
  220.   alias xrxs65_update_phase4_step5 update_phase4_step5
  221.   def update_phase4_step5
  222.     # 呼び戻す
  223.     xrxs65_update_phase4_step5
  224.     # CP メーターの更新
  225.     @cp_meters.refresh
  226.   end
  227. end
  228. #==============================================================================
  229. # --- CP メーターをまとめて管理するクラス、表示関係はすべてココ ---
  230. #==============================================================================
  231. class CP_Meters
  232.   #--------------------------------------------------------------------------
  233.   # ○ オブジェクト初期化
  234.   #--------------------------------------------------------------------------
  235.   def initialize
  236.     # メーター群の生成
  237.     @meters = []
  238.     for i in 0...$game_party.actors.size
  239.       make_meter(i)
  240.     end
  241.     refresh
  242.   end
  243.   #--------------------------------------------------------------------------
  244.   # ○ リフレッシュ
  245.   #--------------------------------------------------------------------------
  246.   def refresh
  247.     # 戦闘メンバー数の変更を判別
  248.     for i in @meters.size...$game_party.actors.size
  249.       make_meter(i)
  250.     end
  251.     for i in $game_party.actors.size...@meters.size
  252.       @meters[i].dispose
  253.       @meters[i] = nil
  254.     end
  255.     @meters.compact!
  256.     # 表示更新
  257.     for i in 0...$game_party.actors.size
  258.       actor = $game_party.actors[i]
  259.       @meters[i].line   = actor.cp_linetype
  260.       @meters[i].amount = actor.cp_lineamount
  261.     end
  262.   end
  263.   #--------------------------------------------------------------------------
  264.   # ○ メーターひとつの生成
  265.   #--------------------------------------------------------------------------
  266.   def make_meter(i)
  267.     # スキンの取得
  268.     skin = RPG::Cache.windowskin(XRXS65::SKIN)
  269.     #
  270.     space = 640 / XRXS65::MAX
  271.     case XRXS65::ALIGN
  272.     when 0
  273.       actor_x = i * space + 4
  274.     when 1
  275.       actor_x = (space * ((XRXS65::MAX - $game_party.actors.size)/2.0 + i)).floor
  276.     when 2
  277.       actor_x = (i + XRXS65::MAX - $game_party.actors.size) * space + 4
  278.     end
  279.     meter = MeterSprite.new(skin, XRXS65::LINE_HEIGHT)
  280.     meter.x = actor_x + XRXS65::X_OFFSET - skin.width
  281.     meter.y = XRXS65::Y_OFFSET
  282.     @meters[i] = meter
  283.   end
  284.   #--------------------------------------------------------------------------
  285.   # ○ 可視状態
  286.   #--------------------------------------------------------------------------
  287.   def visible=(b)
  288.     @meters.each{|sprite| sprite.visible = b }
  289.   end
  290.   #--------------------------------------------------------------------------
  291.   # ○ 解放
  292.   #--------------------------------------------------------------------------
  293.   def dispose
  294.     @meters.each{|sprite| sprite.dispose }
  295.   end
  296. end
  297. #==============================================================================
  298. # --- XRXS. レクタンギュラーメーター表示・極 ---
  299. #==============================================================================
  300. class MeterSprite < Sprite
  301.   #--------------------------------------------------------------------------
  302.   # ○ オブジェクト初期化
  303.   #--------------------------------------------------------------------------
  304.   def initialize(skin, line_height)
  305.     @skin   = skin
  306.     @width  = @skin.width
  307.     @height = line_height
  308.     @line   = 1
  309.     @amount = 0
  310.     @base_sprite = Sprite.new
  311.     @base_sprite.bitmap = @skin
  312.     @base_sprite.src_rect.set(0, 0, @width, @height)
  313.     @base_sprite.z = 601
  314.     super()
  315.     self.z = @base_sprite.z + 1
  316.     self.bitmap = @skin
  317.     self.line = 1
  318.   end
  319.   #--------------------------------------------------------------------------
  320.   # ○ 値の設定
  321.   #--------------------------------------------------------------------------
  322.   def line=(n)
  323.     @line = n
  324.     refresh
  325.   end
  326.   def amount=(n)
  327.     @amount = n
  328.     refresh
  329.   end
  330.   def refresh
  331.     self.src_rect.set(0, @line * @height, @width * @amount / 100, @height)
  332.   end
  333.   #--------------------------------------------------------------------------
  334.   # ○ 座標の設定
  335.   #--------------------------------------------------------------------------
  336.   def x=(n)
  337.     super
  338.     @base_sprite.x = n
  339.   end
  340.   def y=(n)
  341.     super
  342.     @base_sprite.y = n
  343.   end
  344.   #--------------------------------------------------------------------------
  345.   # ○ 解放
  346.   #--------------------------------------------------------------------------
  347.   def dispose
  348.     @base_sprite.dispose
  349.     super
  350.   end
  351. end


class Scene_Battle改成class Scene_map是不是战斗处理变地图处理
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-28 22:33

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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