| 赞 | 1 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2016-1-18 |
| 在线时间 | 1269 小时 |
薄凉看客
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 1269 小时
- 注册时间
- 2010-6-20
- 回帖
- 1223
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 恐惧剑刃 于 2014-11-7 19:38 编辑
先放截图
我的思路仅供参考。
再次更新,这次测试没发现问题。。
其余问题:
1. fill_rect过多
2. 敌人CP没有显示
等
太赖暂时不考虑修正 。。
工程
CP.zip
(230.77 KB, 下载次数: 112)
CP
[pre lang="ruby" line="1"]#------------------------------------------------------------------------------
# - CP战斗
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# - 设置
#------------------------------------------------------------------------------
module CP
Speed = 1 # 速度
Width = 120 # CP条宽度
Height = 6 # CP条高度
Back_Color = Color.new(0, 0, 0) # CP条背景色
Cp_Color = Color.new(255, 255, 64) # CP条填充色
Cp_Color_2 = Color.new(255, 128, 255) # CP条填充色(满)
end
#------------------------------------------------------------------------------
# - 战斗者CP属性
#------------------------------------------------------------------------------
class Game_Battler
attr_accessor :cp, :cp_speed
alias initialize_cp_old initialize
def initialize
@cp = 0
@cp_speed = 0
initialize_cp_old
end
end
#------------------------------------------------------------------------------
# - 战斗场景
#------------------------------------------------------------------------------
class Scene_Battle
#----------------------------------------------------------------------------
# - 主方法
#----------------------------------------------------------------------------
alias main_cp_old main
def main
@cp_viewport = Viewport.new(0, 465, 640, CP::Height)
@cp_viewport.z = 9999
@cp_sprite = Sprite.new(@cp_viewport)
@cp_sprite.bitmap = Bitmap.new(640, CP::Height)
cp_bar
main_cp_old
@cp_sprite.bitmap.dispose
@cp_sprite.dispose
@cp_viewport.dispose
end
#--------------------------------------------------------------------------
# - 速度
#--------------------------------------------------------------------------
def cp_speed
battlers_agi = []
for battler in $game_party.actors + $game_troop.enemies
battlers_agi << battler.agi
end
min_agi = battlers_agi.min
for battler in $game_party.actors + $game_troop.enemies
battler.cp_speed = battler.agi * 10 / min_agi * CP::Speed / 5
end
end
#----------------------------------------------------------------------------
# - 描绘CP
#----------------------------------------------------------------------------
def cp_bar
@cp_sprite.bitmap.clear
for index in 0...$game_party.actors.size
actor = $game_party.actors[index]
if actor.dead?
actor.cp = 0
next
end
x = (index + 1) * 20 + index * 140
width = CP::Width
height = CP::Height
back_color = CP::Back_Color
@cp_sprite.bitmap.fill_rect(x, 0, width, height, back_color)
if actor.cp >= width - 1
cp_color = CP::Cp_Color_2
wid = width - 1
else
cp_color = CP::Cp_Color
wid = actor.cp
end
@cp_sprite.bitmap.fill_rect(x + 1, 1, wid, height - 2, cp_color)
end
end
end
class Scene_Battle
alias start_phase2_cp_old start_phase2
def start_phase2
cp_bar
start_phase2_cp_old
end
def make_action_orders
@action_battlers = [@active_battler_cp]
end
alias update_phase4_step6_cp_old update_phase4_step6
def update_phase4_step6
update_phase4_step6_cp_old
@active_battler.cp = 0
end
end[/pre]
Scene_Battle 3
[pre lang="ruby" line="1"]#==============================================================================
# ■ Scene_Battle (分割定义 3)
#------------------------------------------------------------------------------
# 处理战斗画面的类。
#==============================================================================
class Scene_Battle
#--------------------------------------------------------------------------
# ● 开始角色命令回合
#--------------------------------------------------------------------------
def start_phase3
# 转移到回合 3
@phase = 3
# 设置角色为非选择状态
@actor_index = -1
@active_battler = nil
@active_battler_cp = nil
# 同伴指令窗口无效化
@party_command_window.active = false
@party_command_window.visible = false
end
#--------------------------------------------------------------------------
# ● 设置角色指令窗口
#--------------------------------------------------------------------------
def phase3_setup_command_window
if !@active_battler_cp.is_a?(Game_Actor)
start_phase4 # 回合4
@phase = 4
return
end
# 角色指令窗口无效化
@actor_command_window.active = true
@actor_command_window.visible = true
@actor_command_window.x = $game_party.actors.index(@active_battler_cp) * 160
# 设置索引为 0
@actor_command_window.index = 0
end
#--------------------------------------------------------------------------
# ● 刷新画面 (角色命令回合)
#--------------------------------------------------------------------------
def update_phase3
if judge # 判断胜负
return
end
if @active_battler_cp == nil # 可以刷新
cp_speed # 新速度
cp_bar # 刷新cp条
for battler in $game_party.actors + $game_troop.enemies
battler.cp += battler.cp_speed
if battler.cp >= CP::Width - 1
cp_bar # 变色
@active_battler_cp = battler # 输入命令者
phase3_setup_command_window
end
end
end
# 敌人光标有效的情况下
if @enemy_arrow != nil
update_phase3_enemy_select
# 角色光标有效的情况下
elsif @actor_arrow != nil
update_phase3_actor_select
# 特技窗口有效的情况下
elsif @skill_window != nil
update_phase3_skill_select
# 物品窗口有效的情况下
elsif @item_window != nil
update_phase3_item_select
# 角色指令窗口有效的情况下
elsif @actor_command_window.active
update_phase3_basic_command
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (角色命令回合 : 基本命令)
#--------------------------------------------------------------------------
def update_phase3_basic_command
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 角色指令窗口光标位置分之
case @actor_command_window.index
when 0 # 攻击
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler_cp.current_action.kind = 0
@active_battler_cp.current_action.basic = 0
# 开始选择敌人
start_enemy_select
when 1 # 特技
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler_cp.current_action.kind = 1
# 开始选择特技
start_skill_select
when 2 # 防御
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler_cp.current_action.kind = 0
@active_battler_cp.current_action.basic = 1
start_phase4
@phase = 4
when 3 # 物品
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler_cp.current_action.kind = 2
# 开始选择物品
start_item_select
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (角色命令回合 : 选择特技)
#--------------------------------------------------------------------------
def update_phase3_skill_select
# 设置特技窗口为可视状态
@skill_window.visible = true
# 刷新特技窗口
@skill_window.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 结束特技选择
end_skill_select
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 获取特技选择窗口现在选择的特技的数据
@skill = @skill_window.skill
# 无法使用的情况下
if @skill == nil or not @active_battler_cp.skill_can_use?(@skill.id)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler_cp.current_action.skill_id = @skill.id
# 设置特技窗口为不可见状态
@skill_window.visible = false
if ![1, 3, 5].include?(@skill.scope)
start_phase4
@phase = 4
return
end
# 效果范围是敌单体的情况下
if @skill.scope == 1
# 开始选择敌人
start_enemy_select
# 效果范围是我方单体的情况下
elsif @skill.scope == 3 or @skill.scope == 5
# 开始选择角色
start_actor_select
# 效果范围不是单体的情况下
else
# 选择特技结束
end_skill_select
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (角色命令回合 : 选择物品)
#--------------------------------------------------------------------------
def update_phase3_item_select
# 设置物品窗口为可视状态
@item_window.visible = true
# 刷新物品窗口
@item_window.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 选择物品结束
end_item_select
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 获取物品窗口现在选择的物品资料
@item = @item_window.item
# 无法使用的情况下
unless $game_party.item_can_use?(@item.id)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler_cp.current_action.item_id = @item.id
# 设置物品窗口为不可见状态
@item_window.visible = false
if ![1, 3, 5].include?(@item.scope)
start_phase4
@phase = 4
return
end
# 效果范围是敌单体的情况下
if @item.scope == 1
# 开始选择敌人
start_enemy_select
# 效果范围是我方单体的情况下
elsif @item.scope == 3 or @item.scope == 5
# 开始选择角色
start_actor_select
# 效果范围不是单体的情况下
else
# 物品选择结束
end_item_select
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面画面 (角色命令回合 : 选择敌人)
#--------------------------------------------------------------------------
def update_phase3_enemy_select
# 刷新敌人箭头
@enemy_arrow.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 选择敌人结束
end_enemy_select
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler_cp.current_action.target_index = @enemy_arrow.index
# 选择敌人结束
end_enemy_select
# 显示特技窗口中的情况下
if @skill_window != nil
# 结束特技选择
end_skill_select
end
# 显示物品窗口的情况下
if @item_window != nil
# 结束物品选择
end_item_select
end
start_phase4
@phase = 4
return
end
end
#--------------------------------------------------------------------------
# ● 画面更新 (角色指令回合 : 选择角色)
#--------------------------------------------------------------------------
def update_phase3_actor_select
# 刷新角色箭头
@actor_arrow.update
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 选择角色结束
end_actor_select
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 设置行动
@active_battler_cp.current_action.target_index = @actor_arrow.index
# 选择角色结束
end_actor_select
# 显示特技窗口中的情况下
if @skill_window != nil
# 结束特技选择
end_skill_select
end
# 显示物品窗口的情况下
if @item_window != nil
# 结束物品选择
end_item_select
end
start_phase4
@phase = 4
return
end
end
#--------------------------------------------------------------------------
# ● 开始选择特技
#--------------------------------------------------------------------------
def start_skill_select
# 生成特技窗口
@skill_window = Window_Skill.new(@active_battler_cp)
# 关联帮助窗口
@skill_window.help_window = @help_window
# 无效化角色指令窗口
@actor_command_window.active = false
@actor_command_window.visible = false
end
end
[/pre] |
评分
-
查看全部评分
|