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

Project1

 找回密码
 注册会员
搜索
查看: 3844|回复: 2
打印 上一主题 下一主题

[搬运汉化] 分享一个外站的装备耐久度插件

[复制链接]

Lv2.观梦者

梦石
0
星屑
342
在线时间
377 小时
注册时间
2013-1-30
帖子
219
跳转到指定楼层
1
发表于 2017-4-10 14:48:48 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
要论详细度的话还是YEP系列的装备耐久度设定的更详细。但YEP的耐久度插件太复杂了,不知道是不是和在下的其它插件冲突了,无限耐久度等许多设定都用不了。
所以在下搬来另一个简单点的装备耐久度插件,不需要任何前置插件,目前为止也没发现什么冲突和bug,好让大家能多一种装备耐久度的选择。
仅翻译了一些必要的地方,质量不高,但应该够用了吧……
{:2_248:}
JAVASCRIPT 代码复制
  1. //=============================================================================
  2. // Durability.js
  3. //=============================================================================
  4.  
  5. /*:
  6.  * @plugindesc Adds Minecraft-like durability of weapons/armors.
  7.  * <KockaDurability>
  8.  * @author KockaAdmiralac
  9.  *
  10.  * @help
  11.  * ============================================================================
  12.  *                              INTRODUCTION
  13.  * ============================================================================
  14.  * This plugin allows you to manage durability of your weapons and
  15.  * armors. It's very simple how durability is calculated :
  16.  * 1) 当你被攻击时, 你的防具会掉耐久度.
  17.  * 2) 当你攻击时, 你的武器会掉耐久度.
  18.  * 你的装备耐久度归0时,它会从你的装备栏转移到物品栏(至少本场战斗就用不了了)
  19.  *
  20.  * This plugin is made self-initiative.
  21.  * ============================================================================
  22.  *                                      NOTETAGS
  23.  * ============================================================================
  24.  * There are three notetags :
  25.  * - Weapon and Armor notetag :
  26.  *     <durability:x>
  27.  *   在这里设置装备的具体耐久度.
  28.  *   Example : <durability:1>
  29.  *   武器/防具的耐久度只有1点(一碰就碎).
  30.  *   如果不指定耐久度,该装备就是坚不可摧的.
  31.  *
  32.  * - Item and Skill notetags :
  33.  *     <durability_use:x>
  34.  *   在这里设置,使用该道具或技能会损失的耐久度.
  35.  *   Example : <durability_use:10>
  36.  *   如果这个道具/技能是由英雄使用的,他的武器会失去10点耐久度
  37.  *   如果这个道具/技能是由敌人使用的,被击中的英雄们的防具会失去10点耐久度
  38.  *
  39.  *     <durability_increase:[equips] increase>
  40.  *   这里是装备的耐久度提升(修复)的写法.
  41.  *           [equips] - 这里填写的是装备的种类编号,具体参考下面范例
  42.  *           increase - 这里可以填写一个具体的数值,也可以填写"MAX", 并且最多也就升到你设定的耐久度最大值
  43.  *   Example :
  44.  *   Notetag : <durability_increase:[1 2 3] 10>
  45.  *   这将修复你的1(武器)、2(盾牌)、3(头盔)号装备10点耐久度.
  46.  *   Notetag : <durability_increase[2 3 4] MAX>
  47.  *   这将完全修复你的2(盾牌)、3(头盔)、4(铠甲)号装备的耐久度.
  48.  *
  49.  * Since version 1.1.1 you can set variable durability use/increase.
  50.  * 你现在可以设置与HP, MP, TP伤害或一些变量挂钩的耐久度加减.
  51.  *         Example:
  52.  *        Notetag : <durability_use:hpDamage>
  53.  *         Result : 该技能会造成与HP伤害相等的耐久度伤害.
  54.  *
  55.  *         Notetag : <durability_increase:$gameVariables.variable(1)>
  56.  *        Result : 该技能/道具会修复与变量1相等的耐久度
  57.  * ============================================================================
  58.  *                              VERSION HISTORY
  59.  * ============================================================================
  60.  * Version | Description
  61.  * ________|___________________________________________________________________
  62.  * 1.0.0   | Initial release
  63.  * 1.1.0   | Added option for regenerating durability.                                                                        [Adlw]
  64.  * 1.1.1   | Added option for variable durability use                                                                                [Ozuma]
  65.  * ============================================================================
  66.  *                               COMPATIBILITY
  67.  * ============================================================================
  68.  * NEW :
  69.  *        <None>
  70.  *
  71.  * ALIASED :
  72.  *        - Game_Action :
  73.  *                - apply
  74.  *                - useItem
  75.  *
  76.  * OVERWRITTEN :
  77.  *        <None>
  78.  * ============================================================================
  79.  * @param Weapons
  80.  * @desc Specify what are your weapon slots here, separated by a space
  81.  * @default 1
  82.  *
  83.  * @param Armors
  84.  * @desc Specify what are your armor slots here, separated by a space
  85.  * @default 2 3 4 5
  86.  *
  87.  * @param Default durability use
  88.  * @desc How much durability points will item/skill take from weapon/armor
  89.  * when none is specified?
  90.  * @default 1
  91.  *
  92.  * @param Durability message
  93.  * @desc What message will be displayed when weapon/armor cracks?
  94.  * Set to empty to disable.
  95.  * @default %1 cracked!
  96.  */
  97. (function(){
  98.  
  99.  
  100.  
  101. // Aliases
  102. var _kocka_random_alias_apply_M7cAp2B8 = Game_Action.prototype.apply;
  103. var _kocka_random_alias_useItem_eb8T3mP2 = Game_Actor.prototype.useItem;
  104.  
  105.  
  106.  
  107. // Parameters
  108. var _plugin_params = $plugins.filter(function(p) { return p.description.contains('<KockaDurability>'); })[0].parameters;
  109. var temp_weapons = _plugin_params["Weapons"];
  110. var temp_armors = _plugin_params["Armors"];
  111. var default_durability_use = Number(_plugin_params["Default durability use"]);
  112. var durability_message = _plugin_params["Durability message"];
  113.  
  114.  
  115.  
  116. //-----------------------------------------------------------------------------
  117. // Game_Action
  118. //
  119. // The game object class for a battle action.
  120.  
  121. Game_Action.prototype.apply = function(target)
  122. {
  123.         _kocka_random_alias_apply_M7cAp2B8.apply(this, arguments);
  124.         if(target.result().idear())
  125.         {
  126.                 var array = ((this.subject() instanceof Game_Actor) ? temp_weapons : temp_armors).split(" ");
  127.                 var actor = (this.subject() instanceof Game_Actor) ? this.subject() : target;
  128.                 for(var i = 0; i < array.length; ++i)
  129.                 {
  130.                         var equip = actor.equips()[array[i] - 1];
  131.                         if(equip)
  132.                         {
  133.                                 if(!equip.durability)equip.durability = equip.meta.durability ? equip.meta.durability : -1;
  134.                                 var hasDurability = equip.durability != -1;
  135.                                 var result = target.result();
  136.                                 var hpDamage = result.hpDamage;
  137.                                 var mpDamage = result.mpDamage;
  138.                                 var tpDamage = result.tpDamage;
  139.                                 if(hasDurability)equip.durability -= this.item().meta.durability_use ? eval(this.item().meta.durability_use) : this.item().meta.durability_increase ? 0 : eval(default_durability_use);
  140.                                 if(equip.durability <= 0 && hasDurability)
  141.                                 {
  142.                                         if(durability_message != "")$gameMessage.add(durability_message.format(equip.name));
  143.                                         actor.changeEquipById(array[i], 0);
  144.                                 }
  145.                         }
  146.                 }
  147.         }
  148. }
  149.  
  150. Game_Actor.prototype.useItem = function(item)
  151. {
  152.         _kocka_random_alias_useItem_eb8T3mP2.apply(this, arguments);
  153.         if(item.meta.durability_increase)
  154.         {
  155.                 var arr = /\[(.+)\]\s*(\w+)/ig.exec(item.meta.durability_increase);
  156.                 if(arr)
  157.                 {
  158.                         var equips = this.equips();
  159.                         var splitEquips = arr[1].split(" ");
  160.                         for(var i = 0; i < splitEquips.length; ++i)
  161.                         {
  162.                                 var equip = equips[Number(splitEquips[i]) - 1];
  163.                                 if(equip)
  164.                                 {
  165.                                         if(equip.meta.durability)
  166.                                         {
  167.                                                 var maxDurability = Number(equip.meta.durability);
  168.                                                 if(!equip.durability)equip.durability = maxDurability;
  169.                                                 else
  170.                                                 {
  171.                                                         if(arr[2] === "MAX")equip.durability = maxDurability;
  172.                                                         else
  173.                                                         {
  174.                                                                 equip.durability += Number(arr[2]);
  175.                                                                 if(equip.durability > maxDurability)equip.durability = maxDurability;
  176.                                                         }
  177.                                                 }
  178.                                         }
  179.                                         else console.log("[Durability] You can't increase durability on equip that has no durability!");
  180.                                 }
  181.                         }
  182.                 }
  183.         }
  184. }
  185.  
  186. })();

Lv1.梦旅人

梦石
0
星屑
9
在线时间
2 小时
注册时间
2019-2-25
帖子
3
2
发表于 2019-2-26 00:43:50 | 只看该作者
大哥这个貌似有问题的,使用后战斗时
类型错误未定义不是函数
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-29 06:37

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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