发现了一个严重BUG,升级后的技能只是显示数值提高了,但是实际伤害没有改变。使用这段代码替换来修复:
// 修改伤害应用部分 Yours.skillUpgrade.alias.Game_Action_apply = Game_Action.prototype.apply; Game_Action.prototype.apply = function(target) { if (this.subject() instanceof Game_Actor && this.isSkill()) { const skillId = this.item().id; if (this.subject().getSkillConfig(skillId)) { // 先获取伤害系数 const damageCoefficient = this.subject().getSkillDamageCoefficient(skillId); // 检查是否为伤害性技能 if (this.item().damage.type > 0) { // 临时修改技能的基础伤害公式,加入伤害系数 const originalFormula = this.item().damage.formula; if (damageCoefficient !== 1) { // 在公式中乘以系数 this.item().damage.formula = `(${originalFormula}) * ${damageCoefficient}`; } // 应用伤害 Yours.skillUpgrade.alias.Game_Action_apply.call(this, target); // 恢复原始公式 this.item().damage.formula = originalFormula; // 增加经验 this.subject().gainSkillExp(skillId); return; } } } // 非技能或不需要修改的情况 Yours.skillUpgrade.alias.Game_Action_apply.call(this, target); }; // 移除之前在apply中修改伤害结果的代码,因为现在已经在公式中处理了
// 修改伤害应用部分
Yours.skillUpgrade.alias.Game_Action_apply = Game_Action.prototype.apply;
Game_Action.prototype.apply = function(target) {
if (this.subject() instanceof Game_Actor && this.isSkill()) {
const skillId = this.item().id;
if (this.subject().getSkillConfig(skillId)) {
// 先获取伤害系数
const damageCoefficient = this.subject().getSkillDamageCoefficient(skillId);
// 检查是否为伤害性技能
if (this.item().damage.type > 0) {
// 临时修改技能的基础伤害公式,加入伤害系数
const originalFormula = this.item().damage.formula;
if (damageCoefficient !== 1) {
// 在公式中乘以系数
this.item().damage.formula = `(${originalFormula}) * ${damageCoefficient}`;
}
// 应用伤害
Yours.skillUpgrade.alias.Game_Action_apply.call(this, target);
// 恢复原始公式
this.item().damage.formula = originalFormula;
// 增加经验
this.subject().gainSkillExp(skillId);
return;
}
}
}
// 非技能或不需要修改的情况
Yours.skillUpgrade.alias.Game_Action_apply.call(this, target);
};
// 移除之前在apply中修改伤害结果的代码,因为现在已经在公式中处理了
|