分享一个外站的装备耐久度插件
要论详细度的话还是YEP系列的装备耐久度设定的更详细。但YEP的耐久度插件太复杂了,不知道是不是和在下的其它插件冲突了,无限耐久度等许多设定都用不了。所以在下搬来另一个简单点的装备耐久度插件,不需要任何前置插件,目前为止也没发现什么冲突和bug,好让大家能多一种装备耐久度的选择。
仅翻译了一些必要的地方,质量不高,但应该够用了吧……
{:2_248:}
JAVASCRIPT 代码
//=============================================================================
// Durability.js
//=============================================================================
/*:
* @plugindesc Adds Minecraft-like durability of weapons/armors.
*
* @author KockaAdmiralac
*
* @help
* ============================================================================
* INTRODUCTION
* ============================================================================
* This plugin allows you to manage durability of your weapons and
* armors. It's very simple how durability is calculated :
* 1) 当你被攻击时, 你的防具会掉耐久度.
* 2) 当你攻击时, 你的武器会掉耐久度.
* 你的装备耐久度归0时,它会从你的装备栏转移到物品栏(至少本场战斗就用不了了)
*
* This plugin is made self-initiative.
* ============================================================================
* NOTETAGS
* ============================================================================
* There are three notetags :
* - Weapon and Armor notetag :
*
* 在这里设置装备的具体耐久度.
* Example :
* 武器/防具的耐久度只有1点(一碰就碎).
* 如果不指定耐久度,该装备就是坚不可摧的.
*
* - Item and Skill notetags :
*
* 在这里设置,使用该道具或技能会损失的耐久度.
* Example :
* 如果这个道具/技能是由英雄使用的,他的武器会失去10点耐久度
* 如果这个道具/技能是由敌人使用的,被击中的英雄们的防具会失去10点耐久度
*
*
* 这里是装备的耐久度提升(修复)的写法.
* - 这里填写的是装备的种类编号,具体参考下面范例
* increase - 这里可以填写一个具体的数值,也可以填写"MAX", 并且最多也就升到你设定的耐久度最大值
* Example :
* Notetag :
* 这将修复你的1(武器)、2(盾牌)、3(头盔)号装备10点耐久度.
* Notetag :
* 这将完全修复你的2(盾牌)、3(头盔)、4(铠甲)号装备的耐久度.
*
* Since version 1.1.1 you can set variable durability use/increase.
* 你现在可以设置与HP, MP, TP伤害或一些变量挂钩的耐久度加减.
* Example:
* Notetag :
* Result : 该技能会造成与HP伤害相等的耐久度伤害.
*
* Notetag :
* Result : 该技能/道具会修复与变量1相等的耐久度
* ============================================================================
* VERSION HISTORY
* ============================================================================
* Version | Description
* ________|___________________________________________________________________
* 1.0.0 | Initial release
* 1.1.0 | Added option for regenerating durability.
* 1.1.1 | Added option for variable durability use
* ============================================================================
* COMPATIBILITY
* ============================================================================
* NEW :
*
*
* ALIASED :
* - Game_Action :
* - apply
* - useItem
*
* OVERWRITTEN :
*
* ============================================================================
* @param Weapons
* @desc Specify what are your weapon slots here, separated by a space
* @default 1
*
* @param Armors
* @desc Specify what are your armor slots here, separated by a space
* @default 2 3 4 5
*
* @param Default durability use
* @desc How much durability points will item/skill take from weapon/armor
* when none is specified?
* @default 1
*
* @param Durability message
* @desc What message will be displayed when weapon/armor cracks?
* Set to empty to disable.
* @default %1 cracked!
*/
(function(){
// Aliases
var _kocka_random_alias_apply_M7cAp2B8 = Game_Action.prototype.apply;
var _kocka_random_alias_useItem_eb8T3mP2 = Game_Actor.prototype.useItem;
// Parameters
var _plugin_params = $plugins.filter(function(p){return p.description.contains(''); }).parameters;
var temp_weapons = _plugin_params["Weapons"];
var temp_armors = _plugin_params["Armors"];
var default_durability_use = Number(_plugin_params["Default durability use"]);
var durability_message = _plugin_params["Durability message"];
//-----------------------------------------------------------------------------
// Game_Action
//
// The game object class for a battle action.
Game_Action.prototype.apply = function(target)
{
_kocka_random_alias_apply_M7cAp2B8.apply(this, arguments);
if(target.result().idear())
{
var array = ((this.subject()instanceof Game_Actor) ? temp_weapons : temp_armors).split(" ");
var actor = (this.subject()instanceof Game_Actor) ? this.subject() : target;
for(var i = 0; i < array.length; ++i)
{
var equip = actor.equips() - 1];
if(equip)
{
if(!equip.durability)equip.durability = equip.meta.durability ? equip.meta.durability : -1;
var hasDurability = equip.durability != -1;
var result = target.result();
var hpDamage = result.hpDamage;
var mpDamage = result.mpDamage;
var tpDamage = result.tpDamage;
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);
if(equip.durabilitymaxDurability)equip.durability = maxDurability;
}
}
}
else console.log(" You can't increase durability on equip that has no durability!");
}
}
}
}
}
})();
本帖来自P1论坛作者qknight,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=399887若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。
页:
[1]