设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2041|回复: 1

[已经解决] 光标选中显示图标和技能CD整合

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
274 小时
注册时间
2008-2-18
帖子
219
发表于 2013-6-12 11:44:10 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
如题 这两个脚本起了冲突 本来是光标选中技能后才有技能图标 现在用了技能CD整合后 这两个脚本就不能一起用了
请帮忙整合一下
  1. #==============================================================================
  2. # ■ Window_Skill
  3. #------------------------------------------------------------------------------
  4. #  特技画面、战斗画面、显示可以使用的特技浏览的窗口。
  5. #==============================================================================

  6. class Window_Skill < Window_Selectable
  7. #--------------------------------------------------------------------------
  8. # ● 初始化对像
  9. #     actor : 角色
  10. #--------------------------------------------------------------------------
  11. def initialize(actor)
  12.    super(0, 128, 640, 352)
  13.    [url=home.php?mod=space&uid=95897]@actor[/url] = actor
  14.    @column_max = 2
  15.    self.index = 0
  16.    refresh
  17.    @idx = self.index
  18.    # 战斗中的情况下将窗口移至中央并将其半透明化
  19.    if $game_temp.in_battle
  20.      self.y = 64
  21.      self.height = 256
  22.      self.back_opacity = 160
  23.    end
  24. end
  25. #--------------------------------------------------------------------------
  26. # ● 获取特技
  27. #--------------------------------------------------------------------------
  28. def skill
  29.    return @data[self.index]
  30. end

  31. #--------------------------------------------------------------------------
  32. # ● 刷新
  33. #--------------------------------------------------------------------------
  34. def refresh
  35.    if self.contents != nil
  36.      self.contents.dispose
  37.      self.contents = nil
  38.    end
  39.    @data = []
  40.    for i in [email protected]
  41.      skill = $data_skills[@actor.skills[i]]
  42.      if skill != nil
  43.        @data.push(skill)
  44.      end
  45.    end
  46.    # 如果项目数不是 0 就生成位图、重新描绘全部项目
  47.    @item_max = @data.size
  48.    if @item_max > 0
  49.      self.contents = Bitmap.new(width - 32, row_max * 32)
  50.      for i in 0...@item_max
  51.        if i == self.index
  52.          draw_item2(i)
  53.        else
  54.          draw_item(i)
  55.        end
  56.      end
  57.    end
  58. end
  59. #--------------------------------------------------------------------------
  60. # ● 描绘项目
  61. #     index : 项目编号
  62. #--------------------------------------------------------------------------

  63. def draw_item(index)
  64.    skill = @data[index]
  65.    if @actor.skill_can_use?(skill.id)
  66.      self.contents.font.color = normal_color
  67.    else
  68.      self.contents.font.color = disabled_color
  69.    end
  70.    x = 4 + index % 2 * (288 + 32)
  71.    y = index / 2 * 32
  72.    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  73.    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  74.    #bitmap = RPG::Cache.icon(skill.icon_name)
  75.    #opacity = self.contents.font.color == normal_color ? 255 : 128
  76.    #self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  77.    self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  78.    self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  79. end
  80. #--------------------------------------------------------------------------
  81. # ● 描绘项目
  82. #     index : 项目编号
  83. #--------------------------------------------------------------------------
  84. def draw_item2(index)
  85.    skill = @data[index]
  86.    if @actor.skill_can_use?(skill.id)
  87.      self.contents.font.color = normal_color
  88.    else
  89.      self.contents.font.color = disabled_color
  90.    end
  91.    x = 4 + index % 2 * (288 + 32)
  92.    y = index / 2 * 32
  93.    rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  94.    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  95.    bitmap = RPG::Cache.icon(skill.icon_name)
  96.    opacity = self.contents.font.color == normal_color ? 255 : 128
  97.    self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  98.    self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  99.    self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  100. end
  101. #--------------------------------------------------------------------------
  102. # ● 刷新帮助文本
  103. #--------------------------------------------------------------------------
  104. def update_help
  105.    @help_window.set_text(self.skill == nil ? "" : self.skill.description)
  106. end
  107. #--------------------------------------------------------------------------
  108. # ● 刷新画面
  109. #--------------------------------------------------------------------------
  110. def update
  111.    super
  112.    if @idx != self.index
  113.      refresh
  114.      @idx = self.index
  115.    end
  116. end
  117. end

