Game Enemy or Game Actor

I have a question regarding this part of the default script:

#-------------------------------------------------------------------------- # * Calculate Damage #-------------------------------------------------------------------------- def make_damage_value(user, item) value = item.damage.eval(user, self, $game_variables) value *= item_element_rate(user, item) value *= pdr if item.physical? value *= mdr if item.magical? value *= rec if item.damage.recover? value = apply_critical(value) if @result.critical value = apply_variance(value, item.damage.variance) value = apply_guard(value) @result.make_damage(value.to_i, item) endWhat if I want to know if its the game enemy or the actor who's attacking? From my past thread, it was indicated that self only works to the one who that attack is being applied to, not the one attacking.

Say for example I want to change the damage given according to either its the actor or the enemy, how can I determine if they are? Can I access their parameters as well?
The argument user refers to the user of the action. So user.atk, user.hp, etc, will work to get their stats. user.actor? will return true if they're an actor and false if they're an enemy.


Though if the skill is going to be different for actors and enemies, why not just have two copies of the skill in the database, an actor version and an enemy version?
user.actor?


user.enemy?


You should really put this in the skill (eg: damage formula, note box, etc), not the damage calculation.


The damage calculation method should not know anything about who is attacking. It doesn't need to care.


If I have a method that takes two numbers and adds them together, do you really want to have to check where the numbers are coming from?
I'll try to look at it 🙂

I'll see what I can do afterwards then come back when there's something I missed.

Original thread: https://forums.rpgmakerweb.com/threads/game-enemy-or-game-actor.23716/