我只是一个搬运工,脚本是大佬写的,没有毛病
#==============================================================================#在技能的备注写<冷却时间 x>
class RPG::Skill < RPG::UsableItem
def cool_time
@note.each_line{|line|
case line
when /\<(?:冷却时间)[ ]*(\d+)\>/
return $1.to_i
end
}
return 0
end
end
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# 管理角色的类。
# 本类在 Game_Actors 类 ($game_actors) 的内部使用。
# 具体使用请查看 Game_Party 类 ($game_party) 。
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
alias skill_cool_time_initialize initialize
def initialize
skill_cool_time_initialize
@skill_cool_time=[]
end
#--------------------------------------------------------------------------
# ● 应用技能/物品的效果
#--------------------------------------------------------------------------
alias skill_cool_time_item_apply item_apply
def item_apply(user, item)
skill_cool_time_item_apply(user,item)
if item.is_a?(RPG::Skill)
user.set_cool_time(item)
end
end
#--------------------------------------------------------------------------
# ● 设置技能冷却时间
#--------------------------------------------------------------------------
def set_cool_time(skill)
if skill.cool_time
@skill_cool_time[skill.id] = skill.cool_time
end
end
#--------------------------------------------------------------------------
# ● 回合结束处理
#--------------------------------------------------------------------------
alias skill_cool_time_on_turn_end on_turn_end
def on_turn_end
skill_cool_time_on_turn_end
@skill_cool_time.each_index{|index|
@skill_cool_time[index] -= 1 if @skill_cool_time[index] and @skill_cool_time[index] > 0
}
end
#--------------------------------------------------------------------------
# ● 技能是否正在冷却
#--------------------------------------------------------------------------
def skill_cooling?(skill)
@skill_cool_time[skill.id] and @skill_cool_time[skill.id] != 0
end
#--------------------------------------------------------------------------
# ● 获取冷却回合
#--------------------------------------------------------------------------
def skill_cool_turn(skill)
@skill_cool_time[skill.id] ? @skill_cool_time[skill.id] : 0
end
#--------------------------------------------------------------------------
# ● 检查技能的使用条件
#--------------------------------------------------------------------------
alias skill_cool_time_skill_conditions_met? skill_conditions_met?
def skill_conditions_met?(skill)
skill_cool_time_skill_conditions_met?(skill) && !skill_cooling?(skill)
end
#--------------------------------------------------------------------------
# ● 战斗结束处理
#--------------------------------------------------------------------------
alias skill_cool_time_on_battle_end on_battle_end
def on_battle_end
skill_cool_time_on_battle_end
@skill_cool_time.clear
end
end
#==============================================================================
# ■ Window_SkillList
#------------------------------------------------------------------------------
# 技能画面中,显示技能的窗口。
#==============================================================================
class Window_SkillList < Window_Selectable
#--------------------------------------------------------------------------
# ● 绘制项目
#--------------------------------------------------------------------------
alias skill_cool_time_draw_item draw_item
def draw_item(index)
skill = @data[index]
if skill
if @actor.skill_cooling?(skill)
rect = item_rect(index)
w = (skill.cool_time - @actor.skill_cool_turn(skill)).to_f / skill.cool_time
draw_gauge(rect.x,rect.y,rect.width,w,text_color(5),text_color(13))
end
end
skill_cool_time_draw_item(index)
end
end
#==============================================================================#在技能的备注写<冷却时间 x>
class RPG::Skill < RPG::UsableItem
def cool_time
@note.each_line{|line|
case line
when /\<(?:冷却时间)[ ]*(\d+)\>/
return $1.to_i
end
}
return 0
end
end
#==============================================================================
# ■ Game_Actor
#------------------------------------------------------------------------------
# 管理角色的类。
# 本类在 Game_Actors 类 ($game_actors) 的内部使用。
# 具体使用请查看 Game_Party 类 ($game_party) 。
#==============================================================================
class Game_Battler
#--------------------------------------------------------------------------
# ● 初始化对象
#--------------------------------------------------------------------------
alias skill_cool_time_initialize initialize
def initialize
skill_cool_time_initialize
@skill_cool_time=[]
end
#--------------------------------------------------------------------------
# ● 应用技能/物品的效果
#--------------------------------------------------------------------------
alias skill_cool_time_item_apply item_apply
def item_apply(user, item)
skill_cool_time_item_apply(user,item)
if item.is_a?(RPG::Skill)
user.set_cool_time(item)
end
end
#--------------------------------------------------------------------------
# ● 设置技能冷却时间
#--------------------------------------------------------------------------
def set_cool_time(skill)
if skill.cool_time
@skill_cool_time[skill.id] = skill.cool_time
end
end
#--------------------------------------------------------------------------
# ● 回合结束处理
#--------------------------------------------------------------------------
alias skill_cool_time_on_turn_end on_turn_end
def on_turn_end
skill_cool_time_on_turn_end
@skill_cool_time.each_index{|index|
@skill_cool_time[index] -= 1 if @skill_cool_time[index] and @skill_cool_time[index] > 0
}
end
#--------------------------------------------------------------------------
# ● 技能是否正在冷却
#--------------------------------------------------------------------------
def skill_cooling?(skill)
@skill_cool_time[skill.id] and @skill_cool_time[skill.id] != 0
end
#--------------------------------------------------------------------------
# ● 获取冷却回合
#--------------------------------------------------------------------------
def skill_cool_turn(skill)
@skill_cool_time[skill.id] ? @skill_cool_time[skill.id] : 0
end
#--------------------------------------------------------------------------
# ● 检查技能的使用条件
#--------------------------------------------------------------------------
alias skill_cool_time_skill_conditions_met? skill_conditions_met?
def skill_conditions_met?(skill)
skill_cool_time_skill_conditions_met?(skill) && !skill_cooling?(skill)
end
#--------------------------------------------------------------------------
# ● 战斗结束处理
#--------------------------------------------------------------------------
alias skill_cool_time_on_battle_end on_battle_end
def on_battle_end
skill_cool_time_on_battle_end
@skill_cool_time.clear
end
end
#==============================================================================
# ■ Window_SkillList
#------------------------------------------------------------------------------
# 技能画面中,显示技能的窗口。
#==============================================================================
class Window_SkillList < Window_Selectable
#--------------------------------------------------------------------------
# ● 绘制项目
#--------------------------------------------------------------------------
alias skill_cool_time_draw_item draw_item
def draw_item(index)
skill = @data[index]
if skill
if @actor.skill_cooling?(skill)
rect = item_rect(index)
w = (skill.cool_time - @actor.skill_cool_turn(skill)).to_f / skill.cool_time
draw_gauge(rect.x,rect.y,rect.width,w,text_color(5),text_color(13))
end
end
skill_cool_time_draw_item(index)
end
end