var makeDamageValue = Game_Action.prototype.makeDamageValue;
Game_Action.prototype.makeDamageValue = function(target, critical) {
var value = makeDamageValue.call(this, target, critical);
value *= this.applyElementType(target);
return Math.round(value); // 放置Math.round的位置会影响伤害的精度。
};
Game_Action.prototype.applyElementType = function(target) {
var subject = this.subject();
var element_a = subject.elementType(); // elementType是不存在的方法,这里假设elementType可以获取战斗角色的光暗属性
var element_b = target.elementType();
return {
"light": { "light": 1, "dark": 2 },
"dark": { "light": 0.5, "dark": 1 },
}[element_a][element_b];
};
var makeDamageValue = Game_Action.prototype.makeDamageValue;
Game_Action.prototype.makeDamageValue = function(target, critical) {
var value = makeDamageValue.call(this, target, critical);
value *= this.applyElementType(target);
return Math.round(value); // 放置Math.round的位置会影响伤害的精度。
};
Game_Action.prototype.applyElementType = function(target) {
var subject = this.subject();
var element_a = subject.elementType(); // elementType是不存在的方法,这里假设elementType可以获取战斗角色的光暗属性
var element_b = target.elementType();
return {
"light": { "light": 1, "dark": 2 },
"dark": { "light": 0.5, "dark": 1 },
}[element_a][element_b];
};