Project1

标题: 请教各位帮忙改一个脚本 [打印本页]

作者: feizhaodan    时间: 2011-6-26 13:43
标题: 请教各位帮忙改一个脚本
本帖最后由 feizhaodan 于 2011-6-26 14:04 编辑

Apart:
  1. # ▽△▽ XRXSv9. BaST【バトルシステムテンプレート】VX. ▽△▽
  2. #
  3. # publish 2010/ 3/ 5
  4. # update  - 11/ 2/16b
  5. #
  6. #==============================================================================
  7. # カスタマイズポイント - BaST本体
  8. #==============================================================================
  9. module XRXSV9
  10.   #
  11.   # バトルコマンド設定
  12.   #    0 : 攻撃
  13.   #    1 : スキル
  14.   #    2 : ぼうぎょ
  15.   #    3 : アイテム
  16.   #    4 : 装備
  17.   #    5 : ステータス
  18.   #    6 : クイックコマンド
  19.   #    7 : パーティスキル
  20.   #    8 : にげる
  21.   #    9 : ターン終了
  22.   #   10 : 個人マテリアルバッグ
  23.   #   11 : パーティマテリアルバッグ
  24.   #   12 : アイテムトラッシュ確認
  25.   #
  26.   CommandIDs = [0, 1, 2, 3, 13 ,8]
  27.   #
  28.   # バトルコマンドの表示サイズ (VX標準 : 4)
  29.   #
  30.   CommandRow = 4
  31.   #
  32.   # [用語]
  33.   #
  34.   S_QUICK   = "マジック "
  35.   S_PSKILL  = "アタック "
  36.   S_TURNEND = "ターンエンド"
  37.   S_BAG     = "マイバッグ "
  38.   S_PBAG    = "アイテム  "
  39.   S_TRASH   = "トラッシュ "
  40.   #
  41.   # [クイックコマンド機能]
  42.   #  ※メモ quick があるアイテム・スキルはクイックコマンドとして扱います。
  43.   #
  44.   # クイックコマンドを元のウインドウに表示しないようにする?
  45.   #
  46.   QuickListHiding = true
  47.   #
  48.   # 仲間のクイックコマンドを選択可能にする?
  49.   #
  50.   QuickFriendSupport = true
  51.   #
  52.   # クイックコマンド時の画面色調とBGM音量
  53.   #
  54.   QuickTone   = Tone.new(-32,-40,0,96)
  55.   QuickVolume = 60
  56.   #
  57.   #
  58.   # [「行動側アニメーション」機能 ]
  59.   #
  60.   # 「魔法」と判定されるスキルに自動設定される行動側アニメーションID[一括設定]
  61.   #    ( 0 を指定するとアニメは再生されません)
  62.   #  ( メモ preanime[n] でn番を指定しているスキルはその指定が優先されます )
  63.   #
  64.   MagicPreanimationID = 0
  65.   #
  66.   # 行動側アニメーション再生時のウェイト時間指定[単位:F]
  67.   #    ( 0 を指定するとアニメ終了時まで待機します)
  68.   #
  69.   PreanimationWaitCount = 0
  70.   #
  71.   # 「勝利前バトルイベント」を有効にする?
  72.   #
  73.   NonJudgeBattleEvent = true
  74.   #
  75.   # 「アクションスパンイベント」を有効にする?
  76.   #     (有効な行動の終了時にバトルイベントスパン[ターン]をクリアします)
  77.   #
  78.   BattleEventActionSpan = false
  79.   #
  80.   # 勝利演出スキップ - スイッチID
  81.   #
  82.   BattleEndSkipSwitchID = 0
  83.   #
  84.   # 勝利BGM/ME+マップBGM復帰処理スキップ - スイッチID
  85.   #
  86.   BattleEndMapBGMMESkipSwitchID = 0
  87.   #
  88.   # コマンドポップSE
  89.   #
  90.   CommandPopSE = RPG::SE.new("", 80, 150)
  91.   #
  92.   # コマンドセットウィンドウを表示する?
  93.   #
  94.   CommandSetVisible = true
  95.   #
  96.   # 戦闘背景ファイル名接頭語(Graphics/Parallaxes)
  97.   #
  98.   BBMap    = "Map"
  99.   BBTrrain = "Terrain"
  100.   #
  101.   # 戦闘テストに使用する戦闘背景(Graphics/Parallaxes)
  102.   #
  103.   BBBTEST = "Map1"
  104.   #
  105.   # パトルステータスの内容更新をまとめて軽量化する?
  106.   #
  107.   BattleStatusRefreshAtEnd = true
  108.   #
  109.   # ターンコントローラー・トループインデックス
  110.   #
  111.   TCTI = 0
  112.   #
  113.   # 用語配列の作成
  114.   #
  115.   def self.command_names
  116.     names = [
  117.       Vocab::attack,
  118.       Vocab::skill,
  119.       Vocab::guard,
  120.       Vocab::item,
  121.       Vocab::equip,
  122.       Vocab::status,
  123.       XRXSV9::S_QUICK,
  124.       XRXSV9::S_PSKILL,
  125.       Vocab::escape,
  126.       XRXSV9::S_TURNEND,
  127.       XRXSV9::S_BAG,
  128.       XRXSV9::S_PBAG,
  129.       XRXSV9::S_TRASH,
  130.       "队伍编辑"
  131.     ]
  132.     return names
  133.   end
  134. end
  135. #==============================================================================
  136. # カスタマイズポイント - バトルリザルト専用
  137. #==============================================================================
  138. module XRXSV9
  139.   #
  140.   # 勝利BGMの初期設定(Audio/BGM)
  141.   #
  142.   BattleEndBGM = "Win"
  143.   #
  144.   # 人数によるEXPレート[単位:%]
  145.   #
  146.   EXPRates = [120, 100, 80, 67, 50]
  147.   #
  148.   # EXP獲得不可ステートID配列 ([]と空にすると戦闘不能でもEXP獲得します)
  149.   #
  150.   EXPnStates = [1]
  151.   #
  152.   # ドロップアイテム獲得・最大数制限(0だと制限しない)
  153.   #
  154.   DropItemMax = 0
  155. end
  156. #==============================================================================
  157. # 魔法?の判定
  158. #==============================================================================
  159. class Game_BattleAction
  160.   def magic_skill?
  161.     return (self.skill? and self.skill.magic?)
  162.   end
  163. end
  164. class RPG::UsableItem
  165.   def magic?
  166.     return (self.spi_f >= 1 and not self.physical_attack)
  167.   end
  168. end
  169. #==============================================================================
  170. # 各種設定
  171. #==============================================================================
  172. class Game_Temp
  173.   attr_accessor :preemptive
  174.   attr_accessor :surprise
  175.   attr_accessor :turn_shift
  176.   attr_accessor :link_done
  177.   attr_accessor :battle_phase
  178.   attr_accessor :attacking_battler
  179.   attr_accessor :battle_timing_type
  180.   def used_skill_hash
  181.     @used_skill_hash ||= {}
  182.     return @used_skill_hash
  183.   end
  184. end
  185. #==============================================================================
  186. # BGM音量変化
  187. #==============================================================================
  188. module RPG
  189.   class BGM < AudioFile
  190.     @@last_volume = nil
  191.     def self.volume_down
  192.       @@last_volume = @@last.volume
  193.       @@last.volume = XRXSV9::QuickVolume
  194.       @@last.play
  195.     end
  196.     def self.volume_back
  197.       if @@last_volume
  198.         @@last.volume = @@last_volume
  199.         @@last.play
  200.         @@last_volume = nil
  201.       end
  202.     end
  203.   end
  204. end
  205. #==============================================================================
  206. # スキルの行動側アニメーションIDの取得
  207. #==============================================================================
  208. module XRXSV9_SkillPreanimaion
  209.   def preanimation_id
  210.     self.note.gsub(/preanime[([0-9]+?)]/) do
  211.       return $1.to_i if $1.to_i > 0
  212.     end
  213.     return 0
  214.   end
  215. end
  216. class RPG::UsableItem
  217.   include XRXSV9_SkillPreanimaion
  218. end
  219. #==============================================================================
  220. # アクターバトラーグラフィック
  221. #==============================================================================
  222. class Game_Battler
  223.   def in_floor?
  224.     return true
  225.   end
  226. end
  227. class Game_Actor < Game_Battler
  228.   def battler_name
  229.     return ""
  230.   end
  231.   def battler_hue
  232.     return 0
  233.   end
  234.   def in_floor?
  235.     return false
  236.   end
  237.   def use_sprite?
  238.     return true
  239.   end
  240.   def screen_x
  241.     return self.battlestatus_x + self.battlestatus_offset
  242.   end
  243.   def screen_y
  244.     return self.battlestatus_y
  245.   end
  246.   def screen_z
  247.     return 101
  248.   end
  249. end
  250. #==============================================================================
  251. # バトルスプライトセット/バトルトーン2
  252. #==============================================================================
  253. class Spriteset_Battle
  254.   def create_actors
  255.     @actor_sprites = []
  256.   end
  257.   alias xrxsv9_update_actors update_actors
  258.   def update_actors
  259.     for i in @actor_sprites.size...[$game_party.members.size, 4].max
  260.       @actor_sprites[i] = Sprite_ActorBattler.new(@viewport1)
  261.     end
  262.     for i in 4...@actor_sprites.size
  263.       @actor_sprites[i].battler = $game_party.members[i]
  264.     end
  265.     xrxsv9_update_actors
  266.   end
  267.   alias xrxsv9_update_viewports update_viewports
  268.   def update_viewports
  269.     $game_temp.battle_tone2_update
  270.     @viewport2.tone = $game_temp.battle_tone2
  271.     xrxsv9_update_viewports
  272.   end
  273. end
  274. class Game_Temp
  275.   def battle_tone2
  276.     @battle_tone2 ||= Tone.new(0,0,0)
  277.     return @battle_tone2
  278.   end
  279.   def battle_tone2_update
  280.     @battle_tone2_duration ||= 0
  281.     if @battle_tone2_duration >= 1
  282.       d = @battle_tone2_duration
  283.       @battle_tone2.red   = (@battle_tone2.red   * (d - 1) + @battle_tone2_target.red  ) / d
  284.       @battle_tone2.green = (@battle_tone2.green * (d - 1) + @battle_tone2_target.green) / d
  285.       @battle_tone2.blue  = (@battle_tone2.blue  * (d - 1) + @battle_tone2_target.blue ) / d
  286.       @battle_tone2.gray  = (@battle_tone2.gray  * (d - 1) + @battle_tone2_target.gray ) / d
  287.       @battle_tone2_duration -= 1
  288.     end
  289.   end
  290.   def start_battle_tone2_change(tone, duration)
  291.     @battle_tone2_target = tone.clone
  292.     @battle_tone2_duration = duration
  293.     if @battle_tone2_duration == 0
  294.       @battle_tone2 = @battle_tone2_target.clone
  295.     end
  296.   end
  297.   def bluestop_battle_tone2
  298.     start_battle_tone2_change(XRXSV9::QuickTone, 6)
  299.   end
  300.   def clear_battle_tone2
  301.     start_battle_tone2_change(Tone.new(0,0,0), 6)
  302.   end
  303. end
  304. #==============================================================================
  305. # アニメーションホールド/バトルメッセージホールド機能
  306. #==============================================================================
  307. class Sprite_Base < Sprite
  308.   def animation_hold!
  309.     @held_animation_set ||= []
  310.     if self.animation?
  311.       @held_animation_set.push([@animation, @animation_sprites, @animation_duration, @animation_bitmap1, @animation_bitmap2])
  312.       @animation = nil
  313.       @animation_sprites = nil
  314.       @animation_duration = 0
  315.       @animation_bitmap1 = nil
  316.       @animation_bitmap2 = nil
  317.     end
  318.   end
  319.   def animation_unhold!
  320.     @held_animation_set ||= []
  321.     set = @held_animation_set.shift
  322.     if set
  323.       dispose_animation
  324.       @animation          = set[0]
  325.       @animation_sprites  = set[1]
  326.       @animation_duration = set[2]
  327.       @animation_bitmap1  = set[3]
  328.       @animation_bitmap2  = set[4]
  329.     end
  330.   end
  331. end
  332. class Spriteset_Battle
  333.   def animation_hold!
  334.     for sprite in @enemy_sprites + @actor_sprites do sprite.animation_hold! end
  335.   end
  336.   def animation_unhold!
  337.     for sprite in @enemy_sprites + @actor_sprites do sprite.animation_unhold! end
  338.   end
  339. end
  340. class Window_BattleMessage < Window_Message
  341.   def message_hold!
  342.     @held_lines ||= []
  343.     @held_lines.push(@lines)
  344.     @lines = []
  345.     refresh
  346.   end
  347.   def message_unhold!
  348.     @held_lines ||= []
  349.     lines = @held_lines.shift
  350.     if lines
  351.       @lines = lines
  352.       refresh
  353.     end
  354.   end
  355. end
  356. #==============================================================================
  357. # バトルカメラ対応
  358. #==============================================================================
  359. class XRXSV_BattleCam3D
  360.   attr_accessor :lock
  361.   def reverse?
  362.     return false
  363.   end
  364.   def direction_angle
  365.     return 2
  366.   end
  367.   def set_horize(active_battler, targets)
  368.   end
  369.   def watch(active_battler, targets)
  370.   end
  371.   def go_reset
  372.   end
  373. end
  374. class Game_Temp
  375.   def xcam
  376.     @xcam ||= XRXSV_BattleCam3D.new
  377.     return @xcam
  378.   end
  379. end
  380. #==============================================================================
  381. # バトルカメラへの対応
  382. #==============================================================================
  383. class Sprite_Base < Sprite
  384.   def update_battler_xcam
  385.   end
  386. end
  387. module XRXSV9SceneBattleExForCam
  388.   def update_battle_cam
  389.   end
  390.   def xcam_reset
  391.   end
  392.   def xcam_turn_refresh
  393.   end
  394.   def xcam_win
  395.   end
  396.   def xcam_animation_start(targets)
  397.   end
  398.   def xcam_preanimation
  399.   end
  400.   def xcam_animation(targets)
  401.   end
  402. end
  403. class Scene_Battle < Scene_Base
  404.   include XRXSV9SceneBattleExForCam
  405. end
  406. #==============================================================================
  407. # ダメージシェイクへの対応
  408. #==============================================================================
  409. class Sprite_Base
  410.   def update_damageshake
  411.   end
  412. end
  413. #==============================================================================
  414. # 各種対応 : スプライト+バトルジャンプ / バトラーモーション/自動回復
  415. #==============================================================================
  416. class Sprite_ActorBattler < Sprite_Battler
  417.   def update_jumping
  418.   end
  419. end
  420. module XRXSV9_inGameBattler
  421.   def battlermotion_reset
  422.   end
  423.   def do_auto_recovery
  424.   end
  425.   def battlejjump_at_post?
  426.     return true
  427.   end
  428.   def battler_initialize
  429.   end
  430. end
  431. class Game_Battler
  432.   include XRXSV9_inGameBattler
  433. end
  434. class Scene_Base
  435.   def create_extra_windows
  436.   end
  437.   def dispose_extra_windows
  438.   end
  439. end
  440. #==============================================================================
  441. # BaSTバトルシーン各種対応
  442. #==============================================================================
  443. module XRXSV9_inSceneBattle
  444.   def cp_initialize
  445.   end
  446.   def wait_for_xcam
  447.   end
  448.   def open_timing_command(timing_type, targets)
  449.   end
  450.   def battlermotion_action
  451.   end
  452.   def battlermotion_reset
  453.   end
  454.   def battlejump_back
  455.   end
  456.   def battlejump_escape
  457.   end
  458.   def battlejump_for_targets(targets)
  459.   end
  460.   def battlejump_action_end
  461.   end
  462.   def wait_for_jump(battlers = self.members)
  463.   end
  464.   def allclear_power
  465.   end
  466.   def process_additional_effects(target, obj)
  467.   end
  468. end
  469. class Scene_Battle < Scene_Base
  470.   include XRXSV9_inSceneBattle
  471. end
  472. #==============================================================================
  473. # バトルステータス位置
  474. #==============================================================================
  475. class Window_BattleStatus < Window_Selectable
  476.   def initialize
  477.     super(128, 288, 416, 128)
  478.     refresh
  479.     self.active = false
  480.   end
  481.   def refresh_lite
  482.   end
  483. end
  484. class Game_Battler
  485.   def battlestatus_x(window_width = 416)
  486.     return 0
  487.   end
  488.   def battlestatus_y
  489.     return Graphics.height - 32
  490.   end
  491.   def battlestatus_offset
  492.     return 0
  493.   end
  494.   def battlestatus_cp_x
  495.     return self.battlestatus_x + self.battlestatus_offset
  496.   end
  497.   def battlestatus_cp_y
  498.     return 400
  499.   end
  500. end
  501. class Game_Actor < Game_Battler
  502.   def battlestatus_x(window_width = 416)
  503.     w  = (window_width * Graphics.width / 544 - 32) / $game_party.members.size
  504.     x  = w * self.index
  505.     x += w / 2
  506.     return x
  507.   end
  508.   def battlestatus_offset
  509.     return (128 * Graphics.width / 544) + 16
  510.   end
  511. end
  512. class Scene_Battle < Scene_Base
  513.   def battlestatus_offset
  514.     return (128 * Graphics.width / 544) + 16
  515.   end
  516. end
  517. #==============================================================================
  518. # バトル用ウィンドウ
  519. #==============================================================================
  520. class Window_TargetActor < Window_Command
  521.   def initialize
  522.     commands = []
  523.     for actor in $game_party.members
  524.       commands.push(actor.name)
  525.     end
  526.     super(416, commands, 2, 4)
  527.   end
  528. end
  529. class Window_BattleSkill < Window_Skill
  530.   def initialize(battler)
  531.     super(0, 288, 544, 104, battler)
  532.     self.z += 501
  533.   end
  534. end
  535. class Window_BattleItem < Window_Item
  536.   def initialize
  537.     super(0, 288, 544, 104)
  538.     self.z += 501
  539.   end
  540. end
  541. class Window_BattleHelp < Window_Help
  542.   def initialize
  543.     super
  544.     self.y = Graphics.height - self.height + 16
  545.     self.z += 500
  546.   end
  547. end
  548. if XRXSV9::QuickListHiding
  549.   class Window_BattleSkill < Window_Skill
  550.     def refresh
  551.       @data = []
  552.       for skill in @actor.skills
  553.         next unless include?(skill)
  554.         @data.push(skill)
  555.         if skill.id == @actor.last_skill_id
  556.           self.index = @data.size - 1
  557.         end
  558.       end
  559.       @item_max = @data.size
  560.       create_contents
  561.       for i in 0...@item_max
  562.         draw_item(i)
  563.       end
  564.     end
  565.     def include?(skill)
  566.       return false if skill and skill.quick?
  567.       return true
  568.     end
  569.   end
  570.   class Window_BattleItem < Window_Item
  571.     def include?(item)
  572.       return false if item and item.quick?
  573.       return super(item)
  574.     end
  575.   end
  576. end
  577. class Window_BattleTrash < Window_BattleItem
  578.   def refresh
  579.     @data = []
  580.     for material in $game_party.trash
  581.       @data.push(material.item)
  582.     end
  583.     @data.push(nil) if include?(nil)
  584.     @item_max = @data.size
  585.     create_contents
  586.     for i in 0...@item_max
  587.       draw_item(i)
  588.     end
  589.   end
  590.   def draw_item(index)
  591.     rect = item_rect(index)
  592.     self.contents.clear_rect(rect)
  593.     item = @data[index]
  594.     if item != nil
  595.       rect.width -= 20
  596.       draw_item_name(item, rect.x + 8, rect.y, false)
  597.     end
  598.   end
  599. end
  600. #==============================================================================
  601. # マテリアルバッグウィンドウ
  602. #==============================================================================
  603. class Window_BattleMaterial < Window_BattleItem
  604.   def initialize(holder)
  605.     @holder = holder
  606.     super()
  607.   end
  608.   def refresh
  609.     @data = []
  610.     for material in @holder.bag
  611.       @data.push(material.item)
  612.     end
  613.     @data.push(nil) if @data.size == 0
  614.     @item_max = @data.size
  615.     create_contents
  616.     for i in 0...@item_max
  617.       draw_item(i)
  618.     end
  619.   end
  620. end
  621. #==============================================================================
  622. # アイテムマテリアル機能への対応
  623. #==============================================================================
  624. class Material
  625. end
  626. class RPG::BaseItem
  627.   attr_accessor :material
  628.   def materialized?
  629.     return self.material.is_a?(Material)
  630.   end
  631. end
  632. #==============================================================================
  633. # マテリアルバッグ/トラッシュ機能
  634. #==============================================================================
  635. class Game_Party < Game_Unit
  636.   def bag
  637.     @bag ||= []
  638.     return @bag
  639.   end
  640.   def trash
  641.     @trash ||= []
  642.     return @trash
  643.   end
  644. end
  645. class Game_Actor < Game_Battler
  646.   def bag
  647.     @bag ||= []
  648.     return @bag
  649.   end
  650. end
  651. #==============================================================================
  652. # アイテム・スキルのクイックコマンド判別
  653. #==============================================================================
  654. module RPG
  655.   class BaseItem
  656.     def quick?
  657.       return (self.note.include?("quick"))
  658.     end
  659.   end
  660. end
  661. class Game_BattleAction
  662.   def quick?
  663.     return ((self.skill and self.skill.quick?) or
  664.             (self.item  and self.item.quick?))
  665.   end
  666. end
  667. #==============================================================================
  668. # ナンバー描画への対応
  669. #==============================================================================
  670. module XRXSVForDNX
  671.   def draw_number(x, y, width, height, number, align, skin, opacity = 224)
  672.     self.draw_text(x, y, width, height, number, align)
  673.   end
  674.   def draw_number_l(x, y, width, height, number, align = 0)
  675.     skin = Cache.system(XRXSVDsIn::NumberL) rescue nil
  676.     self.draw_number(x, y, width, height, number, align, skin)
  677.   end
  678.   def draw_number_s(x, y, width, height, number, align = 0)
  679.     skin = Cache.system(XRXSVDsIn::NumberS) rescue nil
  680.     self.draw_number(x, y, width, height, number, align, skin)
  681.   end
  682. end
  683. class Bitmap
  684.   include XRXSVForDNX
  685. end
  686. #==============================================================================
  687. # 属性アイコンの描画への対応
  688. #==============================================================================
  689. class Window_Base < Window
  690.   def draw_element_icon(element_id, x, y, enabled = true)
  691.     icon_index = (XRXSV52::Icons rescue [])[element_id]
  692.     draw_icon(icon_index, x, y, enabled) if icon_index
  693.   end
  694. end
  695. #==============================================================================
  696. # バトル用ウィンドウ - クイック/パーティスキル/ガード 共通項目
  697. #==============================================================================
  698. class Window_BattlePartyAction < Window_BattleSkill
  699.   def initialize(battler = nil)
  700.     @battler = battler
  701.     super(battler)
  702.     @spacing = 12
  703.     refresh
  704.   end
  705.   def setup(actor)
  706.     @battler = actor
  707.     refresh
  708.   end
  709.   def refresh
  710.     refresh_data
  711.     @item_max = @data.size
  712.     create_contents
  713.     for i in 0...@item_max
  714.       draw_item(i)
  715.     end
  716.   end
  717.   def user
  718.     return @user[self.index]
  719.   end
  720.   def draw_item(index)
  721.     item  = @data[index]
  722.     actor = @user[index]
  723.     rect = item_rect(index)
  724.     rect.x += 50
  725.     rect.width -= 50
  726.     self.contents.clear_rect(rect)
  727.     en_costs = (item.en_costs rescue [])
  728.     if item
  729.       self.contents.blt(rect.x - 46, rect.y, actor.miniface, actor.miniface.rect) rescue nil
  730.       self.contents.clear_rect(rect.x - 46, rect.y,      48, 1)
  731.       self.contents.clear_rect(rect.x - 46, rect.y + 23, 48, 1)
  732.     end
  733.     if item.is_a?(RPG::Item)
  734.       number = $game_party.item_number(item)
  735.       enabled = enable?(item)
  736.       rect.width -= 4
  737.       draw_item_name(item, rect.x, rect.y, enabled)
  738.       self.contents.draw_text(rect, sprintf(":%2d", number), 2)
  739.     else
  740.       skill = item
  741.       rect.width -= 4
  742.       if skill
  743.         self.contents.font.size = 19
  744.         enabled = enable_skill?(actor, skill)
  745.         draw_item_name(skill, rect.x, rect.y, enabled)
  746.         mp_cost = actor.calc_mp_cost(skill)
  747.         if en_costs.empty? and mp_cost >= 1
  748.           self.contents.draw_text(rect, mp_cost, 2)
  749.         end
  750.       else
  751.         self.contents.draw_text(rect, nil_text())
  752.       end
  753.     end
  754.     if en_costs.size >= 1
  755.       x = rect.x + rect.width - 24 * en_costs.size
  756.       for element_id in en_costs
  757.         draw_element_icon(element_id, x, rect.y)
  758.         x += 24
  759.       end
  760.     end
  761.   end
  762.   def nil_text()
  763.     return "---"
  764.   end
  765.   #--------------------------------------------------------------------------
  766.   # ○ アイテムの取得
  767.   #--------------------------------------------------------------------------
  768.   def item
  769.     return @data[self.index]
  770.   end
  771.   #--------------------------------------------------------------------------
  772.   # enable状態
  773.   #--------------------------------------------------------------------------
  774.   def enable?(item)
  775.     return $game_party.item_can_use?(item)
  776.   end
  777.   def enable_skill?(actor, skill)
  778.     return (actor.skill_can_use?(skill))
  779.   end
  780.   def item_enable?
  781.     if self.item.is_a?(RPG::Skill)
  782.       return self.user.skill_can_use?(item)
  783.     elsif self.item.is_a?(RPG::Item)
  784.       return $game_party.item_can_use?(item)
  785.     end
  786.     return true
  787.   end
  788. end
  789. #==============================================================================
  790. # バトル用ウィンドウ - クイックコマンド
  791. #==============================================================================
  792. class Window_BattleQuick < Window_BattlePartyAction
  793.   def refresh_data
  794.     @data = []
  795.     @user = []
  796.     enable_set  = []
  797.     disable_set = []
  798.     for actor in $game_party.members
  799.       for material in (actor.bag rescue []) #for item in $game_party.items
  800.         item = material.item
  801.         if item.is_a?(RPG::Item) and item.occasion <= 1 and item.quick?
  802.           enable_set.push([actor, item])
  803.         end
  804.       end
  805.     end
  806.     for actor in (XRXSV9::QuickFriendSupport ? $game_party.members : [@battler])
  807.       for skill in actor.skills
  808.         if skill.quick?
  809.           if enable_skill?(actor, skill)
  810.             enable_set.push([actor, skill])
  811.           else
  812.             disable_set.push([actor, skill])
  813.           end
  814.         end
  815.       end
  816.     end
  817.     for set in enable_set + disable_set
  818.       @user.push(set[0])
  819.       @data.push(set[1])
  820.     end
  821.   end
  822. end
  823. #==============================================================================
  824. # バトル用ウィンドウ - パーティスキル
  825. #==============================================================================
  826. class Window_BattlePartySkill < Window_BattlePartyAction
  827.   def refresh_data
  828.     @data = []
  829.     @user = []
  830.     enable_set  = []
  831.     disable_set = []
  832.     for actor in $game_party.members
  833.       set1 = []
  834.       set2 = []
  835.       for skill in actor.skills
  836.         if not skill.quick?
  837.           if enable_skill?(actor, skill)
  838.             set1.push(skill)
  839.           else
  840.             set2.push(skill)
  841.           end
  842.         end
  843.       end
  844.       if set1.empty? and set2.empty?
  845.         set1.push(nil)
  846.       end
  847.       for skill in set1
  848.         enable_set.push([actor, skill])
  849.       end
  850.       for skill in set2
  851.         disable_set.push([actor, skill])
  852.       end
  853.     end
  854.     for set in enable_set + disable_set
  855.       @user.push(set[0])
  856.       @data.push(set[1])
  857.     end
  858.   end
  859.   def enable_skill?(actor, skill)
  860.     return false if skill.for_guard?
  861.     return (not actor.commanded and
  862.             (skill == nil or actor.skill_can_use?(skill)))
  863.   end
  864. end
  865. #==============================================================================
  866. # 戦闘背景の取得 (背景をビットマップで取得する)
  867. #==============================================================================
  868. class Game_Map
  869.   def battleback
  870.     $data_mapinfos = load_data("Data/MapInfos.rvdata") if $data_mapinfos.nil?
  871.     id = self.map_id
  872.     bitmap = nil
  873.     while id >= 1
  874.       name = XRXSV9::BBMap + id.to_s
  875.       begin
  876.         bitmap = Cache.parallax(name)
  877.         break
  878.       rescue
  879.         nil
  880.       end
  881.       id = $data_mapinfos[id].parent_id
  882.     end
  883.     if bitmap == nil
  884.       id = ($game_player.terrain_id rescue 0)
  885.       if id >= 1
  886.         name = XRXSV9::BBTrrain + id.to_s
  887.         bitmap = Cache.parallax(name) rescue nil
  888.       end
  889.     end
  890.     return bitmap
  891.   end
  892. end
  893. #==============================================================================
  894. # バトラー設定 / 魔法の「詠唱セット」
  895. #==============================================================================
  896. class Game_Temp
  897.   def commanded_battlers
  898.     @commanded_battlers = [] if @commanded_battlers == nil
  899.     return @commanded_battlers
  900.   end
  901. end
  902. class Game_Battler
  903.   attr_accessor :power_increase_turn
  904.   attr_accessor :action
  905.   def commanded
  906.     return $game_temp.commanded_battlers.include?(self)
  907.   end
  908.   def commanded=(b)
  909.     if b
  910.       $game_temp.commanded_battlers.push(self)
  911.     else
  912.       $game_temp.commanded_battlers.delete(self)
  913.     end
  914.   end
  915.   alias xrxsv9_skill_effective? skill_effective?
  916.   def skill_effective?(user, skill)
  917.     return false if user.action.blocked
  918.     return xrxsv9_skill_effective?(user, skill)
  919.   end
  920. end
  921. #==============================================================================
  922. # バトルアクション設定
  923. #==============================================================================
  924. class Game_BattleAction
  925.   attr_accessor :counter
  926.   attr_accessor :material
  927.   attr_accessor :orderer
  928.   attr_accessor :blocked
  929.   attr_accessor :target_spirit
  930.   #--------------------------------------------------------------------------
  931.   # ● スキルオブジェクト取得
  932.   #--------------------------------------------------------------------------
  933.   alias xrxsv9_skill skill
  934.   def skill
  935.     return (@skill_obj ? @skill_obj : xrxsv9_skill)
  936.   end
  937.   #--------------------------------------------------------------------------
  938.   # マテリアル機能ほか各種への対応
  939.   #--------------------------------------------------------------------------
  940.   alias xrxsv9_clear clear
  941.   def clear
  942.     xrxsv9_clear
  943.     @material = nil
  944.     @orderer = nil
  945.     @skill_obj = nil
  946.     @blocked = false
  947.     @target_spirit = nil
  948.   end
  949.   def set_skill_obj(skill)
  950.     @kind = 1
  951.     @skill_obj = skill
  952.   end
  953.   def set_material(material)
  954.     @kind = 2
  955.     @material = material
  956.   end
  957.   def set_spell(material)
  958.     @kind = 4
  959.     @material = material
  960.   end
  961.   alias xrxsv9_item item
  962.   def item
  963.     return @material.item if @material
  964.     return xrxsv9_item
  965.   end
  966.   #--------------------------------------------------------------------------
  967.   # ○ 逃走を設定
  968.   #--------------------------------------------------------------------------
  969.   def set_escape
  970.     @kind = 0
  971.     @basic = 2
  972.   end
  973.   def escape?
  974.     return (@kind == 0 and @basic == 2)
  975.   end
  976. end
  977. #==============================================================================
  978. # CP機能 - 表示セットの基本形
  979. #==============================================================================
  980. class Spriteset_CP
  981.   def initialize(members, info_viewport = nil)
  982.   end
  983.   def refresh(reserve_actions = nil)
  984.   end
  985.   def update
  986.   end
  987.   def visible=(b)
  988.   end
  989.   def opacity
  990.     return 255
  991.   end
  992.   def opacity=(n)
  993.   end
  994.   def dispose
  995.   end
  996.   def reset_members(member)
  997.   end
  998. end
  999. #==============================================================================
  1000. # CP機能 - 対応
  1001. #==============================================================================
  1002. class Game_Battler
  1003.   def cp_per48
  1004.     return cp_per96/2
  1005.   end
  1006.   def cp_per96
  1007.     return  0 if self.dead?
  1008.     return 96
  1009.   end
  1010.   def cp_max?
  1011.     return true
  1012.   end
  1013.   def cp_reset
  1014.   end
  1015.   def cp_nillize
  1016.   end
  1017. end
  1018. #==============================================================================
  1019. # ATB対応方式 - ガード/入力可能?
  1020. #==============================================================================
  1021. module XRXSV9BattlerATBNeeds
  1022.   attr_accessor :guarding
  1023.   def guarding?
  1024.     return self.guarding
  1025.   end
  1026.   def inputable?
  1027.     return (self.cp_max? and super)
  1028.   end
  1029. end
  1030. class Game_Actor < Game_Battler
  1031.   include XRXSV9BattlerATBNeeds
  1032. end
  1033. class Game_Enemy < Game_Battler
  1034.   include XRXSV9BattlerATBNeeds
  1035. end
  1036. #==============================================================================
  1037. # バトルリザルト - データ
  1038. #==============================================================================
  1039. class Game_Temp
  1040.   attr_accessor :battle_result_gold
  1041.   attr_accessor :battle_result_tresures
  1042.   attr_accessor :battle_result_ap
  1043. end
  1044. class Game_Battler
  1045.   attr_accessor :battle_result_exp
  1046. end
  1047. #==============================================================================
  1048. # バトルリザルト - EXP権利
  1049. #==============================================================================
  1050. class Game_Enemy < Game_Battler
  1051.   def exp_rights
  1052.     @exp_rights = [] if @exp_rights == nil
  1053.     return @exp_rights
  1054.   end
  1055.   attr_accessor :exp_mvp
  1056. end
  1057. #==============================================================================
  1058. # バトルリザルト - BGMの取得と設定
  1059. #==============================================================================
  1060. class Game_System
  1061.   def battle_end_bgm=(battle_end_bgm)
  1062.     @battle_end_bgm = battle_end_bgm
  1063.   end
  1064.   def battle_end_bgm
  1065.     if @battle_end_bgm == nil
  1066.       return RPG::BGM.new(XRXSV9::BattleEndBGM) rescue nil
  1067.     else
  1068.       return @battle_end_bgm
  1069.     end
  1070.   end
  1071. end
  1072. #==============================================================================
  1073. # バトルリザルト - 対応
  1074. #==============================================================================
  1075. module XRXSV9_SceneBattleTemplates
  1076.   def battle_result_enabled?
  1077.     return false
  1078.   end
  1079.   def actor_battler_initialize
  1080.   end
  1081. end
  1082. class Scene_Battle < Scene_Base
  1083.   include XRXSV9_SceneBattleTemplates
  1084. end
  1085. #==============================================================================
  1086. # エネミーインフォウィンドウ
  1087. #==============================================================================
  1088. class Window_EnemyInfo < Window_Base
  1089.   def initialize
  1090.     super(0,0,36,36)
  1091.     self.opacity = 0
  1092.   end
  1093.   def refresh
  1094.   end
  1095. end
  1096. #==============================================================================
  1097. # ■ バトルメッセージ
  1098. #==============================================================================
  1099. class Window_BattleMessage < Window_Message
  1100.   def last_instant_text
  1101.     return @lines[-1].to_s
  1102.   end
  1103.   def set(object)
  1104.   end
  1105.   def close_force
  1106.     @closing = true if self.openness > 0
  1107.     @opening = false
  1108.   end
  1109. end
  1110. #==============================================================================
  1111. # ■ アクターコマンド [再定義]
  1112. #==============================================================================
  1113. class Window_ActorCommand < Window_Command
  1114.   def initialize
  1115.     @quick_one_mode = false
  1116.     @command_ids = XRXSV9::CommandIDs
  1117.     super(128, [], 1, XRXSV9::CommandRow)
  1118.     self.active = false
  1119.     self.openness = 0
  1120.     self.x = 0
  1121.     self.y = Graphics.height - self.height
  1122.     self.z = 204
  1123.   end
  1124.   def setup(actor)
  1125.     @command_ids = XRXSV9::CommandIDs
  1126.     names = XRXSV9.command_names
  1127.     if actor.class.skill_name_valid     # スキルのコマンド名が有効?
  1128.       names[1] = actor.class.skill_name       # コマンド名を置き換える
  1129.     end
  1130.     @commands = []
  1131.     for id in XRXSV9::CommandIDs
  1132.       @commands.push(names[id])
  1133.     end
  1134.     @item_max = @commands.size
  1135.     refresh
  1136.     escape_index = names.index(Vocab::escape)
  1137.     escape_index = XRXSV9::CommandIDs.index(escape_index.to_i)
  1138.     if escape_index
  1139.       draw_item(escape_index, ($game_troop.can_escape and not $game_temp.battle_phase))
  1140.     end
  1141.     self.index = 0
  1142.     @quick_one_mode = false
  1143.   end
  1144.   def command_id
  1145.     return @command_ids[self.index].to_i
  1146.   end
  1147.   def row_max
  1148.     return XRXSV9::CommandIDs.size
  1149.   end
  1150. end
  1151. #==============================================================================
  1152. # コマンド確認ウィンドウ
  1153. #==============================================================================
  1154. class Window_ActorCommandSet < Window_Base
  1155.   if XRXSV9::CommandSetVisible
  1156.     def initialize
  1157.       x =   0
  1158.       y = 252
  1159.       w = 128
  1160.       h =  36
  1161.       @original_y = y
  1162.       @back_window = Window_Base.new(x, y, w, h)
  1163.       @back_window.contents.dispose
  1164.       super(x-16, y-16, w+32, h+32)
  1165.       self.visible = false
  1166.       self.opacity = 0
  1167.       self.z = 208
  1168.       @back_window.z = 105
  1169.     end
  1170.     def y=(n)
  1171.       @back_window.y = n
  1172.       super(n - 16)
  1173.     end
  1174.     def dispose
  1175.       @back_window.dispose
  1176.       super
  1177.     end
  1178.     def set(object)
  1179.       self.visible = true
  1180.       case object
  1181.       when RPG::Item, RPG::Skill
  1182.         draw_line(object.name)
  1183.         self.y = @original_y
  1184.       when Game_Battler
  1185.         draw_actor(object)
  1186.       else
  1187.         draw_line(object.to_s)
  1188.         self.y = @original_y
  1189.       end
  1190.     end
  1191.     def draw_actor(actor)
  1192.       self.contents.clear
  1193.       rect = self.contents.rect.dup
  1194.       rect.x += 8
  1195.       rect.width -= 16
  1196.       begin
  1197.         self.contents.blt(rect.x, 6, actor.miniface, actor.miniface.rect)
  1198.         rect.x += 48
  1199.         rect.width -= 48
  1200.       rescue
  1201.         nil
  1202.       end
  1203.       self.contents.draw_text(rect, actor.name, 1)
  1204.     end
  1205.     def draw_line(text)
  1206.       self.contents.clear
  1207.       rect = self.contents.rect
  1208.       self.contents.draw_text(rect.x + 8, rect.y, rect.width - 16, rect.height, text, 1)
  1209.     end
  1210.     def visible=(b)
  1211.       @back_window.visible = b
  1212.       super
  1213.     end
  1214.   else
  1215.     def initialize
  1216.       super(0, 0, 36, 36)
  1217.       self.visible = false
  1218.     end
  1219.     def set(object)
  1220.     end
  1221.   end
  1222.   def clear
  1223.     self.visible = false
  1224.   end
  1225. end
  1226. #==============================================================================
  1227. # スパン[ターン]バトルベントのクリア
  1228. #==============================================================================
  1229. class Game_Troop < Game_Unit
  1230.   def clear_turn_battle_event
  1231.     for page in troop.pages
  1232.       if page.span == 1
  1233.         @event_flags= false
  1234.       end
  1235.     end
  1236.   end
  1237. end
