查看: 2928|回复: 1

[原创发布] 手动式装备评分限制更换

[复制链接]
梦石
0
星屑
30103
在线时间
5741 小时
注册时间
2016-3-8
回帖
1662
发表于 2021-2-19 11:54:01 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 alexncf125 于 2021-2-19 19:41 编辑

使用方法...往装备的备注栏写上<score:分数>
比如说, 武器A写了<score:10>, 武器B写了<score:200>
写好后...角色装备上武器B时, 会变得不能換装成武器A

注意...这个脚本与最强装备的机制产生了一个小bug...最强装备会是分数最高的装备...但当遇上"最高分数相同的两件装备"的情況时...不会根据两件装备的属性来決定最强装备...所以一是不要写相同的分数, 一是依此折叠内容删除「最强装备」功能
  1. class Window_EquipCommand < Window_HorzCommand
  2.   def col_max
  3.     return 2
  4.   end

  5.   def make_command_list
  6.     add_command(Vocab::equip2,   :equip)
  7.     add_command(Vocab::clear,    :clear)
  8.   end
  9. end
复制代码


  1. class Game_BattlerBase
  2.   alias score_equippable? equippable?
  3.   def equippable?(item)
  4.     if item
  5.       item.note =~ /<score:(\d+)>/i
  6.       new_score = $1.to_i
  7.       if @equips[item.etype_id].object
  8.         @equips[item.etype_id].object.note =~ /<score:(\d+)>/i
  9.         old_score = $1.to_i
  10.       end
  11.     end
  12.     new_score ||= 0; old_score ||= 0
  13.     return false if new_score < old_score
  14.     return score_equippable?(item)
  15.   end
  16. end

  17. class Game_Actor < Game_Battler
  18.   alias score_change_equip change_equip
  19.   def change_equip(slot_id, item)
  20.     if item
  21.       item.note =~ /<score:(\d+)>/i
  22.       new_score = $1.to_i
  23.     end
  24.     if @equips[slot_id].object
  25.       @equips[slot_id].object.note =~ /<score:(\d+)>/i
  26.       old_score = $1.to_i
  27.     end
  28.     new_score ||= 0; old_score ||= 0
  29.     return if new_score < old_score
  30.     return score_change_equip(slot_id, item)
  31.   end
  32. end

  33. class Window_EquipItem < Window_ItemList

  34.   def include?(item)
  35.     return true if item == nil
  36.     return false unless item.is_a?(RPG::EquipItem)
  37.     return false if @slot_id < 0
  38.     return false if item.etype_id != @actor.equip_slots[@slot_id]
  39.     return true#~     return @actor.equippable?(item)
  40.   end
  41.   
  42.   def enable?(item)
  43.     return true if item.nil?
  44.     return @actor.equippable?(item)#~     return true
  45.   end

  46. end
复制代码
梦石
0
星屑
1107
在线时间
126 小时
注册时间
2020-11-27
回帖
48
发表于 2021-2-23 12:14:06 | 显示全部楼层
支持大佬!
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部