One small problem with my state trick

I am having difficulty setting up certain switch states in which I must divide some of the effects of a state between the caster and target. Example:

I have a state called raise defense. It is a single target spell. I want this spell to have a small drawback in which activating this spell will slightly decrease attack strength. But if the state is applied to someone else, the one casting the state, a state which must be removed manually by the caster, I can't figure out how to distinguish between the caster losing some attack strength for being the one that activated the spell, while the target, other than self gets only the benefits of their defenses raised. Think of it like the caster being busy protecting someone so there is some give and take. How would I set up the states for this?

In other words, Tom uses Raise defense on himself. Toms defenses are raised but tom loses some attack strength.

Tom uses raise defense on Marcus. Marcus defenses are raised but Tom, busy protecting Marcus with Riase defense, will lose some attack strength, because Tom activated the spell.

This falls in line with my Switch State tutorial. I know how to do it for single target self and for spells that affect the whole party. But I can't get the trick to having single target spells divide the effects.
well, you can add a method like this on game_battler

def shield(target) self.add_state(state id for reduce attack) target.add_state(state id for increase defense)endthen on your damage formula:a.shield( b ) ; damage_formula

in case it doesn't work do this:

def shield(caster,target) caster.add_state(state id for reduce attack) target.add_state(state id for increase defense)endthen on your damage formula:a.shield( a,b ) ; damage_formula

Doing this, the caster gets reduced attack while the target gets increased defense
I'll save these ideas and try them out when I can. I'm just running on empty right now. Not many good things happening over here.
well what about this formula?

a.add_state(x); b.add_state(y); damage formula herei haven't tested it yet, but change the x and y into the appropriate states you want to apply

Original thread: https://forums.rpgmakerweb.com/threads/one-small-problem-with-my-state-trick.22319/