赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 7816 |
最后登录 | 2017-5-6 |
在线时间 | 92 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 92 小时
- 注册时间
- 2010-6-29
- 帖子
- 30
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 76213585 于 2013-10-5 10:27 编辑
CP战斗时在敌我任意一名角色被状态杀死的时候会卡死。
由于改了原脚本所以不敢确定是否是兼容问题还是其他问题。
[pre lang="ruby" line="1"]module CP
#
# 基本能力消耗的CP值
#
CP_COST_SKILL_ITEM_ACTION = 65535 # 技能 物品
CP_COST_BASIC_ATTACK = 65535 # 攻撃
CP_COST_BASIC_GUARD = 32768 # 防御
CP_COST_BASIC_ESCAPE = 65535 #逃跑
end
#==============================================================================
# □ CP_Thread
#==============================================================================
class CP_Thread
# 战斗速度
#
BATTLE_SPEED = 1.0
#
# 战斗开始的时候气槽百分比
#
START_CP_PERCENT = 10
#
# CP满时的音效
#
FULL_SE = "Audio/SE/open1"
#--------------------------------------------------------------------------
# ○ 变量公开
#--------------------------------------------------------------------------
attr_accessor :stop # CP加算ストップ
#----------------------------------------------------------------------------
# ○ 初始化
#----------------------------------------------------------------------------
def initialize
@battlers = []
@cancel = false
@stop = false
@agi_total = 0
# 配列 count_battlers を初期化
count_battlers = []
# エネミーを配列 count_battlers に追加
for enemy in $game_troop.members
count_battlers.push(enemy)
end
# アクターを配列 count_battlers に追加
for actor in $game_party.battle_members
count_battlers.push(actor)
end
for battler in count_battlers
@agi_total += battler.agi
end
for battler in count_battlers
battler.cp = [[65535 * START_CP_PERCENT * (rand(15) + 85) * 4 * battler.agi / @agi_total / 10000, 0].max, 65535].min
battler.turn_count = 0
end
end
#----------------------------------------------------------------------------
# ○ CP更新
#----------------------------------------------------------------------------
def update
# 停止刷新
return if @stop
#
for battler in $game_party.battle_members + $game_troop.members
# 行動出来なければ無視
if battler.dead? || battler.hidden?
battler.cp = 0
next
end
battler.cp = [[battler.cp + BATTLE_SPEED * 2048 * battler.agi / @agi_total, 0].max, 65535].min
# CP满时
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 |
|