「スキルがクリティカルだとTPが5増加する」というプラグインを作ろうと思い、
見よう見まねで以下のように書いてみました。
コード: 全て選択
(function() {
Sprite_Damage.prototype.setup = function(target) {
var result = target.result();
if (result.missed || result.evaded) {
this.createMiss();
} else if (result.hpAffected) {
this.createDigits(0, result.hpDamage);
} else if (target.isAlive() && result.mpDamage !== 0) {
this.createDigits(2, result.mpDamage);
}
if (result.critical) {
if(BattleManager._action._subjectActorId != 0){
if(BattleManager._subject._actorId == 1){
$gameActors.actor(1).gainTp(5);
}
}
else{
敵の処理
}
this.setupCriticalEffect();
}
};
})();
ですが、敵の場合は全ての敵にクリティカル時の増加処理を入れたいと思っています。
(一応思いつく限りは試したのですが、どれもうまくいかず…)
敵の処理はいったいどのように書けばいいのでしょうか?
全体的に自信がないので、根本的におかしいところがあればご指摘ください。