Obtain Properties of current action

I have four scenarios:

Actor (the player) receives damage from an enemy.
Actor receives damage from another actor.

Enemy receives damage from an actor (the player).
Enemy receives damage from another enemy.

How can I distinguish each scenario and run different code accordingly?
The following gives the error: "TypeError. Cannot read property isForOpponent of undefined"

Code:
if (BattleManager._subject.isActor()) {
    if (BattleManager._subject.currentAction().isForOpponent()){
        
    }else{
        
    }
} else {
    if (BattleManager._subject.currentAction().isForOpponent()){
        
    }else{
        
    }
}

Spoiler
Code:
I got the idea from a piece of code:
...
var action = user.currentAction();
if (action && action.isForOpponent()) {
...
So I thought it would have worked

Alternatively, if I can figure out how to do BattleManager._subject.isActor() but for the target instead (i.e. check if the target is actor or not) that'll be nice.

Original thread: https://forums.rpgmakerweb.com/threads/obtain-properties-of-current-action.78707/