复制代码
  1. #=======================================================================
  2. #  豪华版技能冷却系统 By 绿发的Eclair
  3. #  使用方法:在特技名称后面用半角逗号分割,写上冷却回合数。
  4. #  比如 十字斩,10 就是特技 十字斩 冷却10个回合了。
  5. #  注意这个冷却是敌我通用的,不只是我方,敌人也不会使用冷却中的技能哦。
  6. #  不想让特技窗口中显示冷却回合数, $冷却时间显示 = false 就行了。
  7. #  冲突性:存在,但是除了RTAB外似乎整合难度不大。
  8. #=======================================================================
  9. $冷却时间显示 = true
  10. module RPG
  11.   class Skill
  12.   def cold
  13.     return @name.split(/,/)[1]
  14.   end
  15.   def name(actor = nil)
  16.     if $冷却时间显示 and actor != nil and actor.cold[@id] != nil
  17.       a = (@name.split(/,/)[0] == nil ? 0 : @name.split(/,/)[0])
  18.       return a + "(" + actor.cold[@id].to_s + "回合冷却)"
  19.     else
  20.       return (@name.split(/,/)[0] == nil ? 0 : @name.split(/,/)[0])
  21.     end
  22.   end
  23.   end
  24. end
  25. class Game_Battler
  26.   attr_accessor :cold
  27.   alias initialize_cold :initialize
  28.   def initialize
  29.     [url=home.php?mod=space&uid=10437]@cold[/url] = {}
  30.     initialize_cold
  31.   end
  32.   def set_cold(key,val)
  33.     return if @cold[key] == nil
  34.     @cold[key] += val
  35.     @cold.delete(key) if @cold[key] <= 0
  36.   end
  37.   alias skill_can_use_addcold :skill_can_use?
  38.   def skill_can_use?(skill_id)
  39.     return false if @cold[skill_id] != nil
  40.     skill_can_use_addcold(skill_id)
  41.   end
  42. end
  43. class Scene_Battle
  44.   alias make_skill_action_result_addcold :make_skill_action_result
  45.   def make_skill_action_result
  46.     make_skill_action_result_addcold
  47.     if @skill.cold.to_i != 0
  48.     @active_battler.cold[@skill.id] = @skill.cold.to_i
  49.     end
  50.   end
  51.   alias start_phase4_addcold :start_phase4
  52.   def start_phase4
  53.     for i in $game_party.actors + $game_troop.enemies
  54.       for j in i.cold.keys
  55.       i.set_cold(j,-1)
  56.       end   
  57.     end   
  58.     start_phase4_addcold
  59.   end     
  60. end   
  61. #==============================================================================
  62. # ■ Window_Skill
  63. #------------------------------------------------------------------------------
  64. #  特技画面、战斗画面、显示可以使用的特技浏览的窗口。
  65. #==============================================================================
  66. class Window_Skill < Window_Selectable
  67.     def draw_item(index)
  68.     skill = @data[index]
  69.     if @actor.skill_can_use?(skill.id)
  70.       self.contents.font.color = normal_color
  71.     else
  72.       self.contents.font.color = disabled_color
  73.     end
  74.     x = 4 + index % 2 * (288 + 32)
  75.     y = index / 2 * 32
  76.     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
  77.     self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
  78.     bitmap = RPG::Cache.icon(skill.icon_name)
  79.     opacity = self.contents.font.color == normal_color ? 255 : 128
  80.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  81.     if $scene.is_a?(Scene_Battle)
  82.     self.contents.draw_text(x + 28, y, 204, 32, skill.name(@actor), 0)
  83.     else
  84.     self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
  85.     end
  86.     self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
  87.   end
  88. end

  89. class Game_Enemy < Game_Battler
  90.     def make_action
  91.     # 清除当前行动
  92.     self.current_action.clear
  93.     # 无法行动的情况
  94.     unless self.movable?
  95.       # 过程结束
  96.       return
  97.     end
  98.     # 抽取现在有效的行动
  99.     available_actions = []
  100.     rating_max = 0
  101.     for action in self.actions
  102.       # 确认回合条件
  103.       n = $game_temp.battle_turn
  104.       a = action.condition_turn_a
  105.       b = action.condition_turn_b
  106.       if (b == 0 and n != a) or
  107.          (b > 0 and (n < 1 or n < a or n % b != a % b))
  108.         next
  109.       end
  110.       # 确认 HP 条件
  111.       if self.hp * 100.0 / self.maxhp > action.condition_hp
  112.         next
  113.       end
  114.       if self.cold[action.skill_id] != nil
  115.         next
  116.       end
  117.       # 确认等级条件
  118.       if $game_party.max_level < action.condition_level
  119.         next
  120.       end
  121.       # 确认开关条件
  122.       switch_id = action.condition_switch_id
  123.       if switch_id > 0 and $game_switches[switch_id] == false
  124.         next
  125.       end
  126.       # 符合条件 : 添加本行动
  127.       available_actions.push(action)
  128.       if action.rating > rating_max
  129.         rating_max = action.rating
  130.       end
  131.     end
  132.     # 最大概率值作为 3 合计计算(0 除外)
  133.     ratings_total = 0
  134.     for action in available_actions
  135.       if action.rating > rating_max - 3
  136.         ratings_total += action.rating - (rating_max - 3)
  137.       end
  138.     end
  139.     # 概率合计不为 0 的情况下
  140.     if ratings_total > 0
  141.       # 生成随机数
  142.       value = rand(ratings_total)
  143.       # 设置对应生成随机数的当前行动
  144.       for action in available_actions
  145.         if action.rating > rating_max - 3
  146.           if value < action.rating - (rating_max - 3)
  147.             self.current_action.kind = action.kind
  148.             self.current_action.basic = action.basic
  149.             self.current_action.skill_id = action.skill_id
  150.             self.current_action.decide_random_target_for_enemy
  151.             return
  152.           else
  153.             value -= action.rating - (rating_max - 3)
  154.           end
  155.         end
  156.       end
  157.     end
  158.   end
  159. end
  160. #=======================================================================
  161. #豪华版技能冷却系统
  162. #=======================================================================

复制代码

Lv1.梦旅人

梦石
0
星屑
50
在线时间
192 小时
注册时间
2010-8-23
帖子
161
发表于 2013-6-13 10:55:20 | 显示全部楼层
本帖最后由 512195574 于 2013-6-13 11:05 编辑

改完了,不知道是不是你要的效果·····
顺便一提,满意的话不要忘记在 http://rpg.blue/thread-244080-1-1.html 认可满意答案,不想再当活雷锋了············

晕,直接用代码的话总会添上些奇怪的东西,就上传txt附件了,txt打开后全选复制就行
顺序是先图标后技能冷却
两个脚本.rar (3.04 KB, 下载次数: 84)

评分

参与人数 1星屑 +140 收起 理由
hys111111 + 140 认可答案

查看全部评分

其实我是个三流的画师  ←_←
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-3-29 18:37

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表