赞 | 1 |
VIP | 32 |
好人卡 | 13 |
积分 | 16 |
经验 | 88876 |
最后登录 | 2021-7-25 |
在线时间 | 2205 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 1641
- 在线时间
- 2205 小时
- 注册时间
- 2010-6-27
- 帖子
- 1299
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 pigsss 于 2012-5-9 10:15 编辑
应众人要求更新,修正各种bug
注意:敌人特殊能力【增加行动次数】不可用!
懒得上传了,直接贴脚本:
[pre lang="ruby" line="1"]#==============================================================================
# ●CP制战斗
# 原作者:桜雅 在土, 和希 (XP版CP制),韩云溪(AT即时战斗)
# 修改:pigsss
# 更新日期:2012.05.09
# 一个简单的cp战斗系统
# 好吧,我还是不明白为什么那么多人喜欢用…
# ·加强兼容性
# ·修正先制/被偷袭bug
# ·修正敌人隐藏bug
# ·修正逃跑失败bug
# ■✖ !注意-------------------------
# ·敌人特殊能力【增加行动次数】不可用│
# ---------------------------------
#==============================================================================
module CP
#
# 基本能力消耗的CP值
#
CP_COST_SKILL_ITEM_ACTION = 65535 # 技能 物品
CP_COST_BASIC_ATTACK = 32768 # 攻撃
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 |
评分
-
查看全部评分
|