复制代码
Bpart:
  1. #==============================================================================
  2. # BaST - 基本戦闘進行処理
  3. #==============================================================================
  4. class Scene_Battle < Scene_Base
  5.   #--------------------------------------------------------------------------
  6.   # 全メンバー
  7.   #--------------------------------------------------------------------------
  8.   def members
  9.     return  $game_party.members + $game_troop.members
  10.   end
  11.   #--------------------------------------------------------------------------
  12.   # ● 開始処理 *
  13.   #--------------------------------------------------------------------------
  14.   def start
  15.     xcam_reset
  16.     battle_start_initialize
  17.     actor_battler_initialize
  18.     cp_initialize
  19.     super
  20.     create_sprites_windows
  21.     create_extra_windows
  22.     create_info_viewport
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # バトル開始時の変数初期化
  26.   #--------------------------------------------------------------------------
  27.   def battle_start_initialize
  28.     $game_troop.preemptive |= $game_temp.preemptive
  29.     $game_troop.surprise   |= $game_temp.surprise
  30.     $game_temp.preemptive = false
  31.     $game_temp.surprise   = false
  32.     $game_temp.in_battle = true
  33.     $game_temp.commanded_battlers.clear #*
  34.     $game_temp.battle_timing_type = 0
  35.     @cp_active = false
  36.     @phase = 1
  37.     @quick_mode = false
  38.     @quick_mode_in_action = false
  39.     $game_temp.turn_shift = $game_troop.surprise
  40.     @commanding_action = nil
  41.     @quick_action = nil
  42.     @action_battlers = []
  43.     @active_actions = []
  44.     @charging_actions = []
  45.     @damage_timings = []
  46.     @actor_index = -1
  47.   end
  48.   #--------------------------------------------------------------------------
  49.   # 開始処理 - バトルスプライトセット・各種表示ウィンドウの作成
  50.   #--------------------------------------------------------------------------
  51.   def create_sprites_windows
  52.     last_background_bitmap = $game_temp.background_bitmap
  53.     battleback_bitmap = $game_map.battleback
  54.     battleback_bitmap = (Cache.parallax(XRXSV9::BBBTEST) rescue nil) if $BTEST
  55.     if battleback_bitmap != nil
  56.       $game_temp.background_bitmap = battleback_bitmap
  57.     end
  58.     @spriteset = Spriteset_Battle.new
  59.     $game_temp.background_bitmap = last_background_bitmap
  60.     @enemyinfo_window     = Window_EnemyInfo.new
  61.     @message_window       = Window_BattleMessage.new
  62.     @status_window        = Window_BattleStatus.new
  63.     @party_command_window = Window_PartyCommand.new
  64.     @actor_command_window = Window_ActorCommand.new
  65.     @cp_spriteset         = Spriteset_CP.new(self.members, @info_viewport)
  66.     @party_command_window.visible = false
  67.     @party_command_window.active = false
  68.     @commandset_window    = Window_ActorCommandSet.new
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # ● 情報表示ビューポートの作成 *
  72.   #--------------------------------------------------------------------------
  73.   def create_info_viewport
  74.     @info_viewport = Viewport.new(0, 288, 544, 128)
  75.     @__command_partyform_index =
  76.       @party_command_window.add_command(Vocab.partyform_battle)
  77.     @party_command_window.draw_item(@__command_partyform_index,
  78.       $game_party.battle_partyform_enable?)
  79.   end
  80.   #--------------------------------------------------------------------------
  81.   # ● 情報表示ビューポートの更新 *
  82.   #--------------------------------------------------------------------------
  83.   def update_info_viewport
  84.     @party_command_window.update
  85.     @actor_command_window.update
  86.     @status_window.update
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ● 戦闘開始の処理
  90.   #--------------------------------------------------------------------------
  91.   def process_battle_start
  92.     process_apear_enemies
  93.     make_escape_ratio
  94.     process_battle_event
  95.     start_party_command_selection
  96.     start_cp
  97.     $game_troop.increase_turn
  98.     wait_for_jump
  99.     battler_power_initialize if defined? battler_power_initialize
  100.   end
  101.   def start_cp
  102.     @cp_active = true
  103.   end
  104.   #--------------------------------------------------------------------------
  105.   # 敵の出現の表示
  106.   #--------------------------------------------------------------------------
  107.   def process_apear_enemies
  108.     @message_window.clear
  109.     #wait(10)
  110.     for name in $game_troop.enemy_names
  111.       text = sprintf(Vocab::Emerge, name)
  112.       @message_window.add_instant_text(text)
  113.       #$game_message.texts.push(text)
  114.       wait(5)
  115.     end
  116.     if $game_troop.preemptive
  117.       text = sprintf(Vocab::Preemptive, $game_party.name)
  118.       @message_window.add_instant_text(text)
  119.     elsif $game_troop.surprise
  120.       text = sprintf(Vocab::Surprise, $game_party.name)
  121.       @message_window.add_instant_text(text)
  122.     end
  123.     wait(5)
  124.     #wait_for_message
  125.     #@message_window.clear
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # ● 終了処理
  129.   #--------------------------------------------------------------------------
  130.   alias xrxsv9_terminate terminate
  131.   def terminate
  132.     xrxsv9_terminate
  133.     for actor in $game_party.members
  134.       actor.cp_nillize
  135.     end
  136.     @cp_spriteset.dispose
  137.     @commandset_window.dispose
  138.     @enemyinfo_window.dispose
  139.     dispose_extra_windows
  140.   end
  141.   #--------------------------------------------------------------------------
  142.   # ● フレーム更新
  143.   #--------------------------------------------------------------------------
  144.   def update
  145.     super
  146.     update_basic(true)
  147.     if not $game_message.visible          # メッセージ表示中以外
  148.       return if judge_win_loss            # 勝敗判定
  149.       update_scene_change
  150.       update_action
  151.     end
  152.   end
  153.   #--------------------------------------------------------------------------
  154.   # ● 基本更新処理
  155.   #--------------------------------------------------------------------------
  156.   def update_basic(main = false)
  157.     Graphics.update unless main     # ゲーム画面を更新
  158.     Input.update unless main        # 入力情報を更新
  159.     $game_system.update             # タイマーを更新
  160.     $game_troop.update              # 敵グループを更新
  161.     @spriteset.update               # スプライトセットを更新
  162.     @message_window.update          # メッセージウィンドウを更新
  163.     update_battle_cam
  164.     update_info_viewport
  165.     if $game_troop.interpreter.running? or $game_message.visible
  166.       @actor_command_window.openness -= 32 if @actor_command_window.openness > 0
  167.     elsif not @quick_mode_in_action
  168.       action_stream_battler =  @active_battler
  169.       action_stream_action  = (@active_battler ? @active_battler.action : nil)
  170.       action_stream_active_action = @active_action
  171.       #
  172.       # ベッシックストリーム(カウント・コマンド)
  173.       #
  174.       if @commanding_action
  175.         @active_battler        = @commanding_action.battler
  176.         @active_battler.action = @commanding_action
  177.       else
  178.         @active_battler        = nil
  179.       end
  180.       update_basic_stream
  181.       #
  182.       # クイックモード
  183.       #
  184.       while @quick_mode
  185.         if @quick_action
  186.           @active_battler = @quick_action.battler
  187.           @active_battler.action = @quick_action
  188.           @active_action = @quick_action
  189.           @quick_action = nil
  190.           @quick_mode_in_action = true
  191.           process_quick_action
  192.           @quick_mode_in_action = false
  193.         elsif not @quick_mode_in_update
  194.           @quick_mode_in_update = true
  195.           update_basic(false)
  196.           @quick_mode_in_update = false
  197.         else
  198.           break
  199.         end
  200.       end
  201.       #
  202.       @active_battler        = action_stream_battler
  203.       @active_battler.action = action_stream_action if action_stream_battler
  204.       @active_action = action_stream_active_action
  205.     end
  206.     @cp_spriteset.update
  207.   end
  208.   #--------------------------------------------------------------------------
  209.   # フレーム更新 - カウント/コマンドストリーム
  210.   #--------------------------------------------------------------------------
  211.   def update_basic_stream
  212.     case @phase
  213.     when 2
  214.       update_stream_count
  215.     when 3
  216.       update_stream_command
  217.     end
  218.   end
  219.   #--------------------------------------------------------------------------
  220.   # フレーム更新 - カウントストリーム
  221.   #--------------------------------------------------------------------------
  222.   def update_stream_count
  223.     @phase = 3
  224.     make_auto_actions
  225.     @actor_index = -1
  226.     next_actor
  227.   end
  228.   #--------------------------------------------------------------------------
  229.   # ターンごとの値をクリアする
  230.   #--------------------------------------------------------------------------
  231.   def process_standby_phase
  232.     $game_temp.link_done = false
  233.     $game_temp.battle_phase = false
  234.     $game_temp.used_skill_hash.clear
  235.     for battler in $game_party.members + $game_troop.members
  236.       battler.power_increase_turn = 0
  237.     end
  238.     for battler in self.members
  239.       battler.elementic_turn = nil
  240.     end
  241.   end
  242.   #--------------------------------------------------------------------------
  243.   # コマンド不可能状態(ターンシフト用に分離)
  244.   #--------------------------------------------------------------------------
  245.   def actor_command_stop?
  246.     return $game_troop.surprise
  247.   end
  248.   def enemy_command_stop?
  249.     return $game_troop.preemptive
  250.   end
  251.   #--------------------------------------------------------------------------
  252.   # フレーム更新 - コマンドストリーム
  253.   #--------------------------------------------------------------------------
  254.   def update_stream_command
  255.     if make_auto_actions
  256.       #
  257.     else
  258.       update_command
  259.     end
  260.   end
  261.   def make_auto_actions
  262.     changed = false
  263.     unless enemy_command_stop?
  264.       for enemy in $game_troop.members
  265.         if enemy.cp_max? and not enemy.commanded
  266.           last_action = enemy.action
  267.           enemy.action = Game_BattleAction.new(enemy)
  268.           enemy.make_action
  269.           enemy.action.make_speed
  270.           enemy.commanded = true
  271.           enemy.guarding = false
  272.           enemy.cp_reset
  273.           make_action_orders
  274.           @charging_actions.push(enemy.action)
  275.           enemy.action = last_action
  276.           changed = true
  277.         end
  278.       end
  279.     end
  280.     changed |= make_actor_auto_actions
  281.     for action in @charging_actions.clone
  282.       if action.battler.cp_max?
  283.         @active_actions.push(action)
  284.         @charging_actions.delete(action)
  285.         changed = true
  286.       end
  287.     end
  288.     if changed
  289.       @cp_spriteset.refresh(@active_actions + @charging_actions)
  290.     end
  291.     return changed
  292.   end
  293.   def make_actor_auto_actions
  294.     changed = false
  295.     for actor in $game_party.members
  296.       if actor.cp_max? and not actor.inputable? and not actor.commanded
  297.         command_done(Game_BattleAction.new(actor))
  298.         changed = true
  299.       end
  300.     end
  301.     return changed
  302.   end
  303.   #--------------------------------------------------------------------------
  304.   # ● 行動順序作成 *
  305.   #--------------------------------------------------------------------------
  306.   def make_action_orders
  307.     for action in @charging_actions
  308.       @active_actions.push(action)
  309.     end
  310.     @charging_actions.clear
  311.     @active_actions.sort! do |a,b|
  312.       b.speed - a.speed
  313.     end
  314.   end
  315.   #--------------------------------------------------------------------------
  316.   # フレーム更新 - コマンド
  317.   #--------------------------------------------------------------------------
  318.   def update_command
  319.     if @target_enemy_window != nil
  320.       update_target_enemy_selection     # 対象敵キャラ選択
  321.     elsif @target_actor_window != nil
  322.       update_target_actor_selection     # 対象アクター選択
  323.     elsif @quick_window != nil
  324.       update_quick_selection            # クイック選択
  325.     elsif @trash_window != nil
  326.       update_trash_selection            # トラッシュ選択
  327.     elsif @skill_window != nil
  328.       if @skill_window.is_a?(Window_BattlePartySkill)
  329.         update_party_skill_selection    # パーティスキル選択
  330.       else
  331.         update_skill_selection          # スキル選択
  332.       end
  333.     elsif @item_window != nil
  334.       update_item_selection             # アイテム選択
  335.     elsif @actorlist_window
  336.       update_actor_list_command         # アクターリスト選択
  337.     elsif @actor_command_window.active
  338.       update_actor_command_selection    # アクターコマンド選択
  339.     end
  340.   end
  341.   def update_actor_list_command
  342.   end
  343.   #--------------------------------------------------------------------------
  344.   # フレーム更新 - アクション
  345.   #--------------------------------------------------------------------------
  346.   def update_action
  347.     return unless update_action?
  348.     process_battle_event              # バトルイベントの処理
  349.     process_action                    # 戦闘行動
  350.     process_battle_event              # バトルイベントの処理
  351.   end
  352.   def update_action?
  353.     return (@phase == 4)
  354.   end
  355.   #--------------------------------------------------------------------------
  356.   # ● バトルイベントの処理 * 再定義
  357.   #--------------------------------------------------------------------------
  358.   def process_battle_event
  359.     loop do
  360.       return if !XRXSV9::NonJudgeBattleEvent and judge_win_loss
  361.       return if $game_temp.next_scene != nil
  362.       last_members = self.members.dup
  363.       $game_troop.interpreter.update
  364.       $game_troop.setup_battle_event
  365.       wait_for_message
  366.       added_battlers = self.members - last_members
  367.       for battler in added_battlers
  368.         battler.battler_initialize
  369.       end
  370.       if last_members != self.members
  371.         @cp_spriteset.reset_members(self.members)
  372.         @status_window.refresh
  373.       end
  374.       process_action if $game_troop.forcing_battler != nil
  375.       if $game_troop.interpreter.running?
  376.         end_all_selection
  377.         update_basic
  378.       else
  379.         @message_window.clear
  380.         #update_scene_change
  381.         #judge_win_loss
  382.         return
  383.       end
  384.     end
  385.   end
  386.   #--------------------------------------------------------------------------
  387.   # クイックモード
  388.   #--------------------------------------------------------------------------
  389.   def quick_on!
  390.     $game_temp.bluestop_battle_tone2
  391.     $game_temp.xcam.lock = true
  392.     RPG::BGM.volume_down
  393.     @quick_mode = true
  394.     @spriteset.animation_hold!
  395.     @message_window.message_hold!
  396.     @held_damage_timings ||= []
  397.     @held_damage_timings.push(@damage_timings)
  398.     @damage_timings = []
  399.   end
  400.   def quick_off!
  401.     $game_temp.clear_battle_tone2
  402.     $game_temp.xcam.lock = false
  403.     RPG::BGM.volume_back
  404.     @quick_mode = false
  405.     @spriteset.animation_unhold!
  406.     @message_window.message_unhold!
  407.     @held_damage_timings ||= []
  408.     timings = @held_damage_timings.shift
  409.     if timings
  410.       @damage_timings = timings
  411.     end
  412.   end
  413. end
