扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 106|回复: 0

[转载发布] 分享一个外站的装备耐久度插件

[复制链接]
累计送礼:
0 个
累计收礼:
0 个
  • TA的每日心情
    开心
    2025-2-4 02:05
  • 签到天数: 110 天

    连续签到: 2 天

    [LV.6]常住居民II

    2327

    主题

    395

    回帖

    1万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    6
    卡币
    10475
    OK点
    16
    推广点
    0
    同能卷
    0
    积分
    13225

    灌水之王

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

                 本帖来自P1论坛作者qknight,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=399887  若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2025-3-10 22:22 , Processed in 0.131303 second(s), 54 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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