After further testing, the only problem this creates is, it makes a consumable reuseable on the same target for some reason. Without the script call it auto prevents reusing a learn skill effect if they have the skill. In its current form it will be reusable and consume the item even if they already know the skill. For basic consumables that is still fine. For my purposes I need the reuse prevent.
I was able to convert it into a plugin that still makes the message appear and prevents the item reuse as intended for learn skills.
Game_Action.prototype.apply = function(target) {
const result = target.result();
this.subject().clearResult();
result.clear();
result.used = this.testApply(target);
result.missed = result.used && Math.random() >= this.itemHit(target);
result.evaded = !result.missed && Math.random() < this.itemEva(target);
result.physical = this.isPhysical();
result.drain = this.isDrain();
if (result.isHit()) {
if (this.item().damage.type > 0) {
result.critical = Math.random() < this.itemCri(target);
const value = this.makeDamageValue(target, result.critical);
this.executeDamage(target, value);
}
for (const effect of this.item().effects) {
this.applyItemEffect(target, effect);
if (effect?.code === Game_Action.EFFECT_LEARN_SKILL) {
const item = $dataItems[$gameTemp.lastActionData(1)];
const skill = $dataSkills[effect.dataId];
SceneManager.push(Scene_Map);
$gameMessage.add(`${target.name()} has learned \\I[${skill.iconIndex}]${skill.name}`);
}
}
this.applyItemUserEffect(target);
}
this.updateLastTarget(target);
};
It DOES overwrite the code for this section so may conflict with other plugins. It's probably not as good as it could be, but it works perfect for my project, and I thought I would share it.
Thanks again
@Arthran for the assist!