//===========================================
// * KMessageTargetMV.js
//===========================================
/*:
* @plugindesc This plugin will let you add the enemy's name to a skill's
* action message by using a tag or wildcard.
* @author Kyonides Arkanthes
* @help Date: 2023-01-30
* # * Free as in beer. * #
* The regular expression or regex is %e by default.
*/
function KMessageTarget() {
throw new Error('This is a static class');
}
KMessageTarget.regex = /%e/i;
Window_BattleLog.prototype.displaySkillTargets = function(subject, item, targets) {
let target = 0;
let msg = "";
for (var i = 0; i < targets.length; i++) {
target = targets[i];
if (item.message1) {
msg = subject.name() + item.message1.format(item.name);
msg = msg.replace(KMessageTarget.regex, target.name());
this.push('addText', msg);
}
if (item.message2) {
this.push('addText', item.message2.format(item.name));
}
}
}
const KMessageTarget_win_btl_log_displayAction = Window_BattleLog.prototype.displayAction;
Window_BattleLog.prototype.displayAction = function(subject, item, targets) {
if (DataManager.isSkill(item)) {
this.displaySkillTargets(subject, item, targets);
} else {
KMessageTarget_win_btl_log_displayAction.call(subject, item);
}
};
Window_BattleLog.prototype.startAction = function(subject, action, targets) {
let item = action.item();
this.push('performActionStart', subject, action);
this.push('waitForMovement');
this.push('performAction', subject, action);
this.push('showAnimation', subject, targets.clone(), item.animationId);
this.displayAction(subject, item, targets);
};