if battler.cp >= battler.max_cp
Audio.se_play(FULL_SE)
BattleManager.set_enable_go(battler)
battler.my_turn = true
BattleManager.input_start
break
end
unless BattleManager.cp_updating?
return
end
end
def update?
return !@stop
end
end
#----------------------------------------------------------------------------
# ○ CPカウントの開始
#----------------------------------------------------------------------------
def stop @cancel = true
if @cp_thread != nil then
@cp_thread.join
@cp_thread = nil
end
end
end
#==============================================================================
# ■ Game_BattlerBase
#------------------------------------------------------------------------------
# 管理战斗者的类。主要含有能力值计算的方法。Game_Battler 类的父类。
#==============================================================================
class Game_BattlerBase
attr_reader :cp # CP
attr_accessor :turn_count
attr_accessor :my_turn
include CP
#------------------------------
alias old_initialize initialize
def initialize
old_initialize
@cp = 0
@turn_count = 0
@my_turn = false
end
#------------------------------
def inputable?
if @my_turn
return normal? && !auto_battle?# && @cp >= 65535
else
return false
end
end
#--------------------------------------------------------------------------
# ● 更改 CP
#--------------------------------------------------------------------------
def cp=(cp)
@cp = [[cp, max_cp].min, 0].max
end
#--------------------------------------------------------------------------
# ● 获取 CP 的最大值
#--------------------------------------------------------------------------
def max_cp
return 65535
end
#--------------------------------------------------------------------------
# ● 获取 CP 的比率
#--------------------------------------------------------------------------
def cp_rate
@cp.to_f / 65535
end
#--------------------------------------------------------------------------
# ● 扣除技能的使用消耗
#--------------------------------------------------------------------------
alias :old_pay_skill_cost :pay_skill_cost
def pay_skill_cost(skill)
old_pay_skill_cost(skill)
###########
case skill.id
when 1
@cp -= CP_COST_BASIC_ATTACK
when 2
@cp -= CP_COST_BASIC_GUARD
when 3...999 # 可自订不同消耗的技能
@cp -= CP_COST_SKILL_ITEM_ACTION
else
@cp = 0
end
###########
end
end
#--------------------------------------------------------
class Game_Battler < Game_BattlerBase
include CP
#--------------------------------------------------------------------------
# ● 消耗物品
#--------------------------------------------------------------------------
alias :old_consume_item :consume_item
def consume_item(item)
old_consume_item(item)
###########
case item.id
when 0...999 # 可自订不同消耗的物品
@cp -= CP_COST_SKILL_ITEM_ACTION
else
@cp = 0
end
###########
end
end
#-------------------------------------
class Game_Party < Game_Unit
def make_action(member)
unless member == nil
member.make_actions unless member.inputable?
end
end
end
#-------------------------------------
class Game_Troop < Game_Unit
def make_action(member)
member.make_actions unless member == nil
end
def increase_turn(enemy)
troop.pages.each {|page| @event_flags= false if page.span == 1 }
enemy.turn_count += 1
aaa = []
for iii in $game_troop.members
aaa.push(iii.turn_count)
end
@turn_count = aaa.max
end
end
#-------------------------------------
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))
for b in $game_troop.members
if !b.hidden?
b.cp = 0
end
end
for b in $game_party.battle_members
if !b.hidden?
b.cp = b.max_cp
end
end
elsif @surprise
$game_message.add(sprintf(Vocab::Surprise, $game_party.name))
for b in $game_troop.members
if !b.hidden?
b.cp = b.max_cp
end
end
for b in $game_party.battle_members
if !b.hidden?
b.cp = 0
end
end
end
wait_for_message
end
def self.enable_go
@enable_go
end
def self.set_enable_go(b)
@enable_go = b
end
def self.enable_go_clear
@enable_go = nil
end
def self.max_agi
@max_agi
end
def self.cp_updation
@phase = :cp_update
end
def self.cp_updating?
@phase == :cp_update
end
#--------------------------------------------------------------------------
# ● 重定义:开始输入指令
#--------------------------------------------------------------------------
def self.input_start
if @phase != :input
@phase = :input
$game_party.make_actions
$game_troop.make_actions
clear_actor
end
return $game_party.inputable?
end
#-------------------------------------------------------------------------
# ● 重定义:回合开始
#------------------------------------------------------------------------
def self.turn_start
@phase = :turn
clear_actor
make_action_orders
end
#-------------------------------------------------------------------------
# ● 重定义:行动顺序
#------------------------------------------------------------------------
def self.make_action_orders
@action_battlers = []
for b in $game_troop.members + $game_party.battle_members
if b.my_turn
@action_battlers.push(b)
end
end
exclude_battler = []
for battler in @action_battlers
if battler.cp < 65535
exclude_battler.push(battler)
end
end
@action_battlers -= exclude_battler
end
end
#==============================================================================
# ■ Window_Base
#------------------------------------------------------------------------------
# 游戏中所有窗口的父类
#==============================================================================