Project1
标题:
光标选中显示图标和技能CD整合
[打印本页]
作者:
紫千修
时间:
2013-6-12 11:44
标题:
光标选中显示图标和技能CD整合
如题 这两个脚本起了冲突 本来是光标选中技能后才有技能图标 现在用了技能CD整合后 这两个脚本就不能一起用了
请帮忙整合一下
#==============================================================================
# ■ Window_Skill
#------------------------------------------------------------------------------
# 特技画面、战斗画面、显示可以使用的特技浏览的窗口。
#==============================================================================
class Window_Skill < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 128, 640, 352)
[url=home.php?mod=space&uid=95897]@actor[/url] = actor
@column_max = 2
self.index = 0
refresh
@idx = self.index
# 战斗中的情况下将窗口移至中央并将其半透明化
if $game_temp.in_battle
self.y = 64
self.height = 256
self.back_opacity = 160
end
end
#--------------------------------------------------------------------------
# ● 获取特技
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for i in
[email protected]
skill = $data_skills[@actor.skills[i]]
if skill != nil
@data.push(skill)
end
end
# 如果项目数不是 0 就生成位图、重新描绘全部项目
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
if i == self.index
draw_item2(i)
else
draw_item(i)
end
end
end
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
#bitmap = RPG::Cache.icon(skill.icon_name)
#opacity = self.contents.font.color == normal_color ? 255 : 128
#self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 描绘项目
# index : 项目编号
#--------------------------------------------------------------------------
def draw_item2(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(self.skill == nil ? "" : self.skill.description)
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
super
if @idx != self.index
refresh
@idx = self.index
end
end
end
复制代码
#=======================================================================
# 豪华版技能冷却系统 By 绿发的Eclair
# 使用方法:在特技名称后面用半角逗号分割,写上冷却回合数。
# 比如 十字斩,10 就是特技 十字斩 冷却10个回合了。
# 注意这个冷却是敌我通用的,不只是我方,敌人也不会使用冷却中的技能哦。
# 不想让特技窗口中显示冷却回合数, $冷却时间显示 = false 就行了。
# 冲突性:存在,但是除了RTAB外似乎整合难度不大。
#=======================================================================
$冷却时间显示 = true
module RPG
class Skill
def cold
return @name.split(/,/)[1]
end
def name(actor = nil)
if $冷却时间显示 and actor != nil and actor.cold[@id] != nil
a = (@name.split(/,/)[0] == nil ? 0 : @name.split(/,/)[0])
return a + "(" + actor.cold[@id].to_s + "回合冷却)"
else
return (@name.split(/,/)[0] == nil ? 0 : @name.split(/,/)[0])
end
end
end
end
class Game_Battler
attr_accessor :cold
alias initialize_cold :initialize
def initialize
[url=home.php?mod=space&uid=10437]@cold[/url] = {}
initialize_cold
end
def set_cold(key,val)
return if @cold[key] == nil
@cold[key] += val
@cold.delete(key) if @cold[key] <= 0
end
alias skill_can_use_addcold :skill_can_use?
def skill_can_use?(skill_id)
return false if @cold[skill_id] != nil
skill_can_use_addcold(skill_id)
end
end
class Scene_Battle
alias make_skill_action_result_addcold :make_skill_action_result
def make_skill_action_result
make_skill_action_result_addcold
if @skill.cold.to_i != 0
@active_battler.cold[@skill.id] = @skill.cold.to_i
end
end
alias start_phase4_addcold :start_phase4
def start_phase4
for i in $game_party.actors + $game_troop.enemies
for j in i.cold.keys
i.set_cold(j,-1)
end
end
start_phase4_addcold
end
end
#==============================================================================
# ■ Window_Skill
#------------------------------------------------------------------------------
# 特技画面、战斗画面、显示可以使用的特技浏览的窗口。
#==============================================================================
class Window_Skill < Window_Selectable
def draw_item(index)
skill = @data[index]
if @actor.skill_can_use?(skill.id)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
x = 4 + index % 2 * (288 + 32)
y = index / 2 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
bitmap = RPG::Cache.icon(skill.icon_name)
opacity = self.contents.font.color == normal_color ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
if $scene.is_a?(Scene_Battle)
self.contents.draw_text(x + 28, y, 204, 32, skill.name(@actor), 0)
else
self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
end
self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
end
end
class Game_Enemy < Game_Battler
def make_action
# 清除当前行动
self.current_action.clear
# 无法行动的情况
unless self.movable?
# 过程结束
return
end
# 抽取现在有效的行动
available_actions = []
rating_max = 0
for action in self.actions
# 确认回合条件
n = $game_temp.battle_turn
a = action.condition_turn_a
b = action.condition_turn_b
if (b == 0 and n != a) or
(b > 0 and (n < 1 or n < a or n % b != a % b))
next
end
# 确认 HP 条件
if self.hp * 100.0 / self.maxhp > action.condition_hp
next
end
if self.cold[action.skill_id] != nil
next
end
# 确认等级条件
if $game_party.max_level < action.condition_level
next
end
# 确认开关条件
switch_id = action.condition_switch_id
if switch_id > 0 and $game_switches[switch_id] == false
next
end
# 符合条件 : 添加本行动
available_actions.push(action)
if action.rating > rating_max
rating_max = action.rating
end
end
# 最大概率值作为 3 合计计算(0 除外)
ratings_total = 0
for action in available_actions
if action.rating > rating_max - 3
ratings_total += action.rating - (rating_max - 3)
end
end
# 概率合计不为 0 的情况下
if ratings_total > 0
# 生成随机数
value = rand(ratings_total)
# 设置对应生成随机数的当前行动
for action in available_actions
if action.rating > rating_max - 3
if value < action.rating - (rating_max - 3)
self.current_action.kind = action.kind
self.current_action.basic = action.basic
self.current_action.skill_id = action.skill_id
self.current_action.decide_random_target_for_enemy
return
else
value -= action.rating - (rating_max - 3)
end
end
end
end
end
end
#=======================================================================
#豪华版技能冷却系统
#=======================================================================
复制代码
作者:
512195574
时间:
2013-6-13 10:55
本帖最后由 512195574 于 2013-6-13 11:05 编辑
改完了,不知道是不是你要的效果·····
顺便一提,满意的话不要忘记在
http://rpg.blue/thread-244080-1-1.html
认可满意答案,不想再当活雷锋了············
晕,直接用代码的话总会添上些奇怪的东西,就上传txt附件了,txt打开后全选复制就行
顺序是先图标后技能冷却
两个脚本.rar
(3.04 KB, 下载次数: 84)
2013-6-13 11:04 上传
点击文件名下载附件
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1