Passive that if learnt applies DoT??

Im trying to make some skills that apply a state when used, also if you learnt a passive it upgrades that state to have a DoT effect, furthermore you can use the passive in battle to double the damage of DoT for that battle.

2 skills:
1)DMG, applies a state 1
2)(a)Passive: If learnt, when state 1 is applied, enemy takes 50 DMG
(b)You can use the passive as an active ability to apply state 2, which now has the DoT dealing 100 DMG.

I just cant get this to work.
Heres State 1 Notebox:
Code:
if ($gameActors.actor(1).hasSkill(104) && user.isStateAffected(2)){
var damage = 100;
target.startAnimation(59);
target.gainHp(-damage);
target.startDamagePopup();
target.clearResult();
if (target.isDead()) {
  target.performCollapse();
  }
}
else if ($gameActors.actor(1).hasSkill(104)) {
var damage = 50;
target.startAnimation(59);
target.gainHp(-damage);
target.startDamagePopup();
target.clearResult();
if (target.isDead()) {
  target.performCollapse();
  }
}
</Custom React Effect>
Issues:
-It works when I dont know the passive it just applies state 1 and not DoT, if I learn the passive the 50 DoT works, but when I use the passive in battle to apply state 2, the enemy takes 2x 100 damage instead of replacing the 50.

Please help tried all sorts of variations on this just cant seem to figure it out.
First, what do you mean your "DoT"? 50/100 damage each turn or each action or what else? <React Effect> triggers when the target takes damage from the attacker, so your "DoT" will also trigger at the same time you attack. I'm not sure if this is your point or what.

Besides, I'm still confused about your two skills. So the first one is an active skill, which damages and applies state (1) to the target, right? With state one activated, the target will take a bonus of 50 dmg when you attack it, right? And if you learn the second skill and use it to apply state (2) to yourself, the damage raises to 100, right?
First, what do you mean your "DoT"? 50/100 damage each turn or each action or what else? <React Effect> triggers when the target takes damage from the attacker, so your "DoT" will also trigger at the same time you attack. I'm not sure if this is your point or what.

Besides, I'm still confused about your two skills. So the first one is an active skill, which damages and applies state (1) to the target, right? With state one activated, the target will take a bonus of 50 dmg when you attack it, right? And if you learn the second skill and use it to apply state (2) to yourself, the damage raises to 100, right?

Sorry for the confusion, I made it more difficult then it needs to be.

Heres the skills, basically I have every elemental attack apply a state related to it. All my Ice elemental skill apply CHILLED, reduces agi and interacts with other skills. So the skill is irrelevant all ice skills apply the state.

BUT I have a passive skill called Winter's Chill which;
USE: FREEZES all enemies, PASSIVE now does 100 dmg per action (end of each enemy action).
PASSIVE: Enemies CHILLED by you will also take 50 dmg per action (end of each enemy action).

Learning Winter's Chill makes it so whenever you apply CHILLED from ice skills, if the actor applies that effect, the enemies take 50 dmg. Additionally is the bonus effect that you can use it once per battle to double the dmg to 100 unless the enemies remove the state, but that part doesnt matter.

In my formula I dont know why I cant get IF or Else working or I just dont understand it enough. If we re-look at the code I have it working that in that;

Code:
CHILLED STATE NOTETAG
<Custom Action End Effect> // per enemy end action
if ($gameActors.actor(1).hasSkill(104)) { // first check if skill learnt
if (user.isStateAffected(67)) { // then if check passes check if winter chill state applied
var damage = 100;
target.startAnimation(59);
target.gainHp(-damage);
target.startDamagePopup();
target.clearResult();
if (target.isDead()) {
  target.performCollapse();
  }
}
else //if winter chill state not applied and skill is learnt do 50 dmg
var damage = 50;
target.startAnimation(59);
target.gainHp(-damage);
target.startDamagePopup();
target.clearResult();
if (target.isDead()) {
  target.performCollapse();
  }
}
</Custom Action End Effect>

The first part works, if I learnt the passive my CHILLED does 50 dmg to enemies. But when I apply the state winter chill the active use skill. They take 2x 100. They take double the damage.
I think I fixed it, forgot a { after else
So the CHILLED effect is applied on the target, not the actor, right? Why don't you just shorten your codes to make it less confusing?
Code:
<Custom Action End Effect>
if ($gameActors.actor(1).hasSkill(104)) {
var damage = 50;
if (user.isStateAffected(67)){
damage = 100;}
target.startAnimation(59);
target.gainHp(-damage);
target.startDamagePopup();
target.clearResult();
if (target.isDead()) {
  target.performCollapse();
  }
}
Maybe for the state, you could use a custom respond effect to see if ice damage is dealt while the state is applied, then the affected unit would take extra damage.

EDIT: or maybe I misinterpreted the issue...
So the CHILLED effect is applied on the target, not the actor, right? Why don't you just shorten your codes to make it less confusing?
Code:
<Custom Action End Effect>
if ($gameActors.actor(1).hasSkill(104)) {
var damage = 50;
if (user.isStateAffected(67)){
damage = 100;}
target.startAnimation(59);
target.gainHp(-damage);
target.startDamagePopup();
target.clearResult();
if (target.isDead()) {
  target.performCollapse();
  }
}

LOL because im not very skilled, thanks yours is much simpler, took me an embarrassing amount of time to do this today lol.

Original thread: https://forums.rpgmakerweb.com/threads/passive-that-if-learnt-applies-dot.120732/