复制代码
Cpart:
  1. #==============================================================================
  2. # BaST - コマンドストリーム
  3. #==============================================================================
  4. class Scene_Battle < Scene_Base
  5.   #--------------------------------------------------------------------------
  6.   # ● パーティコマンド選択の開始 * (アクターコマンドフェイズの開始)
  7.   #--------------------------------------------------------------------------
  8.   def start_party_command_selection
  9.     @party_command_window.active = false
  10.     $game_temp.turn_shift ^= true
  11.     @phase = 2
  12.     xcam_turn_refresh
  13.   end
  14.   #--------------------------------------------------------------------------
  15.   # ● アクターコマンド選択の開始
  16.   #--------------------------------------------------------------------------
  17.   alias xrxsv9_start_actor_command_selection start_actor_command_selection
  18.   def start_actor_command_selection
  19.     xrxsv9_start_actor_command_selection
  20.     @commanding_action = Game_BattleAction.new(@active_battler)
  21.     @active_battler.action = @commanding_action
  22.     @actor_command_window.openness = 0
  23.     @actor_command_window.active = true
  24.     @actor_command_window.visible = true
  25.     @status_window.index = @actor_index
  26.     cp_start_actor_command
  27.     @commandset_window.set(@active_battler)
  28.     @commandset_window.y = @actor_command_window.y - 36
  29.   end
  30.   def cp_start_actor_command
  31.     XRXSV9::CommandPopSE.play
  32.     @cp_spriteset.refresh
  33.   end
  34.   #--------------------------------------------------------------------------
  35.   # ● アクターコマンド選択の更新 *
  36.   #--------------------------------------------------------------------------
  37.   def update_actor_command_selection
  38.     process_actor_command_selection
  39.   end
  40.   def process_actor_command_selection
  41.     if @actor_command_window.openness < 255
  42.       @actor_command_window.openness += 32
  43.     end
  44.     if Input.trigger?(Input::B)
  45.       Sound.play_cancel
  46.       prior_actor
  47.     elsif Input.trigger?(Input::C)
  48.       @commanded_actor = @active_battler
  49.       case @actor_command_window.command_id
  50.       when 0  # 攻撃
  51.         Sound.play_decision
  52.         @active_battler.action.set_attack
  53.         start_target_enemy_selection
  54.       when 1  # スキル
  55.         Sound.play_decision
  56.         start_skill_selection
  57.       when 2  # 防御
  58.         Sound.play_decision
  59.         do_guard_command
  60.       when 3  # アイテム
  61.         Sound.play_decision
  62.         start_item_selection
  63.       when 4 # 装備
  64.         Sound.play_decision
  65.         $game_temp.scene!(Scene_BattleEquip.new(@actor_index, 0))
  66.       when 5 # ステータス
  67.         Sound.play_decision
  68.         $game_temp.scene!(Scene_BattleStatus.new(@actor_index))
  69.       when 6 # クイックコマンド
  70.         Sound.play_decision
  71.         start_quick_selection
  72.       when 7 # パーティスキル
  73.         Sound.play_decision
  74.         start_party_skill_selection
  75.       when 8 # 逃げる
  76.         if $game_troop.can_escape == false or $game_temp.battle_phase
  77.           Sound.play_buzzer
  78.           return
  79.         end
  80.         Sound.play_decision
  81.         process_escape_command
  82.       when 9 # ターンエンド
  83.         Sound.play_decision
  84.         process_turn_end_command
  85.       when 10 # 個別マテリアルバッグ
  86.         start_material_selection
  87.       when 11 # パーティ共通マテリアルバッグ
  88.         start_party_material_selection
  89.       when 13 # パーティ編成画面に移行
  90.         unless $game_party.battle_partyform_enable?
  91.           Sound.play_buzzer
  92.           return
  93.         end
  94.         Sound.play_decision
  95.         process_partyform
  96.         return
  97.       when 12 # アイテムトラッシュ
  98.         start_trash_selection
  99.       when 14 # 精霊召喚装着
  100.         if $game_temp.link_done or $game_temp.battle_phase
  101.           Sound.play_buzzer
  102.           return
  103.         end
  104.         start_spirit_selection rescue nil
  105.       end
  106.     end
  107.     update_actor_command_selection_ex
  108.   end
  109.   def update_actor_command_selection_ex
  110.   end
  111.   def process_turn_end_command
  112.     actor_command_close
  113.     start_main
  114.   end
  115.   def process_escape_command
  116.     @active_battler.action.set_escape
  117.     next_actor
  118.   end
  119.   def process_partyform
  120.     Graphics.freeze
  121.     snapshot_for_background
  122.     $scene = Scene_PartyForm.new(0, Scene_PartyForm::HOST_BATTLE)
  123.     $scene.main
  124.     $scene = self
  125.     @status_window.refresh
  126.     perform_transition
  127.   end
  128.   #--------------------------------------------------------------------------
  129.   # 防御コマンドの実行
  130.   #--------------------------------------------------------------------------
  131.   def do_guard_command
  132.     @active_battler.action.set_guard
  133.     next_actor
  134.   end
  135.   #--------------------------------------------------------------------------
  136.   # ● 次のアクターのコマンド入力へ *
  137.   #--------------------------------------------------------------------------
  138.   def next_actor
  139.     end_quick_selection
  140.     if @actor_index >= 0
  141.       active_command_do(true)
  142.     end
  143.     if @quick_mode
  144.       actor_command_close
  145.     else
  146.       actor_command_seach(1, true, false)
  147.     end
  148.   end
  149.   #--------------------------------------------------------------------------
  150.   # ● 前のアクターのコマンド入力へ *
  151.   #--------------------------------------------------------------------------
  152.   def prior_actor
  153.     actor_command_seach(-1, false, true)
  154.   end
  155.   #--------------------------------------------------------------------------
  156.   # 現在のアクターコマンドを閉じる
  157.   #--------------------------------------------------------------------------
  158.   def actor_command_close
  159.     @actor_command_window.openness = 0
  160.     @actor_command_window.active = false
  161.     @commandset_window.clear
  162.     @status_window.index = -1
  163.     @commanding_action = nil
  164.   end
  165.   #--------------------------------------------------------------------------
  166.   # アクターコマンド判定サーチ
  167.   #--------------------------------------------------------------------------
  168.   def actor_command_seach(n, command_deciding, command_canceling)
  169.     actor_command_close
  170.     @actor_index = -1 if @actor_index <= -2
  171.     if $game_party.members.size <= 0
  172.       return
  173.     end
  174.     ($game_party.members.size + 1).times do
  175.       if n == 1
  176.         if actor_command_stop? or (command_deciding and action_start?)
  177.           start_main
  178.           return
  179.         end
  180.       elsif n == -1 and command_canceling and @actor_index == 0
  181.         start_party_command_selection
  182.         return
  183.       end
  184.       @actor_index = (@actor_index + $game_party.members.size + n) % $game_party.members.size
  185.       @active_battler = $game_party.members[@actor_index]
  186.       if @active_battler.auto_battle
  187.         if n == 1
  188.           @active_battler.make_action
  189.           active_command_do(true)
  190.         end
  191.         next
  192.       end
  193.       if command_canceling and @active_battler.inputable?
  194.         active_command_do(false)
  195.         break
  196.       end
  197.       break if (@active_battler.cp_max? or n == -1) and
  198.                @active_battler.inputable? and not @active_battler.commanded
  199.       @active_battler = nil
  200.     end
  201.     start_actor_command_selection if @active_battler
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   # コマンドした行動を実行に移す判定(拡張用)
  205.   #--------------------------------------------------------------------------
  206.   def action_start?
  207.     return (@actor_index == ($game_party.members.size - 1))
  208.   end
  209.   #--------------------------------------------------------------------------
  210.   # アクティブバトラーのコマンド決定
  211.   #--------------------------------------------------------------------------
  212.   def active_command_do(decide = true)
  213.     if @active_battler != nil
  214.       if decide
  215.         command_done(@active_battler.action)
  216.       else #cancel
  217.         @active_battler.guarding = false
  218.         @active_battler.commanded = false
  219.         @active_actions.delete(@active_battler.action)
  220.         @active_battler.action.clear
  221.       end
  222.       @cp_spriteset.refresh(@active_actions + @charging_actions)
  223.       @active_battler.battlermotion_reset
  224.     end
  225.   end
  226.   #--------------------------------------------------------------------------
  227.   # コマンド決定と予約実行
  228.   #--------------------------------------------------------------------------
  229.   def command_done(action)
  230.     action.battler = @commanded_actor
  231.     action.orderer = @active_battler
  232.     if @active_battler and @active_battler != @commanded_actor
  233.       @active_battler.action = Game_BattleAction.new(@active_battler)
  234.     end
  235.     if action.quick?
  236.       @quick_action = action
  237.       rights_user = command_rights_user(action)
  238.       rights_user.guarding = false
  239.       rights_user.commanded = true
  240.       action.make_speed
  241.       cp_command_done(action)
  242.       @charging_actions.push(action)
  243.       make_action_orders
  244.       @cp_spriteset.refresh(@active_actions + @charging_actions)
  245.     end
  246.   end
  247.   def command_rights_user(action)
  248.     return @active_battler
  249.   end
  250.   def cp_command_done(action)
  251.   end
  252.   #--------------------------------------------------------------------------
  253.   # クイックコマンドによる行動後、コマンド更新に戻る
  254.   #--------------------------------------------------------------------------
  255.   def back_to_command_from_quick
  256.     quick_off!
  257.     @phase = 3
  258.     xcam_turn_refresh
  259.     @actor_index -= 1
  260.     actor_command_seach(1, false, false)
  261.   end
  262.   #--------------------------------------------------------------------------
  263.   # ● 戦闘処理の実行開始 *
  264.   #--------------------------------------------------------------------------
  265.   def start_main
  266.     if start_main_ok?
  267.       @phase = 4
  268.       @info_viewport.ox = 0
  269.       @message_window.visible = true
  270.       @actor_command_window.openness = 0
  271.       @status_window.index = -1
  272.       @actor_index = -1
  273.     end
  274.   end
  275.   def start_main_ok?
  276.     return (@active_actions.size >= 1)
  277.   end
  278. end
