赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 10141 |
最后登录 | 2017-8-14 |
在线时间 | 114 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 114 小时
- 注册时间
- 2015-7-23
- 帖子
- 22
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
最近在va图书馆里发现了cp制战斗,但是用起来发现人物只能行动一次,然后到该人物的第二回合的时候就不能攻击不能放法术,求大神告知如何解决,这个问题也有人问过,但没人解答,搜索了一堆也没找到这问题怎么解决
#RTAB战斗系统 For RPG Maker VX Ace 编写者:SLICK
#encoding:utf-8
#==============================================================================
# ■ Scene_Battle
#------------------------------------------------------------------------------
# 战斗画面
#==============================================================================
class Scene_Battle < Scene_Base
attr_accessor :cp_quota
attr_accessor :rtab_wait
attr_accessor :active_members
#--------------------------------------------------------------------------
# ● 开始处理
#--------------------------------------------------------------------------
def start
super
@cp_quota = 0
create_spriteset
create_all_windows
BattleManager.method_wait_for_message = method(:wait_for_message)
end
#--------------------------------------------------------------------------
# ● 战斗开始
#--------------------------------------------------------------------------
def battle_start
@rtab_wait = true
@active_members = []
BattleManager.battle_start
set_cp_quota
process_event
#start_party_command_selection
end
#--------------------------------------------------------------------------
# ● 获取敌我双方人物的平均行动速度并决定CP槽的Quota值
#--------------------------------------------------------------------------
def set_cp_quota
sss = 0.0
for iii in $game_party.members
sss += iii.param(6)
end
sss /= $game_party.members.size
@cp_quota = sss * 200
@spriteset.cp_quota = @cp_quota
for iii in $game_party.members + $game_troop.members
iii.cp_quota = @cp_quota
end
end
#--------------------------------------------------------------------------
# ● 进行下一个指令输入
#--------------------------------------------------------------------------
def next_command
if BattleManager.next_command
start_actor_command_selection
else
turn_start(@active_members)
end
end
#--------------------------------------------------------------------------
# ● 返回上一个指令输入
#--------------------------------------------------------------------------
def prior_command
if BattleManager.prior_command
start_actor_command_selection
else
start_party_command_selection
end
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
if BattleManager.in_turn?
process_event
process_action
else
if @rtab_wait
for iii in $game_party.members + $game_troop.members
iii.in_turn = false
iii.rtab_cp += iii.param(6)
if iii.rtab_cp >= iii.cp_quota
@active_members.push(iii)
iii.in_turn = true
end
end
if @active_members.size > 0
@rtab_wait = false
start_party_command_selection
end
end
end
BattleManager.judge_win_loss
end
#--------------------------------------------------------------------------
# ● 回合开始
#--------------------------------------------------------------------------
def turn_start(members)
@party_command_window.close
@actor_command_window.close
@status_window.unselect
@subject = nil
BattleManager.turn_start(members)
@log_window.wait
@log_window.clear
end
#--------------------------------------------------------------------------
# ● 回合结束
#--------------------------------------------------------------------------
def turn_end
@active_members.each do |battler|
battler.on_turn_end
refresh_status
@log_window.display_auto_affected_status(battler)
@log_window.wait_and_clear
end
BattleManager.turn_end
process_event
@rtab_wait = true
@active_members = []
end
#--------------------------------------------------------------------------
# ● 处理战斗行动
#--------------------------------------------------------------------------
def process_action
return if scene_changing?
if !@subject || [email protected]_action
@subject = BattleManager.next_subject
end
return turn_end unless @subject
if @subject.current_action
@subject.current_action.prepare
if @subject.current_action.valid?
@status_window.open
execute_action
end
@subject.remove_current_action
end
process_action_end unless @subject.current_action
end
#--------------------------------------------------------------------------
# ● 开始队伍指令的选择
#--------------------------------------------------------------------------
def start_party_command_selection
unless scene_changing?
refresh_status
@status_window.unselect
@status_window.open
if BattleManager.input_start
BattleManager.clear_actor
BattleManager.next_command
@status_window.select(BattleManager.actor.index)
@actor_command_window.setup(BattleManager.actor)
else
@party_command_window.deactivate
@actor_command_window.close
turn_start(@active_members)
end
end
end
#--------------------------------------------------------------------------
# ● 生成角色指令窗口
#--------------------------------------------------------------------------
def create_actor_command_window
@actor_command_window = Window_ActorCommand.new
@actor_command_window.viewport = @info_viewport
@actor_command_window.set_handler(:attack, method(:command_attack))
@actor_command_window.set_handler(:skill, method(:command_skill))
@actor_command_window.set_handler(:guard, method(:command_guard))
@actor_command_window.set_handler(:item, method(:command_item))
@actor_command_window.set_handler(:cancel, method(:prior_command))
@actor_command_window.set_handler(:escape, method(:command_escape))
@actor_command_window.x = Graphics.width
end
#--------------------------------------------------------------------------
# ● 指令“撤退”
#--------------------------------------------------------------------------
def command_escape
unless BattleManager.process_escape
turn_start(@active_members)
for iii in @active_members
iii.rtab_cp = 0
end
end
end
end
#encoding:utf-8
#==============================================================================
# ■ Window_ActorCommand
#------------------------------------------------------------------------------
# 战斗画面中,选择角色行动的窗口。
#==============================================================================
class Window_ActorCommand < Window_Command
#--------------------------------------------------------------------------
# ● 生成指令列表
#--------------------------------------------------------------------------
def make_command_list
return unless @actor
add_attack_command
add_skill_commands
add_guard_command
add_item_command
add_escape_command
end
#--------------------------------------------------------------------------
# ● 添加撤退指令
#--------------------------------------------------------------------------
def add_escape_command
add_command(Vocab::escape, :escape, BattleManager.can_escape?)
end
end
#encoding:utf-8
#==============================================================================
# ■ BattleManager
#------------------------------------------------------------------------------
# 战斗过程的管理器。
#==============================================================================
module BattleManager
#--------------------------------------------------------------------------
# ● 战斗开始
#--------------------------------------------------------------------------
def self.battle_start
$game_system.battle_count += 1
$game_party.on_battle_start
$game_troop.on_battle_start
$game_troop.enemy_names.each do |name|
$game_message.add(sprintf(Vocab::Emerge, name))
end
if @preemptive
$game_message.add(sprintf(Vocab::Preemptive, $game_party.name))
elsif @surprise
$game_message.add(sprintf(Vocab::Surprise, $game_party.name))
end
wait_for_message
end
#--------------------------------------------------------------------------
# ● 遇敌时的处理
#--------------------------------------------------------------------------
def self.on_encounter
@preemptive = false
@surprise = false
end
#--------------------------------------------------------------------------
# ● 回合开始
#--------------------------------------------------------------------------
def self.turn_start(members)
@phase = :turn
clear_actor
$game_troop.increase_turn(members)
make_action_orders(members)
end
#--------------------------------------------------------------------------
# ● 生成行动顺序
#--------------------------------------------------------------------------
def self.make_action_orders(members)
@action_battlers = []
for iii in $game_party.members
if members.include?(iii)
@action_battlers.push(iii) unless @surprise
end
end
for iii in $game_troop.members
if members.include?(iii)
@action_battlers.push(iii) unless @preemptive
end
end
@action_battlers.each {|battler| battler.make_speed }
@action_battlers.sort! {|a,b| b.speed - a.speed }
end
end
#encoding:utf-8
#==============================================================================
# ■ Game_Battler
#------------------------------------------------------------------------------
# 处理战斗者的类。Game_Actor 和 Game_Enemy 类的父类。
#==============================================================================
class Game_Battler < Game_BattlerBase
attr_accessor :turn_count
attr_accessor :rtab_cp
attr_accessor :cp_quota
attr_accessor :in_turn
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
alias neoinitialize initialize
def initialize
@turn_count = 0
@rtab_cp = 0
@cp_quota = 100
@in_turn = false
neoinitialize
end
#--------------------------------------------------------------------------
# ● 战斗开始处理
#--------------------------------------------------------------------------
def on_battle_start
@turn_count = 0
@rtab_cp = 0
@cp_quota = 100
@in_turn = false
init_tp unless preserve_tp?
end
#--------------------------------------------------------------------------
# ● 处理伤害
# 调用前需要设置好
# @result.hp_damage @result.mp_damage
# @result.hp_drain @result.mp_drain
#--------------------------------------------------------------------------
def execute_damage(user)
on_damage(@result.hp_damage) if @result.hp_damage > 0
self.hp -= @result.hp_damage
self.mp -= @result.mp_damage
user.hp += @result.hp_drain
user.mp += @result.mp_drain
end
#--------------------------------------------------------------------------
# ● 判定是否可以输入指令
#--------------------------------------------------------------------------
def inputable?
normal? && !auto_battle? && @in_turn
end
#--------------------------------------------------------------------------
# ● 回合结束处理
#--------------------------------------------------------------------------
def on_turn_end
@result.clear
regenerate_all
update_state_turns
update_buff_turns
remove_states_auto(2)
return unless SceneManager.scene_is?(Scene_Battle)
# 该角色的回合计数加1并清空CP
@turn_count += 1
@rtab_cp = 0
end
end
#encoding:utf-8
#==============================================================================
# ■ Game_Troop
#------------------------------------------------------------------------------
# 管理敌群和战斗相关资料的类,也可执行如战斗事件管理之类的功能。
# 本类的实例请参考 $game_troop 。
#==============================================================================
class Game_Troop < Game_Unit
#--------------------------------------------------------------------------
# ● 增加回合
#--------------------------------------------------------------------------
def increase_turn(members)
troop.pages.each {|page| @event_flags |
|