#========================================================================
# □ Scene_Battle_CP
#========================================================================
class Scene_Battle_CP
#----------------------------------------------------------------------
# ○ 公開インスタンス変数
#----------------------------------------------------------------------
attr_accessor :stop # CP加算ストップ
#----------------------------------------------------------------------
# ○ オブジェクトの初期化
#----------------------------------------------------------------------
def initialize
@battlers = []
@cancel = false
@stop = false
@str_total = 0
@dex_total = 0
@agi_total = 0
@int_total = 0
# 配列 count_battlers を初期化
count_battlers = []
# 将enemy添加到数组count_battlers
for enemy in $game_troop.enemies
count_battlers.push(enemy)
end
# 将actor添加到数组count_battlers
for actor in $game_party.actors
count_battlers.push(actor)
end
for battler in count_battlers
@str_total = [@str_total,battler.str].max
@dex_total = [@dex_total,battler.dex].max
@agi_total = [@agi_total,battler.agi].max
@int_total = [@int_total,battler.int].max
end
# 装载事件
common_event = $data_common_events[event_id]
$game_system.battle_interpreter.setup(common_event.list, event_id)
# 立刻执行事件
$game_system.battle_interpreter.update
for battler in count_battlers
battler.cp = 0
end
for battler in $game_party.actors #
if battler.state?(100)
battler.cp+=65535
battler.xp2_damage="我先出手!"
battler.xp2_damage_pop=true
end
end
#下面就是困扰我很久的bug,只有先运行数据库队伍战斗事件触发条件为0回合的事件页然后再开始跑CP集气条的话才能解决这个bug
for battler in $game_troop.enemies
if battler.state?(100)
battler.cp+=65535
battler.xp2_damage="我先出手! "
battler.xp2_damage_pop=true
end
end
end
#----------------------------------------------------------------------
# ○ CP计数
#----------------------------------------------------------------------
def update
# 如果停止就返回
return if @stop
for battler in $game_party.actors + $game_troop.enemies
# 如果行动不能忽视
if battler.dead? == true
battler.cp = 0
next
end
cp_a=0.6
cp_b=0.4
cp_c=0.3
cp_d=0.08
battler.cp = [[battler.cp + BATTLE_SPEED * 4000 * (cp_a*battler.agi+cp_b*battler.dex+cp_c*battler.int+cp_d*battler.str) /(0.6*@agi_total+0.4*@dex_total+0.3*@int_total+0.08*@str_total), 0].max, 65535].min
end
end
#----------------------------------------------------------------------
# ○ 开始CP计数
#----------------------------------------------------------------------
def stop
@cancel = true
if @cp_thread != nil then
@cp_thread.join
@cp_thread = nil
end
end
end