Not as easy as .call you're right about that. Now the issue is more or less what is what.
this._enemy referencing? my guess is it's referencing a `
Game_Enemy` or a
`Game_Actor` in which case both inherit from
`Game_BattlerBase`. If this is the case, then the best bet would be to place that function as a method of
Game_BattlerBase. Sometimes this is not easy either because other methods may rely on that specific method.
It's not easy to figure this out without seeing all the code but give this a try. Create a new function in
Game_BattlerBase or if you know the exact class
this._enemy is referencing then you may create the function in that class.
PHP:Game_BattlerBase.prototype.checkTreasurePopup = function() {
this._treasure.item = this.makeDropItems();
this._treasure.checked = true;
if (this._treasure.item) {
this._treasure.needPopup = true;
$gameTemp._trBatNeedPopUp = true;
};
};
Now form what I remember
Game_Action.prototype.apply = function(target) the target is actually either a
Game_Actor or a
Game_Enemy, either way both inherit from
Game_BattlerBase as I've already mentioned so this should work but I can't be sure as I'm unsure what's what without seeing all the code.
Then in your
apply() method you can use target, because target will have access to the method inside
Game_BattlerBase
PHP:Game_Action.prototype.apply = function (target) {
target.checkTreasurePopup()
}
Hopefully this helps you understand things a bit more and maybe you can figure out your own solution with the info. Cheers!