多卡多卡 发表于 2019-7-30 22:37
var _Game_Action_executeDamage = Game_Action.prototype.executeDamage;
Game_Action.prototype.execute ...
多卡大神,我用了你的脚本,发现只要我一装备武器就报错:cannot read property 'params' of null
为此我改了代码,还是报这个错,请问为什么?// Author:Doka // Modified by cc Artermices // 如果要实现多个加成效果,就把第二个if里的复制一下改下参数就行了 var _Game_Action_executeDamage = Game_Action.prototype.executeDamage; Game_Action.prototype.executeDamage = function (target, value) { if(value>0)/*大于0时为伤害量,小于0时为治疗量*/{ if(this.subject().isActor() && this.subject().actorId() > 0 ){ if(this.subject()._classId == 16/*枪手*/){ this.subject().equips().forEach(function (equip){ if (equip != null && equip.wtypeId != undefined){ switch(equip.wtypeId){ case 9 /*轻枪*/: value *= 1.2;/*伤害倍率*/ break; case 20 /*重枪*/ value *= 1.1; break; default: } } }); }else if(this.subject()._classId == 17/*潜行者*/){ this.subject().equips().forEach(function (equip){ if (equip != null && equip.wtypeId != undefined){ switch(equip.wtypeId){ case 1 /*匕首*/: value *= 1.2; break; case 17 /*忍刀*/ value *= 1.1; break; default: } } }); } } } _Game_Action_executeDamage.call(this, target, value); }
// Author:Doka
// Modified by cc Artermices
// 如果要实现多个加成效果,就把第二个if里的复制一下改下参数就行了
var _Game_Action_executeDamage = Game_Action.prototype.executeDamage;
Game_Action.prototype.executeDamage = function (target, value) {
if(value>0)/*大于0时为伤害量,小于0时为治疗量*/{
if(this.subject().isActor() && this.subject().actorId() > 0 ){
if(this.subject()._classId == 16/*枪手*/){
this.subject().equips().forEach(function (equip){
if (equip != null && equip.wtypeId != undefined){
switch(equip.wtypeId){
case 9 /*轻枪*/:
value *= 1.2;/*伤害倍率*/
break;
case 20 /*重枪*/
value *= 1.1;
break;
default:
}
}
});
}else if(this.subject()._classId == 17/*潜行者*/){
this.subject().equips().forEach(function (equip){
if (equip != null && equip.wtypeId != undefined){
switch(equip.wtypeId){
case 1 /*匕首*/:
value *= 1.2;
break;
case 17 /*忍刀*/
value *= 1.1;
break;
default:
}
}
});
}
}
}
_Game_Action_executeDamage.call(this, target, value);
}
|