Project1
标题: 请教各位帮忙改一个脚本 [打印本页]
作者: feizhaodan 时间: 2011-6-26 13:43
标题: 请教各位帮忙改一个脚本
本帖最后由 feizhaodan 于 2011-6-26 14:04 编辑
Apart:- # ▽△▽ XRXSv9. BaST【バトルシステムテンプレート】VX. ▽△▽
- #
- # publish 2010/ 3/ 5
- # update - 11/ 2/16b
- #
- #==============================================================================
- # カスタマイズポイント - BaST本体
- #==============================================================================
- module XRXSV9
- #
- # バトルコマンド設定
- # 0 : 攻撃
- # 1 : スキル
- # 2 : ぼうぎょ
- # 3 : アイテム
- # 4 : 装備
- # 5 : ステータス
- # 6 : クイックコマンド
- # 7 : パーティスキル
- # 8 : にげる
- # 9 : ターン終了
- # 10 : 個人マテリアルバッグ
- # 11 : パーティマテリアルバッグ
- # 12 : アイテムトラッシュ確認
- #
- CommandIDs = [0, 1, 2, 3, 13 ,8]
- #
- # バトルコマンドの表示サイズ (VX標準 : 4)
- #
- CommandRow = 4
- #
- # [用語]
- #
- S_QUICK = "マジック "
- S_PSKILL = "アタック "
- S_TURNEND = "ターンエンド"
- S_BAG = "マイバッグ "
- S_PBAG = "アイテム "
- S_TRASH = "トラッシュ "
- #
- # [クイックコマンド機能]
- # ※メモ quick があるアイテム・スキルはクイックコマンドとして扱います。
- #
- # クイックコマンドを元のウインドウに表示しないようにする?
- #
- QuickListHiding = true
- #
- # 仲間のクイックコマンドを選択可能にする?
- #
- QuickFriendSupport = true
- #
- # クイックコマンド時の画面色調とBGM音量
- #
- QuickTone = Tone.new(-32,-40,0,96)
- QuickVolume = 60
- #
- #
- # [「行動側アニメーション」機能 ]
- #
- # 「魔法」と判定されるスキルに自動設定される行動側アニメーションID[一括設定]
- # ( 0 を指定するとアニメは再生されません)
- # ( メモ preanime[n] でn番を指定しているスキルはその指定が優先されます )
- #
- MagicPreanimationID = 0
- #
- # 行動側アニメーション再生時のウェイト時間指定[単位:F]
- # ( 0 を指定するとアニメ終了時まで待機します)
- #
- PreanimationWaitCount = 0
- #
- # 「勝利前バトルイベント」を有効にする?
- #
- NonJudgeBattleEvent = true
- #
- # 「アクションスパンイベント」を有効にする?
- # (有効な行動の終了時にバトルイベントスパン[ターン]をクリアします)
- #
- BattleEventActionSpan = false
- #
- # 勝利演出スキップ - スイッチID
- #
- BattleEndSkipSwitchID = 0
- #
- # 勝利BGM/ME+マップBGM復帰処理スキップ - スイッチID
- #
- BattleEndMapBGMMESkipSwitchID = 0
- #
- # コマンドポップSE
- #
- CommandPopSE = RPG::SE.new("", 80, 150)
- #
- # コマンドセットウィンドウを表示する?
- #
- CommandSetVisible = true
- #
- # 戦闘背景ファイル名接頭語(Graphics/Parallaxes)
- #
- BBMap = "Map"
- BBTrrain = "Terrain"
- #
- # 戦闘テストに使用する戦闘背景(Graphics/Parallaxes)
- #
- BBBTEST = "Map1"
- #
- # パトルステータスの内容更新をまとめて軽量化する?
- #
- BattleStatusRefreshAtEnd = true
- #
- # ターンコントローラー・トループインデックス
- #
- TCTI = 0
- #
- # 用語配列の作成
- #
- def self.command_names
- names = [
- Vocab::attack,
- Vocab::skill,
- Vocab::guard,
- Vocab::item,
- Vocab::equip,
- Vocab::status,
- XRXSV9::S_QUICK,
- XRXSV9::S_PSKILL,
- Vocab::escape,
- XRXSV9::S_TURNEND,
- XRXSV9::S_BAG,
- XRXSV9::S_PBAG,
- XRXSV9::S_TRASH,
- "队伍编辑"
- ]
- return names
- end
- end
- #==============================================================================
- # カスタマイズポイント - バトルリザルト専用
- #==============================================================================
- module XRXSV9
- #
- # 勝利BGMの初期設定(Audio/BGM)
- #
- BattleEndBGM = "Win"
- #
- # 人数によるEXPレート[単位:%]
- #
- EXPRates = [120, 100, 80, 67, 50]
- #
- # EXP獲得不可ステートID配列 ([]と空にすると戦闘不能でもEXP獲得します)
- #
- EXPnStates = [1]
- #
- # ドロップアイテム獲得・最大数制限(0だと制限しない)
- #
- DropItemMax = 0
- end
- #==============================================================================
- # 魔法?の判定
- #==============================================================================
- class Game_BattleAction
- def magic_skill?
- return (self.skill? and self.skill.magic?)
- end
- end
- class RPG::UsableItem
- def magic?
- return (self.spi_f >= 1 and not self.physical_attack)
- end
- end
- #==============================================================================
- # 各種設定
- #==============================================================================
- class Game_Temp
- attr_accessor :preemptive
- attr_accessor :surprise
- attr_accessor :turn_shift
- attr_accessor :link_done
- attr_accessor :battle_phase
- attr_accessor :attacking_battler
- attr_accessor :battle_timing_type
- def used_skill_hash
- @used_skill_hash ||= {}
- return @used_skill_hash
- end
- end
- #==============================================================================
- # BGM音量変化
- #==============================================================================
- module RPG
- class BGM < AudioFile
- @@last_volume = nil
- def self.volume_down
- @@last_volume = @@last.volume
- @@last.volume = XRXSV9::QuickVolume
- @@last.play
- end
- def self.volume_back
- if @@last_volume
- @@last.volume = @@last_volume
- @@last.play
- @@last_volume = nil
- end
- end
- end
- end
- #==============================================================================
- # スキルの行動側アニメーションIDの取得
- #==============================================================================
- module XRXSV9_SkillPreanimaion
- def preanimation_id
- self.note.gsub(/preanime[([0-9]+?)]/) do
- return $1.to_i if $1.to_i > 0
- end
- return 0
- end
- end
- class RPG::UsableItem
- include XRXSV9_SkillPreanimaion
- end
- #==============================================================================
- # アクターバトラーグラフィック
- #==============================================================================
- class Game_Battler
- def in_floor?
- return true
- end
- end
- class Game_Actor < Game_Battler
- def battler_name
- return ""
- end
- def battler_hue
- return 0
- end
- def in_floor?
- return false
- end
- def use_sprite?
- return true
- end
- def screen_x
- return self.battlestatus_x + self.battlestatus_offset
- end
- def screen_y
- return self.battlestatus_y
- end
- def screen_z
- return 101
- end
- end
- #==============================================================================
- # バトルスプライトセット/バトルトーン2
- #==============================================================================
- class Spriteset_Battle
- def create_actors
- @actor_sprites = []
- end
- alias xrxsv9_update_actors update_actors
- def update_actors
- for i in @actor_sprites.size...[$game_party.members.size, 4].max
- @actor_sprites[i] = Sprite_ActorBattler.new(@viewport1)
- end
- for i in 4...@actor_sprites.size
- @actor_sprites[i].battler = $game_party.members[i]
- end
- xrxsv9_update_actors
- end
- alias xrxsv9_update_viewports update_viewports
- def update_viewports
- $game_temp.battle_tone2_update
- @viewport2.tone = $game_temp.battle_tone2
- xrxsv9_update_viewports
- end
- end
- class Game_Temp
- def battle_tone2
- @battle_tone2 ||= Tone.new(0,0,0)
- return @battle_tone2
- end
- def battle_tone2_update
- @battle_tone2_duration ||= 0
- if @battle_tone2_duration >= 1
- d = @battle_tone2_duration
- @battle_tone2.red = (@battle_tone2.red * (d - 1) + @battle_tone2_target.red ) / d
- @battle_tone2.green = (@battle_tone2.green * (d - 1) + @battle_tone2_target.green) / d
- @battle_tone2.blue = (@battle_tone2.blue * (d - 1) + @battle_tone2_target.blue ) / d
- @battle_tone2.gray = (@battle_tone2.gray * (d - 1) + @battle_tone2_target.gray ) / d
- @battle_tone2_duration -= 1
- end
- end
- def start_battle_tone2_change(tone, duration)
- @battle_tone2_target = tone.clone
- @battle_tone2_duration = duration
- if @battle_tone2_duration == 0
- @battle_tone2 = @battle_tone2_target.clone
- end
- end
- def bluestop_battle_tone2
- start_battle_tone2_change(XRXSV9::QuickTone, 6)
- end
- def clear_battle_tone2
- start_battle_tone2_change(Tone.new(0,0,0), 6)
- end
- end
- #==============================================================================
- # アニメーションホールド/バトルメッセージホールド機能
- #==============================================================================
- class Sprite_Base < Sprite
- def animation_hold!
- @held_animation_set ||= []
- if self.animation?
- @held_animation_set.push([@animation, @animation_sprites, @animation_duration, @animation_bitmap1, @animation_bitmap2])
- @animation = nil
- @animation_sprites = nil
- @animation_duration = 0
- @animation_bitmap1 = nil
- @animation_bitmap2 = nil
- end
- end
- def animation_unhold!
- @held_animation_set ||= []
- set = @held_animation_set.shift
- if set
- dispose_animation
- @animation = set[0]
- @animation_sprites = set[1]
- @animation_duration = set[2]
- @animation_bitmap1 = set[3]
- @animation_bitmap2 = set[4]
- end
- end
- end
- class Spriteset_Battle
- def animation_hold!
- for sprite in @enemy_sprites + @actor_sprites do sprite.animation_hold! end
- end
- def animation_unhold!
- for sprite in @enemy_sprites + @actor_sprites do sprite.animation_unhold! end
- end
- end
- class Window_BattleMessage < Window_Message
- def message_hold!
- @held_lines ||= []
- @held_lines.push(@lines)
- @lines = []
- refresh
- end
- def message_unhold!
- @held_lines ||= []
- lines = @held_lines.shift
- if lines
- @lines = lines
- refresh
- end
- end
- end
- #==============================================================================
- # バトルカメラ対応
- #==============================================================================
- class XRXSV_BattleCam3D
- attr_accessor :lock
- def reverse?
- return false
- end
- def direction_angle
- return 2
- end
- def set_horize(active_battler, targets)
- end
- def watch(active_battler, targets)
- end
- def go_reset
- end
- end
- class Game_Temp
- def xcam
- @xcam ||= XRXSV_BattleCam3D.new
- return @xcam
- end
- end
- #==============================================================================
- # バトルカメラへの対応
- #==============================================================================
- class Sprite_Base < Sprite
- def update_battler_xcam
- end
- end
- module XRXSV9SceneBattleExForCam
- def update_battle_cam
- end
- def xcam_reset
- end
- def xcam_turn_refresh
- end
- def xcam_win
- end
- def xcam_animation_start(targets)
- end
- def xcam_preanimation
- end
- def xcam_animation(targets)
- end
- end
- class Scene_Battle < Scene_Base
- include XRXSV9SceneBattleExForCam
- end
- #==============================================================================
- # ダメージシェイクへの対応
- #==============================================================================
- class Sprite_Base
- def update_damageshake
- end
- end
- #==============================================================================
- # 各種対応 : スプライト+バトルジャンプ / バトラーモーション/自動回復
- #==============================================================================
- class Sprite_ActorBattler < Sprite_Battler
- def update_jumping
- end
- end
- module XRXSV9_inGameBattler
- def battlermotion_reset
- end
- def do_auto_recovery
- end
- def battlejjump_at_post?
- return true
- end
- def battler_initialize
- end
- end
- class Game_Battler
- include XRXSV9_inGameBattler
- end
- class Scene_Base
- def create_extra_windows
- end
- def dispose_extra_windows
- end
- end
- #==============================================================================
- # BaSTバトルシーン各種対応
- #==============================================================================
- module XRXSV9_inSceneBattle
- def cp_initialize
- end
- def wait_for_xcam
- end
- def open_timing_command(timing_type, targets)
- end
- def battlermotion_action
- end
- def battlermotion_reset
- end
- def battlejump_back
- end
- def battlejump_escape
- end
- def battlejump_for_targets(targets)
- end
- def battlejump_action_end
- end
- def wait_for_jump(battlers = self.members)
- end
- def allclear_power
- end
- def process_additional_effects(target, obj)
- end
- end
- class Scene_Battle < Scene_Base
- include XRXSV9_inSceneBattle
- end
- #==============================================================================
- # バトルステータス位置
- #==============================================================================
- class Window_BattleStatus < Window_Selectable
- def initialize
- super(128, 288, 416, 128)
- refresh
- self.active = false
- end
- def refresh_lite
- end
- end
- class Game_Battler
- def battlestatus_x(window_width = 416)
- return 0
- end
- def battlestatus_y
- return Graphics.height - 32
- end
- def battlestatus_offset
- return 0
- end
- def battlestatus_cp_x
- return self.battlestatus_x + self.battlestatus_offset
- end
- def battlestatus_cp_y
- return 400
- end
- end
- class Game_Actor < Game_Battler
- def battlestatus_x(window_width = 416)
- w = (window_width * Graphics.width / 544 - 32) / $game_party.members.size
- x = w * self.index
- x += w / 2
- return x
- end
- def battlestatus_offset
- return (128 * Graphics.width / 544) + 16
- end
- end
- class Scene_Battle < Scene_Base
- def battlestatus_offset
- return (128 * Graphics.width / 544) + 16
- end
- end
- #==============================================================================
- # バトル用ウィンドウ
- #==============================================================================
- class Window_TargetActor < Window_Command
- def initialize
- commands = []
- for actor in $game_party.members
- commands.push(actor.name)
- end
- super(416, commands, 2, 4)
- end
- end
- class Window_BattleSkill < Window_Skill
- def initialize(battler)
- super(0, 288, 544, 104, battler)
- self.z += 501
- end
- end
- class Window_BattleItem < Window_Item
- def initialize
- super(0, 288, 544, 104)
- self.z += 501
- end
- end
- class Window_BattleHelp < Window_Help
- def initialize
- super
- self.y = Graphics.height - self.height + 16
- self.z += 500
- end
- end
- if XRXSV9::QuickListHiding
- class Window_BattleSkill < Window_Skill
- def refresh
- @data = []
- for skill in @actor.skills
- next unless include?(skill)
- @data.push(skill)
- if skill.id == @actor.last_skill_id
- self.index = @data.size - 1
- end
- end
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- draw_item(i)
- end
- end
- def include?(skill)
- return false if skill and skill.quick?
- return true
- end
- end
- class Window_BattleItem < Window_Item
- def include?(item)
- return false if item and item.quick?
- return super(item)
- end
- end
- end
- class Window_BattleTrash < Window_BattleItem
- def refresh
- @data = []
- for material in $game_party.trash
- @data.push(material.item)
- end
- @data.push(nil) if include?(nil)
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- draw_item(i)
- end
- end
- def draw_item(index)
- rect = item_rect(index)
- self.contents.clear_rect(rect)
- item = @data[index]
- if item != nil
- rect.width -= 20
- draw_item_name(item, rect.x + 8, rect.y, false)
- end
- end
- end
- #==============================================================================
- # マテリアルバッグウィンドウ
- #==============================================================================
- class Window_BattleMaterial < Window_BattleItem
- def initialize(holder)
- @holder = holder
- super()
- end
- def refresh
- @data = []
- for material in @holder.bag
- @data.push(material.item)
- end
- @data.push(nil) if @data.size == 0
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #==============================================================================
- # アイテムマテリアル機能への対応
- #==============================================================================
- class Material
- end
- class RPG::BaseItem
- attr_accessor :material
- def materialized?
- return self.material.is_a?(Material)
- end
- end
- #==============================================================================
- # マテリアルバッグ/トラッシュ機能
- #==============================================================================
- class Game_Party < Game_Unit
- def bag
- @bag ||= []
- return @bag
- end
- def trash
- @trash ||= []
- return @trash
- end
- end
- class Game_Actor < Game_Battler
- def bag
- @bag ||= []
- return @bag
- end
- end
- #==============================================================================
- # アイテム・スキルのクイックコマンド判別
- #==============================================================================
- module RPG
- class BaseItem
- def quick?
- return (self.note.include?("quick"))
- end
- end
- end
- class Game_BattleAction
- def quick?
- return ((self.skill and self.skill.quick?) or
- (self.item and self.item.quick?))
- end
- end
- #==============================================================================
- # ナンバー描画への対応
- #==============================================================================
- module XRXSVForDNX
- def draw_number(x, y, width, height, number, align, skin, opacity = 224)
- self.draw_text(x, y, width, height, number, align)
- end
- def draw_number_l(x, y, width, height, number, align = 0)
- skin = Cache.system(XRXSVDsIn::NumberL) rescue nil
- self.draw_number(x, y, width, height, number, align, skin)
- end
- def draw_number_s(x, y, width, height, number, align = 0)
- skin = Cache.system(XRXSVDsIn::NumberS) rescue nil
- self.draw_number(x, y, width, height, number, align, skin)
- end
- end
- class Bitmap
- include XRXSVForDNX
- end
- #==============================================================================
- # 属性アイコンの描画への対応
- #==============================================================================
- class Window_Base < Window
- def draw_element_icon(element_id, x, y, enabled = true)
- icon_index = (XRXSV52::Icons rescue [])[element_id]
- draw_icon(icon_index, x, y, enabled) if icon_index
- end
- end
- #==============================================================================
- # バトル用ウィンドウ - クイック/パーティスキル/ガード 共通項目
- #==============================================================================
- class Window_BattlePartyAction < Window_BattleSkill
- def initialize(battler = nil)
- @battler = battler
- super(battler)
- @spacing = 12
- refresh
- end
- def setup(actor)
- @battler = actor
- refresh
- end
- def refresh
- refresh_data
- @item_max = @data.size
- create_contents
- for i in 0...@item_max
- draw_item(i)
- end
- end
- def user
- return @user[self.index]
- end
- def draw_item(index)
- item = @data[index]
- actor = @user[index]
- rect = item_rect(index)
- rect.x += 50
- rect.width -= 50
- self.contents.clear_rect(rect)
- en_costs = (item.en_costs rescue [])
- if item
- self.contents.blt(rect.x - 46, rect.y, actor.miniface, actor.miniface.rect) rescue nil
- self.contents.clear_rect(rect.x - 46, rect.y, 48, 1)
- self.contents.clear_rect(rect.x - 46, rect.y + 23, 48, 1)
- end
- if item.is_a?(RPG::Item)
- number = $game_party.item_number(item)
- enabled = enable?(item)
- rect.width -= 4
- draw_item_name(item, rect.x, rect.y, enabled)
- self.contents.draw_text(rect, sprintf(":%2d", number), 2)
- else
- skill = item
- rect.width -= 4
- if skill
- self.contents.font.size = 19
- enabled = enable_skill?(actor, skill)
- draw_item_name(skill, rect.x, rect.y, enabled)
- mp_cost = actor.calc_mp_cost(skill)
- if en_costs.empty? and mp_cost >= 1
- self.contents.draw_text(rect, mp_cost, 2)
- end
- else
- self.contents.draw_text(rect, nil_text())
- end
- end
- if en_costs.size >= 1
- x = rect.x + rect.width - 24 * en_costs.size
- for element_id in en_costs
- draw_element_icon(element_id, x, rect.y)
- x += 24
- end
- end
- end
- def nil_text()
- return "---"
- end
- #--------------------------------------------------------------------------
- # ○ アイテムの取得
- #--------------------------------------------------------------------------
- def item
- return @data[self.index]
- end
- #--------------------------------------------------------------------------
- # enable状態
- #--------------------------------------------------------------------------
- def enable?(item)
- return $game_party.item_can_use?(item)
- end
- def enable_skill?(actor, skill)
- return (actor.skill_can_use?(skill))
- end
- def item_enable?
- if self.item.is_a?(RPG::Skill)
- return self.user.skill_can_use?(item)
- elsif self.item.is_a?(RPG::Item)
- return $game_party.item_can_use?(item)
- end
- return true
- end
- end
- #==============================================================================
- # バトル用ウィンドウ - クイックコマンド
- #==============================================================================
- class Window_BattleQuick < Window_BattlePartyAction
- def refresh_data
- @data = []
- @user = []
- enable_set = []
- disable_set = []
- for actor in $game_party.members
- for material in (actor.bag rescue []) #for item in $game_party.items
- item = material.item
- if item.is_a?(RPG::Item) and item.occasion <= 1 and item.quick?
- enable_set.push([actor, item])
- end
- end
- end
- for actor in (XRXSV9::QuickFriendSupport ? $game_party.members : [@battler])
- for skill in actor.skills
- if skill.quick?
- if enable_skill?(actor, skill)
- enable_set.push([actor, skill])
- else
- disable_set.push([actor, skill])
- end
- end
- end
- end
- for set in enable_set + disable_set
- @user.push(set[0])
- @data.push(set[1])
- end
- end
- end
- #==============================================================================
- # バトル用ウィンドウ - パーティスキル
- #==============================================================================
- class Window_BattlePartySkill < Window_BattlePartyAction
- def refresh_data
- @data = []
- @user = []
- enable_set = []
- disable_set = []
- for actor in $game_party.members
- set1 = []
- set2 = []
- for skill in actor.skills
- if not skill.quick?
- if enable_skill?(actor, skill)
- set1.push(skill)
- else
- set2.push(skill)
- end
- end
- end
- if set1.empty? and set2.empty?
- set1.push(nil)
- end
- for skill in set1
- enable_set.push([actor, skill])
- end
- for skill in set2
- disable_set.push([actor, skill])
- end
- end
- for set in enable_set + disable_set
- @user.push(set[0])
- @data.push(set[1])
- end
- end
- def enable_skill?(actor, skill)
- return false if skill.for_guard?
- return (not actor.commanded and
- (skill == nil or actor.skill_can_use?(skill)))
- end
- end
- #==============================================================================
- # 戦闘背景の取得 (背景をビットマップで取得する)
- #==============================================================================
- class Game_Map
- def battleback
- $data_mapinfos = load_data("Data/MapInfos.rvdata") if $data_mapinfos.nil?
- id = self.map_id
- bitmap = nil
- while id >= 1
- name = XRXSV9::BBMap + id.to_s
- begin
- bitmap = Cache.parallax(name)
- break
- rescue
- nil
- end
- id = $data_mapinfos[id].parent_id
- end
- if bitmap == nil
- id = ($game_player.terrain_id rescue 0)
- if id >= 1
- name = XRXSV9::BBTrrain + id.to_s
- bitmap = Cache.parallax(name) rescue nil
- end
- end
- return bitmap
- end
- end
- #==============================================================================
- # バトラー設定 / 魔法の「詠唱セット」
- #==============================================================================
- class Game_Temp
- def commanded_battlers
- @commanded_battlers = [] if @commanded_battlers == nil
- return @commanded_battlers
- end
- end
- class Game_Battler
- attr_accessor :power_increase_turn
- attr_accessor :action
- def commanded
- return $game_temp.commanded_battlers.include?(self)
- end
- def commanded=(b)
- if b
- $game_temp.commanded_battlers.push(self)
- else
- $game_temp.commanded_battlers.delete(self)
- end
- end
- alias xrxsv9_skill_effective? skill_effective?
- def skill_effective?(user, skill)
- return false if user.action.blocked
- return xrxsv9_skill_effective?(user, skill)
- end
- end
- #==============================================================================
- # バトルアクション設定
- #==============================================================================
- class Game_BattleAction
- attr_accessor :counter
- attr_accessor :material
- attr_accessor :orderer
- attr_accessor :blocked
- attr_accessor :target_spirit
- #--------------------------------------------------------------------------
- # ● スキルオブジェクト取得
- #--------------------------------------------------------------------------
- alias xrxsv9_skill skill
- def skill
- return (@skill_obj ? @skill_obj : xrxsv9_skill)
- end
- #--------------------------------------------------------------------------
- # マテリアル機能ほか各種への対応
- #--------------------------------------------------------------------------
- alias xrxsv9_clear clear
- def clear
- xrxsv9_clear
- @material = nil
- @orderer = nil
- @skill_obj = nil
- @blocked = false
- @target_spirit = nil
- end
- def set_skill_obj(skill)
- @kind = 1
- @skill_obj = skill
- end
- def set_material(material)
- @kind = 2
- @material = material
- end
- def set_spell(material)
- @kind = 4
- @material = material
- end
- alias xrxsv9_item item
- def item
- return @material.item if @material
- return xrxsv9_item
- end
- #--------------------------------------------------------------------------
- # ○ 逃走を設定
- #--------------------------------------------------------------------------
- def set_escape
- @kind = 0
- @basic = 2
- end
- def escape?
- return (@kind == 0 and @basic == 2)
- end
- end
- #==============================================================================
- # CP機能 - 表示セットの基本形
- #==============================================================================
- class Spriteset_CP
- def initialize(members, info_viewport = nil)
- end
- def refresh(reserve_actions = nil)
- end
- def update
- end
- def visible=(b)
- end
- def opacity
- return 255
- end
- def opacity=(n)
- end
- def dispose
- end
- def reset_members(member)
- end
- end
- #==============================================================================
- # CP機能 - 対応
- #==============================================================================
- class Game_Battler
- def cp_per48
- return cp_per96/2
- end
- def cp_per96
- return 0 if self.dead?
- return 96
- end
- def cp_max?
- return true
- end
- def cp_reset
- end
- def cp_nillize
- end
- end
- #==============================================================================
- # ATB対応方式 - ガード/入力可能?
- #==============================================================================
- module XRXSV9BattlerATBNeeds
- attr_accessor :guarding
- def guarding?
- return self.guarding
- end
- def inputable?
- return (self.cp_max? and super)
- end
- end
- class Game_Actor < Game_Battler
- include XRXSV9BattlerATBNeeds
- end
- class Game_Enemy < Game_Battler
- include XRXSV9BattlerATBNeeds
- end
- #==============================================================================
- # バトルリザルト - データ
- #==============================================================================
- class Game_Temp
- attr_accessor :battle_result_gold
- attr_accessor :battle_result_tresures
- attr_accessor :battle_result_ap
- end
- class Game_Battler
- attr_accessor :battle_result_exp
- end
- #==============================================================================
- # バトルリザルト - EXP権利
- #==============================================================================
- class Game_Enemy < Game_Battler
- def exp_rights
- @exp_rights = [] if @exp_rights == nil
- return @exp_rights
- end
- attr_accessor :exp_mvp
- end
- #==============================================================================
- # バトルリザルト - BGMの取得と設定
- #==============================================================================
- class Game_System
- def battle_end_bgm=(battle_end_bgm)
- @battle_end_bgm = battle_end_bgm
- end
- def battle_end_bgm
- if @battle_end_bgm == nil
- return RPG::BGM.new(XRXSV9::BattleEndBGM) rescue nil
- else
- return @battle_end_bgm
- end
- end
- end
- #==============================================================================
- # バトルリザルト - 対応
- #==============================================================================
- module XRXSV9_SceneBattleTemplates
- def battle_result_enabled?
- return false
- end
- def actor_battler_initialize
- end
- end
- class Scene_Battle < Scene_Base
- include XRXSV9_SceneBattleTemplates
- end
- #==============================================================================
- # エネミーインフォウィンドウ
- #==============================================================================
- class Window_EnemyInfo < Window_Base
- def initialize
- super(0,0,36,36)
- self.opacity = 0
- end
- def refresh
- end
- end
- #==============================================================================
- # ■ バトルメッセージ
- #==============================================================================
- class Window_BattleMessage < Window_Message
- def last_instant_text
- return @lines[-1].to_s
- end
- def set(object)
- end
- def close_force
- @closing = true if self.openness > 0
- @opening = false
- end
- end
- #==============================================================================
- # ■ アクターコマンド [再定義]
- #==============================================================================
- class Window_ActorCommand < Window_Command
- def initialize
- @quick_one_mode = false
- @command_ids = XRXSV9::CommandIDs
- super(128, [], 1, XRXSV9::CommandRow)
- self.active = false
- self.openness = 0
- self.x = 0
- self.y = Graphics.height - self.height
- self.z = 204
- end
- def setup(actor)
- @command_ids = XRXSV9::CommandIDs
- names = XRXSV9.command_names
- if actor.class.skill_name_valid # スキルのコマンド名が有効?
- names[1] = actor.class.skill_name # コマンド名を置き換える
- end
- @commands = []
- for id in XRXSV9::CommandIDs
- @commands.push(names[id])
- end
- @item_max = @commands.size
- refresh
- escape_index = names.index(Vocab::escape)
- escape_index = XRXSV9::CommandIDs.index(escape_index.to_i)
- if escape_index
- draw_item(escape_index, ($game_troop.can_escape and not $game_temp.battle_phase))
- end
- self.index = 0
- @quick_one_mode = false
- end
- def command_id
- return @command_ids[self.index].to_i
- end
- def row_max
- return XRXSV9::CommandIDs.size
- end
- end
- #==============================================================================
- # コマンド確認ウィンドウ
- #==============================================================================
- class Window_ActorCommandSet < Window_Base
- if XRXSV9::CommandSetVisible
- def initialize
- x = 0
- y = 252
- w = 128
- h = 36
- @original_y = y
- @back_window = Window_Base.new(x, y, w, h)
- @back_window.contents.dispose
- super(x-16, y-16, w+32, h+32)
- self.visible = false
- self.opacity = 0
- self.z = 208
- @back_window.z = 105
- end
- def y=(n)
- @back_window.y = n
- super(n - 16)
- end
- def dispose
- @back_window.dispose
- super
- end
- def set(object)
- self.visible = true
- case object
- when RPG::Item, RPG::Skill
- draw_line(object.name)
- self.y = @original_y
- when Game_Battler
- draw_actor(object)
- else
- draw_line(object.to_s)
- self.y = @original_y
- end
- end
- def draw_actor(actor)
- self.contents.clear
- rect = self.contents.rect.dup
- rect.x += 8
- rect.width -= 16
- begin
- self.contents.blt(rect.x, 6, actor.miniface, actor.miniface.rect)
- rect.x += 48
- rect.width -= 48
- rescue
- nil
- end
- self.contents.draw_text(rect, actor.name, 1)
- end
- def draw_line(text)
- self.contents.clear
- rect = self.contents.rect
- self.contents.draw_text(rect.x + 8, rect.y, rect.width - 16, rect.height, text, 1)
- end
- def visible=(b)
- @back_window.visible = b
- super
- end
- else
- def initialize
- super(0, 0, 36, 36)
- self.visible = false
- end
- def set(object)
- end
- end
- def clear
- self.visible = false
- end
- end
- #==============================================================================
- # スパン[ターン]バトルベントのクリア
- #==============================================================================
- class Game_Troop < Game_Unit
- def clear_turn_battle_event
- for page in troop.pages
- if page.span == 1
- @event_flags= false
- end
- end
- end
- end
复制代码 Bpart:Cpart:- #==============================================================================
- # BaST - コマンドストリーム
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # ● パーティコマンド選択の開始 * (アクターコマンドフェイズの開始)
- #--------------------------------------------------------------------------
- def start_party_command_selection
- @party_command_window.active = false
- $game_temp.turn_shift ^= true
- @phase = 2
- xcam_turn_refresh
- end
- #--------------------------------------------------------------------------
- # ● アクターコマンド選択の開始
- #--------------------------------------------------------------------------
- alias xrxsv9_start_actor_command_selection start_actor_command_selection
- def start_actor_command_selection
- xrxsv9_start_actor_command_selection
- @commanding_action = Game_BattleAction.new(@active_battler)
- @active_battler.action = @commanding_action
- @actor_command_window.openness = 0
- @actor_command_window.active = true
- @actor_command_window.visible = true
- @status_window.index = @actor_index
- cp_start_actor_command
- @commandset_window.set(@active_battler)
- @commandset_window.y = @actor_command_window.y - 36
- end
- def cp_start_actor_command
- XRXSV9::CommandPopSE.play
- @cp_spriteset.refresh
- end
- #--------------------------------------------------------------------------
- # ● アクターコマンド選択の更新 *
- #--------------------------------------------------------------------------
- def update_actor_command_selection
- process_actor_command_selection
- end
- def process_actor_command_selection
- if @actor_command_window.openness < 255
- @actor_command_window.openness += 32
- end
- if Input.trigger?(Input::B)
- Sound.play_cancel
- prior_actor
- elsif Input.trigger?(Input::C)
- @commanded_actor = @active_battler
- case @actor_command_window.command_id
- when 0 # 攻撃
- Sound.play_decision
- @active_battler.action.set_attack
- start_target_enemy_selection
- when 1 # スキル
- Sound.play_decision
- start_skill_selection
- when 2 # 防御
- Sound.play_decision
- do_guard_command
- when 3 # アイテム
- Sound.play_decision
- start_item_selection
- when 4 # 装備
- Sound.play_decision
- $game_temp.scene!(Scene_BattleEquip.new(@actor_index, 0))
- when 5 # ステータス
- Sound.play_decision
- $game_temp.scene!(Scene_BattleStatus.new(@actor_index))
- when 6 # クイックコマンド
- Sound.play_decision
- start_quick_selection
- when 7 # パーティスキル
- Sound.play_decision
- start_party_skill_selection
- when 8 # 逃げる
- if $game_troop.can_escape == false or $game_temp.battle_phase
- Sound.play_buzzer
- return
- end
- Sound.play_decision
- process_escape_command
- when 9 # ターンエンド
- Sound.play_decision
- process_turn_end_command
- when 10 # 個別マテリアルバッグ
- start_material_selection
- when 11 # パーティ共通マテリアルバッグ
- start_party_material_selection
- when 13 # パーティ編成画面に移行
- unless $game_party.battle_partyform_enable?
- Sound.play_buzzer
- return
- end
- Sound.play_decision
- process_partyform
- return
- when 12 # アイテムトラッシュ
- start_trash_selection
- when 14 # 精霊召喚装着
- if $game_temp.link_done or $game_temp.battle_phase
- Sound.play_buzzer
- return
- end
- start_spirit_selection rescue nil
- end
- end
- update_actor_command_selection_ex
- end
- def update_actor_command_selection_ex
- end
- def process_turn_end_command
- actor_command_close
- start_main
- end
- def process_escape_command
- @active_battler.action.set_escape
- next_actor
- end
- def process_partyform
- Graphics.freeze
- snapshot_for_background
- $scene = Scene_PartyForm.new(0, Scene_PartyForm::HOST_BATTLE)
- $scene.main
- $scene = self
- @status_window.refresh
- perform_transition
- end
- #--------------------------------------------------------------------------
- # 防御コマンドの実行
- #--------------------------------------------------------------------------
- def do_guard_command
- @active_battler.action.set_guard
- next_actor
- end
- #--------------------------------------------------------------------------
- # ● 次のアクターのコマンド入力へ *
- #--------------------------------------------------------------------------
- def next_actor
- end_quick_selection
- if @actor_index >= 0
- active_command_do(true)
- end
- if @quick_mode
- actor_command_close
- else
- actor_command_seach(1, true, false)
- end
- end
- #--------------------------------------------------------------------------
- # ● 前のアクターのコマンド入力へ *
- #--------------------------------------------------------------------------
- def prior_actor
- actor_command_seach(-1, false, true)
- end
- #--------------------------------------------------------------------------
- # 現在のアクターコマンドを閉じる
- #--------------------------------------------------------------------------
- def actor_command_close
- @actor_command_window.openness = 0
- @actor_command_window.active = false
- @commandset_window.clear
- @status_window.index = -1
- @commanding_action = nil
- end
- #--------------------------------------------------------------------------
- # アクターコマンド判定サーチ
- #--------------------------------------------------------------------------
- def actor_command_seach(n, command_deciding, command_canceling)
- actor_command_close
- @actor_index = -1 if @actor_index <= -2
- if $game_party.members.size <= 0
- return
- end
- ($game_party.members.size + 1).times do
- if n == 1
- if actor_command_stop? or (command_deciding and action_start?)
- start_main
- return
- end
- elsif n == -1 and command_canceling and @actor_index == 0
- start_party_command_selection
- return
- end
- @actor_index = (@actor_index + $game_party.members.size + n) % $game_party.members.size
- @active_battler = $game_party.members[@actor_index]
- if @active_battler.auto_battle
- if n == 1
- @active_battler.make_action
- active_command_do(true)
- end
- next
- end
- if command_canceling and @active_battler.inputable?
- active_command_do(false)
- break
- end
- break if (@active_battler.cp_max? or n == -1) and
- @active_battler.inputable? and not @active_battler.commanded
- @active_battler = nil
- end
- start_actor_command_selection if @active_battler
- end
- #--------------------------------------------------------------------------
- # コマンドした行動を実行に移す判定(拡張用)
- #--------------------------------------------------------------------------
- def action_start?
- return (@actor_index == ($game_party.members.size - 1))
- end
- #--------------------------------------------------------------------------
- # アクティブバトラーのコマンド決定
- #--------------------------------------------------------------------------
- def active_command_do(decide = true)
- if @active_battler != nil
- if decide
- command_done(@active_battler.action)
- else #cancel
- @active_battler.guarding = false
- @active_battler.commanded = false
- @active_actions.delete(@active_battler.action)
- @active_battler.action.clear
- end
- @cp_spriteset.refresh(@active_actions + @charging_actions)
- @active_battler.battlermotion_reset
- end
- end
- #--------------------------------------------------------------------------
- # コマンド決定と予約実行
- #--------------------------------------------------------------------------
- def command_done(action)
- action.battler = @commanded_actor
- action.orderer = @active_battler
- if @active_battler and @active_battler != @commanded_actor
- @active_battler.action = Game_BattleAction.new(@active_battler)
- end
- if action.quick?
- @quick_action = action
- rights_user = command_rights_user(action)
- rights_user.guarding = false
- rights_user.commanded = true
- action.make_speed
- cp_command_done(action)
- @charging_actions.push(action)
- make_action_orders
- @cp_spriteset.refresh(@active_actions + @charging_actions)
- end
- end
- def command_rights_user(action)
- return @active_battler
- end
- def cp_command_done(action)
- end
- #--------------------------------------------------------------------------
- # クイックコマンドによる行動後、コマンド更新に戻る
- #--------------------------------------------------------------------------
- def back_to_command_from_quick
- quick_off!
- @phase = 3
- xcam_turn_refresh
- @actor_index -= 1
- actor_command_seach(1, false, false)
- end
- #--------------------------------------------------------------------------
- # ● 戦闘処理の実行開始 *
- #--------------------------------------------------------------------------
- def start_main
- if start_main_ok?
- @phase = 4
- @info_viewport.ox = 0
- @message_window.visible = true
- @actor_command_window.openness = 0
- @status_window.index = -1
- @actor_index = -1
- end
- end
- def start_main_ok?
- return (@active_actions.size >= 1)
- end
- end
复制代码 Dpart:- #==============================================================================
- # BaST - アクションストリーム
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # ● 次に行動するべきバトラーの設定 *
- #--------------------------------------------------------------------------
- def set_next_active_battler
- if $game_troop.forcing_battler != nil
- @active_battler = $game_troop.forcing_battler
- @active_action = @active_battler.action
- $game_troop.forcing_battler = nil
- else
- loop do
- @active_action = @active_actions[0]
- if @active_action == nil
- @active_battler = nil
- return
- elsif @active_action.battler.index != nil
- @active_battler = @active_action.battler
- @active_battler.action = @active_action
- return
- end
- @active_actions.shift
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● ターン終了 *
- #--------------------------------------------------------------------------
- def turn_end
- turn_end_process1
- turn_end_process2
- end
- def process_slip_recover
- $game_party.slip_damage_effect
- $game_troop.slip_damage_effect
- $game_party.do_auto_recovery
- @status_window.refresh
- end
- def process_turn_end_battle_event
- $game_troop.turn_ending = true
- process_battle_event
- $game_troop.turn_ending = false
- end
- def turn_end_process1
- end
- def turn_end_process2
- battlejump_back
- $game_troop.increase_turn
- $game_troop.preemptive = false
- $game_troop.surprise = false
- process_slip_recover
- process_turn_end_battle_event
- start_party_command_selection
- end
- #--------------------------------------------------------------------------
- # EXP権利の設定
- #--------------------------------------------------------------------------
- def set_exp_rights(last_exist_enemies)
- for enemy in $game_troop.members
- for actor in $game_party.members
- if not actor.dead? and not enemy.exp_rights.include?(actor)
- enemy.exp_rights.push(actor)
- end
- end
- end
- new_defeated_enemies = last_exist_enemies - $game_troop.existing_members
- for enemy in new_defeated_enemies
- enemy.exp_mvp = @active_battler
- end
- end
- #--------------------------------------------------------------------------
- # クイックコマンドの処理
- #--------------------------------------------------------------------------
- def process_quick_action
- @message_window.clear
- @active_battler.white_flash = true
- if @active_battler.action.valid?
- execute_action
- end
- @active_battler.white_flash = false
- @message_window.clear
- clear_active_battler
- battlejump_action_end
- back_to_command_from_quick
- end
- #--------------------------------------------------------------------------
- # ● 戦闘行動の処理 *
- #--------------------------------------------------------------------------
- alias xrxsv9_process_action process_action
- def process_action
- @message_window.clear
- @phase = 4
- last_exist_enemies = $game_troop.existing_members
- xrxsv9_process_action
- # 情報のクリアとEXP権利情報
- if @active_battler != nil and @active_action != nil
- clear_active_battler
- set_exp_rights(last_exist_enemies)
- battlejump_action_end
- end
- end
- #--------------------------------------------------------------------------
- # 行動済みバトラーの情報をクリア
- #--------------------------------------------------------------------------
- def clear_active_battler
- @active_actions.delete(@active_action)
- if @active_action and @active_action.counter
- @active_action.counter = false
- else
- active_battler_uncommanded
- @active_action.clear if @active_action
- end
- @status_window.refresh
- @enemyinfo_window.refresh
- @cp_spriteset.refresh(@active_actions + @charging_actions)
- end
- #--------------------------------------------------------------------------
- # コマンド済み状態の解除とCP更新
- #--------------------------------------------------------------------------
- def active_battler_uncommanded
- @active_battler.commanded = false
- unless @quick_mode
- if @active_action.orderer and @active_action.orderer != @active_battler
- @active_action.orderer.commanded = false
- @active_action.orderer.cp_reset
- else
- @active_battler.cp_reset
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 戦闘行動の実行 *
- #--------------------------------------------------------------------------
- alias xrxsv9_execute_action execute_action
- def execute_action
- process_before_execute_action if defined? process_before_execute_action
- unless @quick_mode
- @active_action_saved = @active_action
- $game_temp.attacking_battler = @active_battler
- end
- xrxsv9_execute_action
- battlermotion_reset
- if XRXSV9::BattleEventActionSpan
- $game_troop.clear_turn_battle_event
- end
- @active_action_saved = nil unless @quick_mode
- end
- #--------------------------------------------------------------------------
- # ● 戦闘行動の実行 : 防御
- #--------------------------------------------------------------------------
- alias xrxsv9_execute_action_guard execute_action_guard
- def execute_action_guard
- xrxsv9_execute_action_guard
- @active_battler.guarding = true
- end
- #--------------------------------------------------------------------------
- # ● 戦闘行動の実行 : 逃走
- #--------------------------------------------------------------------------
- def execute_action_escape
- if @active_battler.is_a?(Game_Actor)
- process_escape
- else
- text = sprintf(Vocab::DoEscape, @active_battler.name)
- @message_window.add_instant_text(text)
- @active_battler.escape
- Sound.play_escape
- wait(45)
- end
- end
- #--------------------------------------------------------------------------
- # ● 戦闘行動の実行 : スキル
- #--------------------------------------------------------------------------
- alias xrxsv9_execute_action_skill execute_action_skill
- def execute_action_skill
- @message_window.set(@active_action.skill)
- xrxsv9_execute_action_skill
- end
- #--------------------------------------------------------------------------
- # ● 戦闘行動の実行 : アイテム
- #--------------------------------------------------------------------------
- alias xrxsv9_execute_action_item execute_action_item
- def execute_action_item
- @message_window.set(@active_action.item)
- xrxsv9_execute_action_item
- @energy_window.refresh if @energy_window
- end
- #--------------------------------------------------------------------------
- # ● アイテムの決定 *
- #--------------------------------------------------------------------------
- alias xrxsv9_determine_item determine_item
- def determine_item
- if @item.materialized?
- @active_battler.action.set_material(@item.material)
- end
- xrxsv9_determine_item
- end
- #--------------------------------------------------------------------------
- # ○ 行動側アニメーションの表示
- #--------------------------------------------------------------------------
- def display_preanimation
- animation_id = 0
- skill = @active_battler.action.skill
- if skill and skill.preanimation_id >= 1
- animation_id = skill.preanimation_id
- elsif @active_battler.action.magic_skill?
- animation_id = XRXSV9::MagicPreanimationID
- end
- if animation_id >= 1
- xcam_preanimation
- display_normal_animation([@active_battler], animation_id)
- case XRXSV9::PreanimationWaitCount
- when 0
- wait_for_animation!
- else
- XRXSV9::PreanimationWaitCount.times do
- update_basic
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ○ アニメーション表示が終わるまでウェイト(別名版)
- #--------------------------------------------------------------------------
- def wait_for_animation!
- loop do
- update_basic
- return unless @spriteset.animation?
- end
- end
- #--------------------------------------------------------------------------
- # ● アニメーションの表示
- #--------------------------------------------------------------------------
- alias xrxsv9_display_animation display_animation
- def display_animation(targets, animation_id)
- xcam_animation_start(targets)
- display_preanimation
- xcam_animation(targets)
- battlejump_for_targets(targets)
- wait_for_xcam
- wait_for_counter_time(targets) if defined? wait_for_counter_time
- battlermotion_action
- xrxsv9_display_animation(targets, animation_id)
- end
- alias xrxsv9_display_attack_animation display_attack_animation
- def display_attack_animation(targets)
- xcam_animation_start(targets)
- display_preanimation
- xcam_animation(targets)
- battlejump_for_targets(targets)
- wait_for_xcam
- wait_for_counter_time(targets) if defined? wait_for_counter_time
- battlermotion_action
- xrxsv9_display_attack_animation(targets)
- end
- #--------------------------------------------------------------------------
- # ● 行動結果の表示
- #--------------------------------------------------------------------------
- alias xrxsv9_display_action_effects display_action_effects
- def display_action_effects(target, obj = nil)
- clear_power(target) if defined? clear_power #*
- xrxsv9_display_action_effects(target, obj)
- if XRXSV9::BattleStatusRefreshAtEnd
- @status_window.refresh_lite
- else
- @status_window.refresh
- end
- unless @quick_mode
- $game_temp.attacking_battler = nil
- end
- #
- process_additional_effects(target, obj)
- #
- @cp_spriteset.refresh
- @target_enemy_window.refresh if @target_enemy_window
- @target_actor_window.refresh if @target_actor_window
- @skill_window.refresh if @skill_window
- end
- end
- #==============================================================================
- # BaST - コマンドセレクション
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # クイックコマンド選択の開始
- #--------------------------------------------------------------------------
- def start_quick_selection
- @help_window = Window_BattleHelp.new
- @quick_window = Window_BattleQuick.new(@active_battler)
- @quick_window.help_window = @help_window
- @actor_command_window.active = false
- refresh_windows_by_selection
- quick_on!
- end
- #--------------------------------------------------------------------------
- # パーティスキル選択の開始
- #--------------------------------------------------------------------------
- def start_party_skill_selection
- @help_window = Window_BattleHelp.new
- @skill_window = Window_BattlePartySkill.new(@active_battler)
- @skill_window.help_window = @help_window
- @actor_command_window.active = false
- refresh_windows_by_selection
- end
- #--------------------------------------------------------------------------
- # トラッシュ選択の開始
- #--------------------------------------------------------------------------
- def start_trash_selection
- @help_window = Window_BattleHelp.new
- @trash_window = Window_BattleTrash.new
- @trash_window.help_window = @help_window
- @actor_command_window.active = false
- refresh_windows_by_selection
- end
- #--------------------------------------------------------------------------
- # ● スキル選択の開始 *
- #--------------------------------------------------------------------------
- def start_skill_selection
- @help_window = Window_BattleHelp.new
- @skill_window = Window_BattleSkill.new(@active_battler)
- @skill_window.help_window = @help_window
- @actor_command_window.active = false
- refresh_windows_by_selection
- end
- #--------------------------------------------------------------------------
- # ● アイテム選択の開始 *
- #--------------------------------------------------------------------------
- def start_item_selection
- start_item_selection_with(Window_BattleItem.new)
- end
- def start_material_selection
- start_item_selection_with(Window_BattleMaterial.new(@active_battler))
- end
- def start_party_material_selection
- start_item_selection_with(Window_BattleMaterial.new($game_party))
- end
- def start_item_selection_with(window)
- @help_window = Window_BattleHelp.new
- @item_window = window
- @item_window.help_window = @help_window
- @actor_command_window.active = false
- refresh_windows_by_selection
- end
- #--------------------------------------------------------------------------
- # パーティスキル選択の更新
- #--------------------------------------------------------------------------
- def update_party_skill_selection
- @skill_window.update
- if Input.trigger?(Input::B)
- Sound.play_cancel
- end_skill_selection
- elsif Input.trigger?(Input::C)
- @skill = @skill_window.skill
- @commanded_actor = @skill_window.user
- if @skill == nil or @skill.for_guard?
- Sound.play_buzzer
- return
- end
- if @commanded_actor.skill_can_use?(@skill) and not @commanded_actor.commanded
- Sound.play_decision
- determine_party_skill
- else
- Sound.play_buzzer
- end
- end
- end
- #--------------------------------------------------------------------------
- # パーティスキルの決定
- #--------------------------------------------------------------------------
- def determine_party_skill
- @commanded_actor = @skill_window.user
- @active_battler.action.set_skill(@skill.id)
- @skill_window.active = false
- if @skill.need_selection?
- if @skill.for_opponent?
- start_target_enemy_selection
- else
- start_target_actor_selection
- end
- else
- end_skill_selection
- next_actor
- end
- end
- #--------------------------------------------------------------------------
- # クイックコマンド選択の更新
- #--------------------------------------------------------------------------
- def update_quick_selection
- @quick_window.update
- if Input.trigger?(Input::B)
- Sound.play_cancel
- end_quick_selection
- quick_off!
- elsif Input.trigger?(Input::C)
- if @quick_window.item_enable?
- Sound.play_decision
- determine_quick(@quick_window.item)
- else
- Sound.play_buzzer
- return
- end
- end
- end
- #--------------------------------------------------------------------------
- # トラッシュ選択の更新
- #--------------------------------------------------------------------------
- def update_trash_selection
- @trash_window.update
- if Input.trigger?(Input::B)
- Sound.play_cancel
- end_trash_selection
- elsif Input.trigger?(Input::C)
- Sound.play_buzzer
- end
- end
- #--------------------------------------------------------------------------
- # クイックスキルの決定
- #--------------------------------------------------------------------------
- def determine_quick(item)
- @commanded_actor = @quick_window.user
- if item.is_a?(RPG::Item)
- if item.materialized?
- @active_battler.action.set_material(item.material)
- else
- @active_battler.action.set_item(item.id)
- end
- else
- @active_battler.action.set_skill(item.id)
- end
- @quick_window.active = false
- if item.need_selection?
- if item.for_opponent?
- start_target_enemy_selection
- else
- start_target_actor_selection
- end
- else
- end_quick_selection
- next_actor
- end
- end
- #--------------------------------------------------------------------------
- # クイックコマンド選択の終了
- #--------------------------------------------------------------------------
- def end_quick_selection
- if @quick_window != nil
- @quick_window.dispose
- @quick_window = nil
- end
- if @help_window != nil
- @help_window.dispose
- @help_window = nil
- end
- @actor_command_window.active = true
- refresh_windows_by_selection
- end
- #--------------------------------------------------------------------------
- # トラッシュ選択の終了
- #--------------------------------------------------------------------------
- def end_trash_selection
- if @trash_window != nil
- @trash_window.dispose
- @trash_window = nil
- end
- if @help_window != nil
- @help_window.dispose
- @help_window = nil
- end
- @actor_command_window.active = true
- refresh_windows_by_selection
- end
- #--------------------------------------------------------------------------
- # ● アイテム選択の終了
- #--------------------------------------------------------------------------
- def end_item_selection
- if @item_window != nil
- @item_window.dispose
- @item_window = nil
- end
- if @help_window != nil
- @help_window.dispose
- @help_window = nil
- end
- @actor_command_window.active = true
- refresh_windows_by_selection
- end
- #--------------------------------------------------------------------------
- # ● スキル選択の終了
- #--------------------------------------------------------------------------
- def end_skill_selection
- if @skill_window != nil
- @skill_window.dispose
- @skill_window = nil
- end
- if @help_window != nil
- @help_window.dispose
- @help_window = nil
- end
- @actor_command_window.active = true
- refresh_windows_by_selection
- end
- #--------------------------------------------------------------------------
- # ● 対象アクター対象選択の開始 *
- #--------------------------------------------------------------------------
- def start_target_actor_selection
- start_target_selection_window_hide
- @target_actor_window = Window_TargetActor.new
- @target_actor_window.z = 208
- @target_actor_window.index = 0
- @target_actor_window.active = true
- @target_actor_window.y = @info_viewport.rect.y
- @info_viewport.rect.x += @target_actor_window.width
- @info_viewport.ox += @target_actor_window.width
- @actor_command_window.active = false
- end
- #--------------------------------------------------------------------------
- # ● 対象アクター選択の終了 *
- #--------------------------------------------------------------------------
- def end_target_actor_selection
- refresh_windows_by_selection
- if @target_actor_window != nil
- @info_viewport.rect.x -= @target_actor_window.width
- @info_viewport.ox -= @target_actor_window.width
- @target_actor_window.dispose
- @target_actor_window = nil
- end
- end
- #--------------------------------------------------------------------------
- # ● 対象敵キャラ選択の開始
- #--------------------------------------------------------------------------
- alias xrxsv9_start_target_enemy_selection start_target_enemy_selection
- def start_target_enemy_selection
- start_target_selection_window_hide
- xrxsv9_start_target_enemy_selection
- @target_enemy_window.z = 208
- end
- #--------------------------------------------------------------------------
- # ● 対象敵キャラ選択の更新
- #--------------------------------------------------------------------------
- alias xrxsv9_update_target_enemy_selection update_target_enemy_selection
- def update_target_enemy_selection
- if Input.trigger?(Input::C) and @target_enemy_window.enemy == nil
- Sound.play_buzzer
- return
- end
- xrxsv9_update_target_enemy_selection
- end
- #--------------------------------------------------------------------------
- # ● 対象敵キャラ選択の終了 *
- #--------------------------------------------------------------------------
- def end_target_enemy_selection
- refresh_windows_by_selection
- if @target_enemy_window != nil
- @info_viewport.rect.x -= @target_enemy_window.width
- @info_viewport.ox -= @target_enemy_window.width
- @target_enemy_window.dispose
- @target_enemy_window = nil
- end
- if @actor_command_window.index == 0
- @actor_command_window.active = true
- end
- end
- #--------------------------------------------------------------------------
- # 敵味方ターゲット開始時のウィンドウ隠し
- #--------------------------------------------------------------------------
- def start_target_selection_window_hide
- if @quick_window
- @quick_window.visible = false
- @help_window.visible = false
- @commandset_window.set(@quick_window.item)
- elsif @skill_window
- @skill_window.visible = false
- @help_window.visible = false
- @commandset_window.set(@skill_window.skill)
- elsif @item_window
- @item_window.visible = false
- @help_window.visible = false
- @commandset_window.set(@item_window.item)
- else
- @actor_command_window.visible = false
- @commandset_window.set(Vocab::attack)
- end
- end
- #--------------------------------------------------------------------------
- # コマンド状況によるウィンドウ配置リフレッシュ
- #--------------------------------------------------------------------------
- def refresh_windows_by_selection
- if @quick_window
- @actor_command_window.visible = false
- @quick_window.visible = true
- @quick_window.active = true
- @help_window.visible = true if @help_window
- @commandset_window.set(XRXSV9::S_QUICK)
- elsif @trash_window
- @actor_command_window.visible = false
- @trash_window.visible = true
- @trash_window.active = true
- @help_window.visible = true if @help_window
- @commandset_window.set(XRXSV9::S_TRASH)
- elsif @skill_window
- @actor_command_window.visible = false
- @skill_window.visible = true
- @help_window.visible = true if @help_window
- case @actor_command_window.command_id
- when 7
- @commandset_window.set(XRXSV9::S_PSKILL)
- else
- @commandset_window.set(Vocab::skill)
- end
- elsif @item_window
- @actor_command_window.visible = false
- @item_window.visible = true
- @help_window.visible = true if @help_window
- case @actor_command_window.command_id
- when 10
- @commandset_window.set(XRXSV9::S_BAG)
- when 11
- @commandset_window.set(XRXSV9::S_PBAG)
- else
- @commandset_window.set(Vocab::item)
- end
- else
- @actor_command_window.visible = true
- @commandset_window.set(@active_battler)
- @commandset_window.y = @actor_command_window.y - 36
- end
- end
- #--------------------------------------------------------------------------
- # 全ての選択を強制終了
- #--------------------------------------------------------------------------
- def end_all_selection
- $game_temp.clear_battle_tone2
- end_target_enemy_selection
- end_target_actor_selection
- end_quick_selection
- end_spirits_selection if defined? end_spirits_selection
- end_trash_selection
- end_skill_selection
- end_item_selection
- @actor_command_window.active = false
- @actor_command_window.visible = false
- @actor_command_window.openness = 0
- @status_window.index = -1
- @commandset_window.clear
- @commanding_action = nil
- end
- end
- #==============================================================================
- # BaST - 戦闘終了~バトルリザルトへの自動対応
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # ● 勝利の処理
- #--------------------------------------------------------------------------
- def process_victory
- end_all_selection
- @phase = 5
- @cp_active = false
- @cp_spriteset.visible = false
- battlejump_back
- xcam_win
- if $game_switches[XRXSV9::BattleEndSkipSwitchID] or
- $game_switches[XRXSV9::BattleEndMapBGMMESkipSwitchID]
- #
- elsif battle_result_enabled?
- $game_system.battle_end_bgm.play
- else
- $game_system.battle_end_me.play
- unless $BTEST
- $game_temp.map_bgm.play
- $game_temp.map_bgs.play
- end
- end
- battlermotion_victory
- if battle_result_enabled?
- battle_result_setting
- else
- display_exp_and_gold
- display_drop_items
- display_level_up
- end
- @message_window.close_force
- wait(80)
- battle_end(0)
- end
- def battlermotion_victory
- end
- #--------------------------------------------------------------------------
- # バトルリザルト - 勝利獲得
- #--------------------------------------------------------------------------
- def battle_result_setting
- $game_temp.battle_result_gold = 0 unless $game_temp.battle_result_gold
- $game_temp.battle_result_gold += $game_troop.gold_total
- $game_temp.battle_result_tresures = [] unless $game_temp.battle_result_tresures
- $game_temp.battle_result_tresures += $game_troop.make_drop_items
- $game_temp.battle_result_ap = 0 unless $game_temp.battle_result_ap
- $game_temp.battle_result_ap += $game_troop.ap_total rescue nil
- if XRXSV9::DropItemMax >= 1
- while $game_temp.battle_result_tresures.size > XRXSV9::DropItemMax
- $game_temp.battle_result_tresures.shift
- end
- end
- for enemy in $game_troop.dead_members
- next if enemy.hidden
- gain_actors = []
- for actor in enemy.exp_rights
- stated = false
- for state_id in XRXSV9::EXPnStates
- stated |= actor.state?(state_id)
- end
- gain_actors.push(actor) unless stated
- end
- n = [(gain_actors.size), XRXSV9::EXPRates.size - 1].min
- for actor in gain_actors
- m = n
- m -= 1 if actor == enemy.exp_mvp
- m = 0 if m < 0
- get_exp = enemy.exp * XRXSV9::EXPRates[m] / 100
- actor.battle_result_exp = 0 unless actor.battle_result_exp
- actor.battle_result_exp += get_exp
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 逃走の処理 *
- #--------------------------------------------------------------------------
- def process_escape
- if $game_troop.preemptive
- success = true
- else
- success = (rand(100) < @escape_ratio)
- end
- if success
- wait_for_jump
- Sound.play_escape
- text = sprintf(Vocab::EscapeStart, $game_party.name)
- @message_window.add_instant_text(text)
- battlejump_escape
- @phase = 5
- @cp_active = false
- @cp_spriteset.visible = false
- end_all_selection
- wait(15)
- battle_end(1)
- else
- @escape_ratio += 10
- wait(15)
- text = Vocab::EscapeFailure
- @message_window.add_instant_text(text)
- wait(40)
- end
- end
- #--------------------------------------------------------------------------
- # ● 敗北の処理
- #--------------------------------------------------------------------------
- def process_defeat
- end_all_selection
- @phase = 5
- @cp_active = false
- @cp_spriteset.visible = false
- wait_for_jump
- text = sprintf(Vocab::Defeat, $game_party.name)
- @message_window.add_instant_text(text)
- wait_for_message
- wait(200)
- battle_end(2)
- end
- #--------------------------------------------------------------------------
- # ● 戦闘終了
- #--------------------------------------------------------------------------
- def battle_end(result)
- end_all_selection
- if result == 2 and not $game_troop.can_lose
- call_gameover
- else
- $game_party.clear_actions
- $game_party.remove_states_battle
- $game_troop.clear
- if $game_temp.battle_proc != nil
- $game_temp.battle_proc.call(result)
- $game_temp.battle_proc = nil
- end
- if result == 0 and battle_result_enabled? and
- not $game_switches[XRXSV9::BattleEndSkipSwitchID]
- $scene = Scene_BattleResult.new
- else
- unless $BTEST or $game_switches[XRXSV9::BattleEndMapBGMMESkipSwitchID]
- $game_temp.map_bgm.play
- $game_temp.map_bgs.play
- end
- $scene = Scene_Map.new
- Graphics.fadeout(30)
- end
- @message_window.clear
- end
- $game_temp.in_battle = false
- end
- end
- #==============================================================================
- # 一時シーン
- #==============================================================================
- class Game_Temp
- attr_accessor :scene
- def scene!(scene)
- $game_temp.scene = scene
- $game_temp.scene.main while $game_temp.scene != nil
- end
- end
- module XRXSTempScene
- def main
- start # 開始処理
- perform_transition # トランジション実行
- post_start # 開始後処理
- Input.update # 入力情報を更新
- loop do
- Graphics.update # ゲーム画面を更新
- Input.update # 入力情報を更新
- update # フレーム更新
- break if $game_temp.scene != self # 画面が切り替わったらループを中断
- end
- Graphics.update
- pre_terminate # 終了前処理
- terminate # 終了処理
- end
- def return_scene
- $game_temp.scene = nil
- end
- end
- #==============================================================================
- # Temp装備画面
- #==============================================================================
- class Scene_BattleEquip < Scene_Equip
- include XRXSTempScene
- def return_scene
- $game_temp.scene = nil
- end
- def start
- super
- n = 1001
- @menuback2_sprite.z += n if @menuback2_sprite
- @actorstatus_window.z += n if @actorstatus_window
- @status_window.z += n
- @equip_window.z += n
- @help_window.z += n
- @actorpicture_sprite.z += n if @actorpicture_sprite
- for window in @item_windows
- window.z += n
- end
- end
- def go_status_scene
- end
- def next_actor
- end
- def prev_actor
- end
- end
- #==============================================================================
- # Tempステータス画面
- #==============================================================================
- class Scene_BattleStatus < Scene_Status
- include XRXSTempScene
- def return_scene
- $game_temp.scene = nil
- end
- def start
- super
- n = 1001
- @menuback2_sprite.z += n if @menuback2_sprite
- @actorstatus_window.z += n if @actorstatus_window
- @status_window.z += n if @status_window
- @help_window.z += n
- @actorpicture_sprite.z += n if @actorpicture_sprite
- @class_window.z += n
- @equipstatus_window.z += n
- @learnings_window.z += n
- @command_window.z += n
- end
- def go_equip_scene
- end
- def next_actor
- end
- def prev_actor
- end
- 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补充以下内容:
啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊!!!!
我要自杀!!!!!!!!!!!!!!!!!!!!!