复制代码
Dpart:
  1. #==============================================================================
  2. # BaST - アクションストリーム
  3. #==============================================================================
  4. class Scene_Battle < Scene_Base
  5.   #--------------------------------------------------------------------------
  6.   # ● 次に行動するべきバトラーの設定 *
  7.   #--------------------------------------------------------------------------
  8.   def set_next_active_battler
  9.     if $game_troop.forcing_battler != nil
  10.       @active_battler = $game_troop.forcing_battler
  11.       @active_action = @active_battler.action
  12.       $game_troop.forcing_battler = nil
  13.     else
  14.       loop do
  15.         @active_action = @active_actions[0]
  16.         if @active_action == nil
  17.           @active_battler = nil
  18.           return
  19.         elsif @active_action.battler.index != nil
  20.           @active_battler = @active_action.battler
  21.           @active_battler.action = @active_action
  22.           return
  23.         end
  24.         @active_actions.shift
  25.       end
  26.     end
  27.   end
  28.   #--------------------------------------------------------------------------
  29.   # ● ターン終了 *
  30.   #--------------------------------------------------------------------------
  31.   def turn_end
  32.     turn_end_process1
  33.     turn_end_process2
  34.   end
  35.   def process_slip_recover
  36.     $game_party.slip_damage_effect
  37.     $game_troop.slip_damage_effect
  38.     $game_party.do_auto_recovery
  39.     @status_window.refresh
  40.   end
  41.   def process_turn_end_battle_event
  42.     $game_troop.turn_ending = true
  43.     process_battle_event
  44.     $game_troop.turn_ending = false
  45.   end
  46.   def turn_end_process1
  47.   end
  48.   def turn_end_process2
  49.     battlejump_back
  50.     $game_troop.increase_turn
  51.     $game_troop.preemptive = false
  52.     $game_troop.surprise = false
  53.     process_slip_recover
  54.     process_turn_end_battle_event
  55.     start_party_command_selection
  56.   end
  57.   #--------------------------------------------------------------------------
  58.   # EXP権利の設定
  59.   #--------------------------------------------------------------------------
  60.   def set_exp_rights(last_exist_enemies)
  61.     for enemy in $game_troop.members
  62.       for actor in $game_party.members
  63.         if not actor.dead? and not enemy.exp_rights.include?(actor)
  64.           enemy.exp_rights.push(actor)
  65.         end
  66.       end
  67.     end
  68.     new_defeated_enemies = last_exist_enemies - $game_troop.existing_members
  69.     for enemy in new_defeated_enemies
  70.       enemy.exp_mvp = @active_battler
  71.     end
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # クイックコマンドの処理
  75.   #--------------------------------------------------------------------------
  76.   def process_quick_action
  77.     @message_window.clear
  78.     @active_battler.white_flash = true
  79.     if @active_battler.action.valid?
  80.       execute_action
  81.     end
  82.     @active_battler.white_flash = false
  83.     @message_window.clear
  84.     clear_active_battler
  85.     battlejump_action_end
  86.     back_to_command_from_quick
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ● 戦闘行動の処理 *
  90.   #--------------------------------------------------------------------------
  91.   alias xrxsv9_process_action process_action
  92.   def process_action
  93.     @message_window.clear
  94.     @phase = 4
  95.     last_exist_enemies = $game_troop.existing_members
  96.     xrxsv9_process_action
  97.     # 情報のクリアとEXP権利情報
  98.     if @active_battler != nil and @active_action != nil
  99.       clear_active_battler
  100.       set_exp_rights(last_exist_enemies)
  101.       battlejump_action_end
  102.     end
  103.   end
  104.   #--------------------------------------------------------------------------
  105.   # 行動済みバトラーの情報をクリア
  106.   #--------------------------------------------------------------------------
  107.   def clear_active_battler
  108.     @active_actions.delete(@active_action)
  109.     if @active_action and @active_action.counter
  110.       @active_action.counter = false
  111.     else
  112.       active_battler_uncommanded
  113.       @active_action.clear if @active_action
  114.     end
  115.     @status_window.refresh
  116.     @enemyinfo_window.refresh
  117.     @cp_spriteset.refresh(@active_actions + @charging_actions)
  118.   end
  119.   #--------------------------------------------------------------------------
  120.   # コマンド済み状態の解除とCP更新
  121.   #--------------------------------------------------------------------------
  122.   def active_battler_uncommanded
  123.     @active_battler.commanded = false
  124.     unless @quick_mode
  125.       if @active_action.orderer and @active_action.orderer != @active_battler
  126.         @active_action.orderer.commanded = false
  127.         @active_action.orderer.cp_reset
  128.       else
  129.         @active_battler.cp_reset
  130.       end
  131.     end
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # ● 戦闘行動の実行 *
  135.   #--------------------------------------------------------------------------
  136.   alias xrxsv9_execute_action execute_action
  137.   def execute_action
  138.     process_before_execute_action if defined? process_before_execute_action
  139.     unless @quick_mode
  140.       @active_action_saved = @active_action
  141.       $game_temp.attacking_battler = @active_battler
  142.     end
  143.     xrxsv9_execute_action
  144.     battlermotion_reset
  145.     if XRXSV9::BattleEventActionSpan
  146.       $game_troop.clear_turn_battle_event
  147.     end
  148.     @active_action_saved = nil unless @quick_mode
  149.   end
  150.   #--------------------------------------------------------------------------
  151.   # ● 戦闘行動の実行 : 防御
  152.   #--------------------------------------------------------------------------
  153.   alias xrxsv9_execute_action_guard execute_action_guard
  154.   def execute_action_guard
  155.     xrxsv9_execute_action_guard
  156.     @active_battler.guarding = true
  157.   end
  158.   #--------------------------------------------------------------------------
  159.   # ● 戦闘行動の実行 : 逃走
  160.   #--------------------------------------------------------------------------
  161.   def execute_action_escape
  162.     if @active_battler.is_a?(Game_Actor)
  163.       process_escape
  164.     else
  165.       text = sprintf(Vocab::DoEscape, @active_battler.name)
  166.       @message_window.add_instant_text(text)
  167.       @active_battler.escape
  168.       Sound.play_escape
  169.       wait(45)
  170.     end
  171.   end
  172.   #--------------------------------------------------------------------------
  173.   # ● 戦闘行動の実行 : スキル
  174.   #--------------------------------------------------------------------------
  175.   alias xrxsv9_execute_action_skill execute_action_skill
  176.   def execute_action_skill
  177.     @message_window.set(@active_action.skill)
  178.     xrxsv9_execute_action_skill
  179.   end
  180.   #--------------------------------------------------------------------------
  181.   # ● 戦闘行動の実行 : アイテム
  182.   #--------------------------------------------------------------------------
  183.   alias xrxsv9_execute_action_item execute_action_item
  184.   def execute_action_item
  185.     @message_window.set(@active_action.item)
  186.     xrxsv9_execute_action_item
  187.     @energy_window.refresh if @energy_window
  188.   end
  189.   #--------------------------------------------------------------------------
  190.   # ● アイテムの決定 *
  191.   #--------------------------------------------------------------------------
  192.   alias xrxsv9_determine_item determine_item
  193.   def determine_item
  194.     if @item.materialized?
  195.       @active_battler.action.set_material(@item.material)
  196.     end
  197.     xrxsv9_determine_item
  198.   end
  199.   #--------------------------------------------------------------------------
  200.   # ○ 行動側アニメーションの表示
  201.   #--------------------------------------------------------------------------
  202.   def display_preanimation
  203.     animation_id = 0
  204.     skill = @active_battler.action.skill
  205.     if skill and skill.preanimation_id >= 1
  206.       animation_id = skill.preanimation_id
  207.     elsif @active_battler.action.magic_skill?
  208.       animation_id = XRXSV9::MagicPreanimationID
  209.     end
  210.     if animation_id >= 1
  211.       xcam_preanimation
  212.       display_normal_animation([@active_battler], animation_id)
  213.       case XRXSV9::PreanimationWaitCount
  214.       when 0
  215.         wait_for_animation!
  216.       else
  217.         XRXSV9::PreanimationWaitCount.times do
  218.           update_basic
  219.         end
  220.       end
  221.     end
  222.   end
  223.   #--------------------------------------------------------------------------
  224.   # ○ アニメーション表示が終わるまでウェイト(別名版)
  225.   #--------------------------------------------------------------------------
  226.   def wait_for_animation!
  227.     loop do
  228.       update_basic
  229.       return unless @spriteset.animation?
  230.     end
  231.   end
  232.   #--------------------------------------------------------------------------
  233.   # ● アニメーションの表示
  234.   #--------------------------------------------------------------------------
  235.   alias xrxsv9_display_animation display_animation
  236.   def display_animation(targets, animation_id)
  237.     xcam_animation_start(targets)
  238.     display_preanimation
  239.     xcam_animation(targets)
  240.     battlejump_for_targets(targets)
  241.     wait_for_xcam
  242.     wait_for_counter_time(targets) if defined? wait_for_counter_time
  243.     battlermotion_action
  244.     xrxsv9_display_animation(targets, animation_id)
  245.   end
  246.   alias xrxsv9_display_attack_animation display_attack_animation
  247.   def display_attack_animation(targets)
  248.     xcam_animation_start(targets)
  249.     display_preanimation
  250.     xcam_animation(targets)
  251.     battlejump_for_targets(targets)
  252.     wait_for_xcam
  253.     wait_for_counter_time(targets) if defined? wait_for_counter_time
  254.     battlermotion_action
  255.     xrxsv9_display_attack_animation(targets)
  256.   end
  257.   #--------------------------------------------------------------------------
  258.   # ● 行動結果の表示
  259.   #--------------------------------------------------------------------------
  260.   alias xrxsv9_display_action_effects display_action_effects
  261.   def display_action_effects(target, obj = nil)
  262.     clear_power(target) if defined? clear_power #*
  263.     xrxsv9_display_action_effects(target, obj)
  264.     if XRXSV9::BattleStatusRefreshAtEnd
  265.       @status_window.refresh_lite
  266.     else
  267.       @status_window.refresh
  268.     end
  269.     unless @quick_mode
  270.       $game_temp.attacking_battler = nil
  271.     end
  272.     #
  273.     process_additional_effects(target, obj)
  274.     #
  275.     @cp_spriteset.refresh
  276.     @target_enemy_window.refresh if @target_enemy_window
  277.     @target_actor_window.refresh if @target_actor_window
  278.     @skill_window.refresh        if @skill_window
  279.   end
  280. end
  281. #==============================================================================
  282. # BaST - コマンドセレクション
  283. #==============================================================================
  284. class Scene_Battle < Scene_Base
  285.   #--------------------------------------------------------------------------
  286.   # クイックコマンド選択の開始
  287.   #--------------------------------------------------------------------------
  288.   def start_quick_selection
  289.     @help_window = Window_BattleHelp.new
  290.     @quick_window = Window_BattleQuick.new(@active_battler)
  291.     @quick_window.help_window = @help_window
  292.     @actor_command_window.active = false
  293.     refresh_windows_by_selection
  294.     quick_on!
  295.   end
  296.   #--------------------------------------------------------------------------
  297.   # パーティスキル選択の開始
  298.   #--------------------------------------------------------------------------
  299.   def start_party_skill_selection
  300.     @help_window = Window_BattleHelp.new
  301.     @skill_window = Window_BattlePartySkill.new(@active_battler)
  302.     @skill_window.help_window = @help_window
  303.     @actor_command_window.active = false
  304.     refresh_windows_by_selection
  305.   end
  306.   #--------------------------------------------------------------------------
  307.   # トラッシュ選択の開始
  308.   #--------------------------------------------------------------------------
  309.   def start_trash_selection
  310.     @help_window = Window_BattleHelp.new
  311.     @trash_window = Window_BattleTrash.new
  312.     @trash_window.help_window = @help_window
  313.     @actor_command_window.active = false
  314.     refresh_windows_by_selection
  315.   end
  316.   #--------------------------------------------------------------------------
  317.   # ● スキル選択の開始 *
  318.   #--------------------------------------------------------------------------
  319.   def start_skill_selection
  320.     @help_window = Window_BattleHelp.new
  321.     @skill_window = Window_BattleSkill.new(@active_battler)
  322.     @skill_window.help_window = @help_window
  323.     @actor_command_window.active = false
  324.     refresh_windows_by_selection
  325.   end
  326.   #--------------------------------------------------------------------------
  327.   # ● アイテム選択の開始 *
  328.   #--------------------------------------------------------------------------
  329.   def start_item_selection
  330.     start_item_selection_with(Window_BattleItem.new)
  331.   end
  332.   def start_material_selection
  333.     start_item_selection_with(Window_BattleMaterial.new(@active_battler))
  334.   end
  335.   def start_party_material_selection
  336.     start_item_selection_with(Window_BattleMaterial.new($game_party))
  337.   end
  338.   def start_item_selection_with(window)
  339.     @help_window = Window_BattleHelp.new
  340.     @item_window = window
  341.     @item_window.help_window = @help_window
  342.     @actor_command_window.active = false
  343.     refresh_windows_by_selection
  344.   end
  345.   #--------------------------------------------------------------------------
  346.   # パーティスキル選択の更新
  347.   #--------------------------------------------------------------------------
  348.   def update_party_skill_selection
  349.     @skill_window.update
  350.     if Input.trigger?(Input::B)
  351.       Sound.play_cancel
  352.       end_skill_selection
  353.     elsif Input.trigger?(Input::C)
  354.       @skill = @skill_window.skill
  355.       @commanded_actor = @skill_window.user
  356.       if @skill == nil or @skill.for_guard?
  357.         Sound.play_buzzer
  358.         return
  359.       end
  360.       if @commanded_actor.skill_can_use?(@skill) and not @commanded_actor.commanded
  361.         Sound.play_decision
  362.         determine_party_skill
  363.       else
  364.         Sound.play_buzzer
  365.       end
  366.     end
  367.   end
  368.   #--------------------------------------------------------------------------
  369.   # パーティスキルの決定
  370.   #--------------------------------------------------------------------------
  371.   def determine_party_skill
  372.     @commanded_actor = @skill_window.user
  373.     @active_battler.action.set_skill(@skill.id)
  374.     @skill_window.active = false
  375.     if @skill.need_selection?
  376.       if @skill.for_opponent?
  377.         start_target_enemy_selection
  378.       else
  379.         start_target_actor_selection
  380.       end
  381.     else
  382.       end_skill_selection
  383.       next_actor
  384.     end
  385.   end
  386.   #--------------------------------------------------------------------------
  387.   # クイックコマンド選択の更新
  388.   #--------------------------------------------------------------------------
  389.   def update_quick_selection
  390.     @quick_window.update
  391.     if Input.trigger?(Input::B)
  392.       Sound.play_cancel
  393.       end_quick_selection
  394.       quick_off!
  395.     elsif Input.trigger?(Input::C)
  396.       if @quick_window.item_enable?
  397.         Sound.play_decision
  398.         determine_quick(@quick_window.item)
  399.       else
  400.         Sound.play_buzzer
  401.         return
  402.       end
  403.     end
  404.   end
  405.   #--------------------------------------------------------------------------
  406.   # トラッシュ選択の更新
  407.   #--------------------------------------------------------------------------
  408.   def update_trash_selection
  409.     @trash_window.update
  410.     if Input.trigger?(Input::B)
  411.       Sound.play_cancel
  412.       end_trash_selection
  413.     elsif Input.trigger?(Input::C)
  414.       Sound.play_buzzer
  415.     end
  416.   end
  417.   #--------------------------------------------------------------------------
  418.   # クイックスキルの決定
  419.   #--------------------------------------------------------------------------
  420.   def determine_quick(item)
  421.     @commanded_actor = @quick_window.user
  422.     if item.is_a?(RPG::Item)
  423.       if item.materialized?
  424.         @active_battler.action.set_material(item.material)
  425.       else
  426.         @active_battler.action.set_item(item.id)
  427.       end
  428.     else
  429.       @active_battler.action.set_skill(item.id)
  430.     end
  431.     @quick_window.active = false
  432.     if item.need_selection?
  433.       if item.for_opponent?
  434.         start_target_enemy_selection
  435.       else
  436.         start_target_actor_selection
  437.       end
  438.     else
  439.       end_quick_selection
  440.       next_actor
  441.     end
  442.   end
  443.   #--------------------------------------------------------------------------
  444.   # クイックコマンド選択の終了
  445.   #--------------------------------------------------------------------------
  446.   def end_quick_selection
  447.     if @quick_window != nil
  448.       @quick_window.dispose
  449.       @quick_window = nil
  450.     end
  451.     if @help_window != nil
  452.       @help_window.dispose
  453.       @help_window = nil
  454.     end
  455.     @actor_command_window.active = true
  456.     refresh_windows_by_selection
  457.   end
  458.   #--------------------------------------------------------------------------
  459.   # トラッシュ選択の終了
  460.   #--------------------------------------------------------------------------
  461.   def end_trash_selection
  462.     if @trash_window != nil
  463.       @trash_window.dispose
  464.       @trash_window = nil
  465.     end
  466.     if @help_window != nil
  467.       @help_window.dispose
  468.       @help_window = nil
  469.     end
  470.     @actor_command_window.active = true
  471.     refresh_windows_by_selection
  472.   end
  473.   #--------------------------------------------------------------------------
  474.   # ● アイテム選択の終了
  475.   #--------------------------------------------------------------------------
  476.   def end_item_selection
  477.     if @item_window != nil
  478.       @item_window.dispose
  479.       @item_window = nil
  480.     end
  481.     if @help_window != nil
  482.       @help_window.dispose
  483.       @help_window = nil
  484.     end
  485.     @actor_command_window.active = true
  486.     refresh_windows_by_selection
  487.   end
  488.   #--------------------------------------------------------------------------
  489.   # ● スキル選択の終了
  490.   #--------------------------------------------------------------------------
  491.   def end_skill_selection
  492.     if @skill_window != nil
  493.       @skill_window.dispose
  494.       @skill_window = nil
  495.     end
  496.     if @help_window != nil
  497.       @help_window.dispose
  498.       @help_window = nil
  499.     end
  500.     @actor_command_window.active = true
  501.     refresh_windows_by_selection
  502.   end
  503.   #--------------------------------------------------------------------------
  504.   # ● 対象アクター対象選択の開始 *
  505.   #--------------------------------------------------------------------------
  506.   def start_target_actor_selection
  507.     start_target_selection_window_hide
  508.     @target_actor_window = Window_TargetActor.new
  509.     @target_actor_window.z = 208
  510.     @target_actor_window.index = 0
  511.     @target_actor_window.active = true
  512.     @target_actor_window.y = @info_viewport.rect.y
  513.     @info_viewport.rect.x += @target_actor_window.width
  514.     @info_viewport.ox += @target_actor_window.width
  515.     @actor_command_window.active = false
  516.   end
  517.   #--------------------------------------------------------------------------
  518.   # ● 対象アクター選択の終了 *
  519.   #--------------------------------------------------------------------------
  520.   def end_target_actor_selection
  521.     refresh_windows_by_selection
  522.     if @target_actor_window != nil
  523.       @info_viewport.rect.x -= @target_actor_window.width
  524.       @info_viewport.ox -= @target_actor_window.width
  525.       @target_actor_window.dispose
  526.       @target_actor_window = nil
  527.     end
  528.   end
  529.   #--------------------------------------------------------------------------
  530.   # ● 対象敵キャラ選択の開始
  531.   #--------------------------------------------------------------------------
  532.   alias xrxsv9_start_target_enemy_selection start_target_enemy_selection
  533.   def start_target_enemy_selection
  534.     start_target_selection_window_hide
  535.     xrxsv9_start_target_enemy_selection
  536.     @target_enemy_window.z = 208
  537.   end
  538.   #--------------------------------------------------------------------------
  539.   # ● 対象敵キャラ選択の更新
  540.   #--------------------------------------------------------------------------
  541.   alias xrxsv9_update_target_enemy_selection update_target_enemy_selection
  542.   def update_target_enemy_selection
  543.     if Input.trigger?(Input::C) and @target_enemy_window.enemy == nil
  544.       Sound.play_buzzer
  545.       return
  546.     end
  547.     xrxsv9_update_target_enemy_selection
  548.   end
  549.   #--------------------------------------------------------------------------
  550.   # ● 対象敵キャラ選択の終了 *
  551.   #--------------------------------------------------------------------------
  552.   def end_target_enemy_selection
  553.     refresh_windows_by_selection
  554.     if @target_enemy_window != nil
  555.       @info_viewport.rect.x -= @target_enemy_window.width
  556.       @info_viewport.ox -= @target_enemy_window.width
  557.       @target_enemy_window.dispose
  558.       @target_enemy_window = nil
  559.     end
  560.     if @actor_command_window.index == 0
  561.       @actor_command_window.active = true
  562.     end
  563.   end
  564.   #--------------------------------------------------------------------------
  565.   # 敵味方ターゲット開始時のウィンドウ隠し
  566.   #--------------------------------------------------------------------------
  567.   def start_target_selection_window_hide
  568.     if @quick_window
  569.       @quick_window.visible = false
  570.       @help_window.visible = false
  571.       @commandset_window.set(@quick_window.item)
  572.     elsif @skill_window
  573.       @skill_window.visible = false
  574.       @help_window.visible = false
  575.       @commandset_window.set(@skill_window.skill)
  576.     elsif @item_window
  577.       @item_window.visible = false
  578.       @help_window.visible = false
  579.       @commandset_window.set(@item_window.item)
  580.     else
  581.       @actor_command_window.visible = false
  582.       @commandset_window.set(Vocab::attack)
  583.     end
  584.   end
  585.   #--------------------------------------------------------------------------
  586.   # コマンド状況によるウィンドウ配置リフレッシュ
  587.   #--------------------------------------------------------------------------
  588.   def refresh_windows_by_selection
  589.     if @quick_window
  590.       @actor_command_window.visible = false
  591.       @quick_window.visible = true
  592.       @quick_window.active = true
  593.       @help_window.visible = true if @help_window
  594.       @commandset_window.set(XRXSV9::S_QUICK)
  595.     elsif @trash_window
  596.       @actor_command_window.visible = false
  597.       @trash_window.visible = true
  598.       @trash_window.active = true
  599.       @help_window.visible = true if @help_window
  600.       @commandset_window.set(XRXSV9::S_TRASH)
  601.     elsif @skill_window
  602.       @actor_command_window.visible = false
  603.       @skill_window.visible = true
  604.       @help_window.visible = true if @help_window
  605.       case @actor_command_window.command_id
  606.       when 7
  607.         @commandset_window.set(XRXSV9::S_PSKILL)
  608.       else
  609.         @commandset_window.set(Vocab::skill)
  610.       end
  611.     elsif @item_window
  612.       @actor_command_window.visible = false
  613.       @item_window.visible = true
  614.       @help_window.visible = true if @help_window
  615.       case @actor_command_window.command_id
  616.       when 10
  617.         @commandset_window.set(XRXSV9::S_BAG)
  618.       when 11
  619.         @commandset_window.set(XRXSV9::S_PBAG)
  620.       else
  621.         @commandset_window.set(Vocab::item)
  622.       end
  623.     else
  624.       @actor_command_window.visible = true
  625.       @commandset_window.set(@active_battler)
  626.       @commandset_window.y = @actor_command_window.y - 36
  627.     end
  628.   end
  629.   #--------------------------------------------------------------------------
  630.   # 全ての選択を強制終了
  631.   #--------------------------------------------------------------------------
  632.   def end_all_selection
  633.     $game_temp.clear_battle_tone2
  634.     end_target_enemy_selection
  635.     end_target_actor_selection
  636.     end_quick_selection
  637.     end_spirits_selection if defined? end_spirits_selection
  638.     end_trash_selection
  639.     end_skill_selection
  640.     end_item_selection
  641.     @actor_command_window.active = false
  642.     @actor_command_window.visible = false
  643.     @actor_command_window.openness = 0
  644.     @status_window.index = -1
  645.     @commandset_window.clear
  646.     @commanding_action = nil
  647.   end
  648. end
  649. #==============================================================================
  650. # BaST - 戦闘終了~バトルリザルトへの自動対応
  651. #==============================================================================
  652. class Scene_Battle < Scene_Base
  653.   #--------------------------------------------------------------------------
  654.   # ● 勝利の処理
  655.   #--------------------------------------------------------------------------
  656.   def process_victory
  657.     end_all_selection
  658.     @phase = 5
  659.     @cp_active = false
  660.     @cp_spriteset.visible = false
  661.     battlejump_back
  662.     xcam_win
  663.     if $game_switches[XRXSV9::BattleEndSkipSwitchID] or
  664.        $game_switches[XRXSV9::BattleEndMapBGMMESkipSwitchID]
  665.       #
  666.     elsif battle_result_enabled?
  667.       $game_system.battle_end_bgm.play
  668.     else
  669.       $game_system.battle_end_me.play
  670.       unless $BTEST
  671.         $game_temp.map_bgm.play
  672.         $game_temp.map_bgs.play
  673.       end
  674.     end
  675.     battlermotion_victory
  676.     if battle_result_enabled?
  677.       battle_result_setting
  678.     else
  679.       display_exp_and_gold
  680.       display_drop_items
  681.       display_level_up
  682.     end
  683.     @message_window.close_force
  684.     wait(80)
  685.     battle_end(0)
  686.   end
  687.   def battlermotion_victory
  688.   end
  689.   #--------------------------------------------------------------------------
  690.   # バトルリザルト - 勝利獲得
  691.   #--------------------------------------------------------------------------
  692.   def battle_result_setting
  693.     $game_temp.battle_result_gold  = 0 unless $game_temp.battle_result_gold
  694.     $game_temp.battle_result_gold += $game_troop.gold_total
  695.     $game_temp.battle_result_tresures  = [] unless $game_temp.battle_result_tresures
  696.     $game_temp.battle_result_tresures += $game_troop.make_drop_items
  697.     $game_temp.battle_result_ap  = 0 unless $game_temp.battle_result_ap
  698.     $game_temp.battle_result_ap += $game_troop.ap_total rescue nil
  699.     if XRXSV9::DropItemMax >= 1
  700.       while $game_temp.battle_result_tresures.size > XRXSV9::DropItemMax
  701.         $game_temp.battle_result_tresures.shift
  702.       end
  703.     end
  704.     for enemy in $game_troop.dead_members
  705.       next if enemy.hidden
  706.       gain_actors = []
  707.       for actor in enemy.exp_rights
  708.         stated = false
  709.         for state_id in XRXSV9::EXPnStates
  710.           stated |= actor.state?(state_id)
  711.         end
  712.         gain_actors.push(actor) unless stated
  713.       end
  714.       n = [(gain_actors.size), XRXSV9::EXPRates.size - 1].min
  715.       for actor in gain_actors
  716.         m  = n
  717.         m -= 1 if actor == enemy.exp_mvp
  718.         m  = 0 if m < 0
  719.         get_exp = enemy.exp * XRXSV9::EXPRates[m] / 100
  720.         actor.battle_result_exp  = 0 unless actor.battle_result_exp
  721.         actor.battle_result_exp += get_exp
  722.       end
  723.     end
  724.   end
  725.   #--------------------------------------------------------------------------
  726.   # ● 逃走の処理 *
  727.   #--------------------------------------------------------------------------
  728.   def process_escape
  729.     if $game_troop.preemptive
  730.       success = true
  731.     else
  732.       success = (rand(100) < @escape_ratio)
  733.     end
  734.     if success
  735.       wait_for_jump
  736.       Sound.play_escape
  737.       text = sprintf(Vocab::EscapeStart, $game_party.name)
  738.       @message_window.add_instant_text(text)
  739.       battlejump_escape
  740.       @phase = 5
  741.       @cp_active = false
  742.       @cp_spriteset.visible = false
  743.       end_all_selection
  744.       wait(15)
  745.       battle_end(1)
  746.     else
  747.       @escape_ratio += 10
  748.       wait(15)
  749.       text = Vocab::EscapeFailure
  750.       @message_window.add_instant_text(text)
  751.       wait(40)
  752.     end
  753.   end
  754.   #--------------------------------------------------------------------------
  755.   # ● 敗北の処理
  756.   #--------------------------------------------------------------------------
  757.   def process_defeat
  758.     end_all_selection
  759.     @phase = 5
  760.     @cp_active = false
  761.     @cp_spriteset.visible = false
  762.     wait_for_jump
  763.     text = sprintf(Vocab::Defeat, $game_party.name)
  764.     @message_window.add_instant_text(text)
  765.     wait_for_message
  766.     wait(200)
  767.     battle_end(2)
  768.   end
  769.   #--------------------------------------------------------------------------
  770.   # ● 戦闘終了
  771.   #--------------------------------------------------------------------------
  772.   def battle_end(result)
  773.     end_all_selection
  774.     if result == 2 and not $game_troop.can_lose
  775.       call_gameover
  776.     else
  777.       $game_party.clear_actions
  778.       $game_party.remove_states_battle
  779.       $game_troop.clear
  780.       if $game_temp.battle_proc != nil
  781.         $game_temp.battle_proc.call(result)
  782.         $game_temp.battle_proc = nil
  783.       end
  784.       if result == 0 and battle_result_enabled? and
  785.          not $game_switches[XRXSV9::BattleEndSkipSwitchID]
  786.         $scene = Scene_BattleResult.new
  787.       else
  788.         unless $BTEST or $game_switches[XRXSV9::BattleEndMapBGMMESkipSwitchID]
  789.           $game_temp.map_bgm.play
  790.           $game_temp.map_bgs.play
  791.         end
  792.         $scene = Scene_Map.new
  793.         Graphics.fadeout(30)
  794.       end
  795.       @message_window.clear
  796.     end
  797.     $game_temp.in_battle = false
  798.   end
  799. end
  800. #==============================================================================
  801. # 一時シーン
  802. #==============================================================================
  803. class Game_Temp
  804.   attr_accessor :scene
  805.   def scene!(scene)
  806.     $game_temp.scene = scene
  807.     $game_temp.scene.main while $game_temp.scene != nil
  808.   end
  809. end
  810. module XRXSTempScene
  811.   def main
  812.     start                         # 開始処理
  813.     perform_transition            # トランジション実行
  814.     post_start                    # 開始後処理
  815.     Input.update                  # 入力情報を更新
  816.     loop do
  817.       Graphics.update             # ゲーム画面を更新
  818.       Input.update                # 入力情報を更新
  819.       update                      # フレーム更新
  820.       break if $game_temp.scene != self     # 画面が切り替わったらループを中断
  821.     end
  822.     Graphics.update
  823.     pre_terminate                 # 終了前処理
  824.     terminate                     # 終了処理
  825.   end
  826.   def return_scene
  827.     $game_temp.scene = nil
  828.   end
  829. end
  830. #==============================================================================
  831. # Temp装備画面
  832. #==============================================================================
  833. class Scene_BattleEquip < Scene_Equip
  834.   include XRXSTempScene
  835.   def return_scene
  836.     $game_temp.scene = nil
  837.   end
  838.   def start
  839.     super
  840.     n = 1001
  841.     @menuback2_sprite.z   += n if @menuback2_sprite
  842.     @actorstatus_window.z += n if @actorstatus_window
  843.     @status_window.z      += n
  844.     @equip_window.z       += n
  845.     @help_window.z        += n
  846.     @actorpicture_sprite.z += n if @actorpicture_sprite
  847.     for window in @item_windows
  848.       window.z += n
  849.     end
  850.   end
  851.   def go_status_scene
  852.   end
  853.   def next_actor
  854.   end
  855.   def prev_actor
  856.   end
  857. end
  858. #==============================================================================
  859. # Tempステータス画面
  860. #==============================================================================
  861. class Scene_BattleStatus < Scene_Status
  862.   include XRXSTempScene
  863.   def return_scene
  864.     $game_temp.scene = nil
  865.   end
  866.   def start
  867.     super
  868.     n = 1001
  869.     @menuback2_sprite.z    += n if @menuback2_sprite
  870.     @actorstatus_window.z  += n if @actorstatus_window
  871.     @status_window.z       += n if @status_window
  872.     @help_window.z         += n
  873.     @actorpicture_sprite.z += n if @actorpicture_sprite
  874.     @class_window.z        += n
  875.     @equipstatus_window.z  += n
  876.     @learnings_window.z    += n
  877.     @command_window.z      += n
  878.   end
  879.   def go_equip_scene
  880.   end
  881.   def next_actor
  882.   end
  883.   def prev_actor
  884.   end
  885. end

复制代码
从日站:http://xrxs.at-ninja.jp/
找到的一个脚本。
一个人战斗的话没问题,但一旦两个人战斗并且其中一个死掉,就会出现 第1888行 undifine method "gaurding = " for Nili:nileclass的错误。 (就是 Cpart 238 行)
已经试着回避,但结果就是不出错,直接卡死

最后放出最终必杀,求教 先谢谢各位大大了。

发完了。晕菜了...  


feizhaodan于2011-6-28 16:56补充以下内容:
自己顶一下。

这个是对我来说非常重要的一个脚本。
拜托各位了。


feizhaodan于2011-6-30 17:43补充以下内容:
啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊!!!!
我要自杀!!!!!!!!!!!!!!!!!!!!!dsu_plus_rewardpost_czw




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1