赞 | 0 |
VIP | 0 |
好人卡 | 1 |
积分 | 1 |
经验 | 804 |
最后登录 | 2016-7-7 |
在线时间 | 22 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 22 小时
- 注册时间
- 2011-5-21
- 帖子
- 17
|
- #VX CP制战斗系统 V 1.00 BY SLICK
- #==============================================================================
- # ■ Game_Battler
- #------------------------------------------------------------------------------
- # 处理战斗者的类。这个类作为 Game_Actor 类与 Game_Enemy 类的
- # 超级类来使用。
- #==============================================================================
- class Game_Battler
- attr_accessor :cp
- attr_accessor :turn_count
- attr_accessor :my_turn #轮到这个家伙行动了吗?
- alias neoinitialize initialize
- def initialize
- @cp = 0
- @turn_count = 0
- @my_turn = false
- neoinitialize
- end
- #--------------------------------------------------------------------------
- # ● 可以输入命令判定
- #--------------------------------------------------------------------------
- def inputable?
- if @my_turn
- return (not @hidden and restriction <= 1)
- else
- return false
- end
- end
- end
- #==============================================================================
- # ■ Game_Troop
- #------------------------------------------------------------------------------
- # 处理敌人队伍和战斗相关资料的类,也可执行如战斗事件管理之类的功能。
- # 本类的实例请参考 $game_troop。
- #==============================================================================
- class Game_Troop < Game_Unit
- #--------------------------------------------------------------------------
- # ● 增加回合数
- #--------------------------------------------------------------------------
- def increase_turn(enemy)
- for page in troop.pages
- if page.span == 1
- @event_flags= false
- end
- end
- enemy.turn_count += 1
- aaa = []
- for iii in $game_troop.members
- aaa.push(iii.turn_count)
- end
- @turn_count = aaa.min
- end
- #--------------------------------------------------------------------------
- # ● 生成战斗行动
- #--------------------------------------------------------------------------
- def make_actions(enemy)
- enemy.make_action
- end
- end
- #==============================================================================
- # ■ Scene_Battle
- #------------------------------------------------------------------------------
- # 处理战斗画面的类。
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # ● 生成资讯显示端口
- #--------------------------------------------------------------------------
- alias neocreate_info_viewport create_info_viewport
- def create_info_viewport
- @info_viewport = Viewport.new(0, 256, 544, 160)
- @info_viewport.z = 100
- @status_window = Window_BattleStatus.new
- @party_command_window = Window_PartyCommand.new
- @actor_command_window = Window_ActorCommand.new
- @status_window.viewport = @info_viewport
- @party_command_window.viewport = @info_viewport
- @actor_command_window.viewport = @info_viewport
- @party_command_window.y = 32
- @actor_command_window.y = 8
- @status_window.x = 128
- @status_window.y = 32
- @actor_command_window.x = 544
- @info_viewport.visible = false
- end
- #--------------------------------------------------------------------------
- # ● 开始处理
- #--------------------------------------------------------------------------
- def start
- super
- $game_temp.in_battle = true
- @spriteset = Spriteset_Battle.new
- @message_window = Window_BattleMessage.new
- @action_battlers = []
- # 清空CP,所有人从零开始
- for iii in $game_party.members + $game_troop.members
- iii.cp = 0
- end
- for iii in $game_party.members + $game_troop.members
- iii.turn_count = 0
- end
- # 谁的CP到顶了,谁才能动
- @enable_go = nil
- create_info_viewport
- end
- #--------------------------------------------------------------------------
- # ● 更新画面
- #--------------------------------------------------------------------------
- def update
- super
- update_basic(true)
- update_info_viewport # 更新资讯显示端口
- if $game_message.visible
- @info_viewport.visible = false
- @message_window.visible = true
- end
- unless $game_message.visible # 除非讯息显示中
- return if judge_win_loss # 判断胜负结果
- update_scene_change
- if @target_enemy_window != nil
- update_target_enemy_selection # 选择目标敌人
- elsif @target_actor_window != nil
- update_target_actor_selection # 选择目标角色
- elsif @skill_window != nil
- update_skill_selection # 选择技能
- elsif @item_window != nil
- update_item_selection # 选择物品
- elsif @party_command_window.active
- update_party_command_selection # 选择队伍命令
- elsif @actor_command_window.active
- update_actor_command_selection # 选择角色命令
- else
- # 等待:每个人的CP向前添加 =====================================================
- fullflag = false
- for iii in $game_troop.members + $game_party.members
- iii.cp += iii.agi * 10
- if iii.cp >= 5000
- iii.cp -= 5000
- @enable_go = iii
- iii.my_turn = true
- fullflag = true
- break
- end
- end
- # ==============================================================================
- unless fullflag
- return
- end
- process_battle_event # 战斗事件处理
- process_action # 战斗行动
- process_battle_event # 战斗事件处理
- if @enable_go.is_a?(Game_Actor)
- @status_window.refresh
- start_party_command_selection
- else
- $game_troop.make_actions(@enable_go)
- start_main
- end
- @enable_go = nil
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 开始队伍命令选择
- #--------------------------------------------------------------------------
- def start_party_command_selection
- if $game_temp.in_battle
- @status_window.refresh
- @status_window.index = @actor_index = -1
- @active_battler = nil
- @message_window.visible = false
- @party_command_window.active = false
- @party_command_window.visible = false
- @party_command_window.index = 0
- @actor_command_window.active = true
- $game_party.clear_actions
- next_actor
- @info_viewport.visible = true
- if $game_troop.surprise or not $game_party.inputable?
- start_main
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新角色命令选择
- #--------------------------------------------------------------------------
- def update_actor_command_selection
- if Input.trigger?(Input::B)
- Sound.play_cancel
- prior_actor
- elsif Input.trigger?(Input::C)
- case @actor_command_window.index
- 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
- @active_battler.action.set_guard
- next_actor
- when 3 # 物品
- Sound.play_decision
- start_item_selection
- when 4 # 逃跑
- if $game_troop.can_escape == false
- Sound.play_buzzer
- return
- end
- Sound.play_decision
- process_escape
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 开始敌人目标选择
- #--------------------------------------------------------------------------
- alias neostart_target_enemy_selection start_target_enemy_selection
- def start_target_enemy_selection
- neostart_target_enemy_selection
- @target_enemy_window.y = @info_viewport.rect.y + 32
- end
- #--------------------------------------------------------------------------
- # ● 开始同伴目标选择
- #--------------------------------------------------------------------------
- alias neostart_target_actor_selection start_target_actor_selection
- def start_target_actor_selection
- neostart_target_actor_selection
- @target_actor_window.y = @info_viewport.rect.y + 32
- end
- #--------------------------------------------------------------------------
- # ● 开始执行战斗处理
- #--------------------------------------------------------------------------
- def start_main
- for member in $game_troop.members
- $game_troop.increase_turn(member)
- end
- @info_viewport.visible = false
- @info_viewport.ox = 0
- @message_window.visible = true
- @party_command_window.active = false
- @actor_command_window.active = false
- @status_window.index = @actor_index = -1
- @active_battler = nil
- @message_window.clear
- for member in $game_troop.members
- $game_troop.make_actions(member)
- end
- make_action_orders
- wait(20)
- end
- #--------------------------------------------------------------------------
- # ● 生成行动顺序
- #--------------------------------------------------------------------------
- def make_action_orders
- @action_battlers = []
- for iii in $game_troop.members + $game_party.members
- if iii.my_turn
- @action_battlers.push(iii)
- iii.my_turn = false
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 回合结束
- #--------------------------------------------------------------------------
- def turn_end
- $game_troop.turn_ending = true
- $game_party.slip_damage_effect
- $game_troop.slip_damage_effect
- $game_party.do_auto_recovery
- $game_troop.preemptive = false
- $game_troop.surprise = false
- process_battle_event
- $game_troop.turn_ending = false
- end
- end
- #==============================================================================
- # ■ Window_ActorCommand
- #------------------------------------------------------------------------------
- # 选择角色命令(如「攻击」或「技能」)的窗口。
- #==============================================================================
- class Window_ActorCommand < Window_Command
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super(128, [], 1, 5)
- self.active = false
- end
- #--------------------------------------------------------------------------
- # ● 设置
- # actor : 角色
- #--------------------------------------------------------------------------
- def setup(actor)
- s1 = Vocab::attack
- s2 = Vocab::skill
- s3 = Vocab::guard
- s4 = Vocab::item
- s5 = Vocab::escape
- if actor.class.skill_name_valid # 是否指定职业技能文字
- s2 = actor.class.skill_name # 替换「技能」命令文字
- end
- @commands = [s1, s2, s3, s4, s5]
- @item_max = 5
- refresh
- self.index = 0
- end
- end
复制代码 |
|