Yanfly Skill Eval

Hiya!


I'm trying to create different tier of protection spell (Skill) and them to play nice with each other.


Ex: Level 1 Skill : Courage (ID:20) (Give a State with DEF and MHP +)


      Level 9 Skill : Center (ID:21) (Give a State with a little bit more DEF and MHP++)


When someone cast the lvl 9 skill on someone with lvl 1 skill, this overwrite it


When someone cast the lvl 1 skill on someone with lvl 9 skill, i receive a "Did not hold" message.


For the lvl 9 one, I've use this Eval :


<Before Eval>


for (var i = 20; i < 22; ++i) {


   target.removeState(i);


}


</Before Eval>


This remove all the lesser spell ( I've planned to put more than 2 spell on this line ) and apply the lvl 9 one.


But for the lvl 1 spell, it's a little bit harder.  I've come with this :


<Before Eval>


for(var i = 21; i < 22; ++i){


   if (target.isStateAffected(i) == true) {


      target.removeState(i);


      target.addState(i);


   }


}


</Before Eval>


But its no good.  People gonna use the lesser spell to refresh the higher one!! 🙂


Is there a way to stop the spell being casted from the <Before Eval> ?


I'm looking for something like :


<Before Eval>


for(var i = 21; i < 22; ++i){


   if (target.isStateAffected(i) == true) {


      target.ABORDCASTING!


      var text = ’ Spell Failed - You cannot overwrite stronger Spell ’;


      $gameMessage.add(text);


   }


}


</Before Eval>


oh.. and since i'm thinking about it, I will need to combine these two condition if I'm adding more spell


Ex: Level 1 Skill : Courage (ID:20) (Give a State with DEF and MHP +)


      Level 9 Skill : Center (ID:21) (Give a State with a little bit more DEF and MHP++)


      Level 19 Skill : Daring (ID:22) (Give a State with a little bit more MORE DEF and MHP++++)


      Level 24 Skill : Bravery (ID:23) ...


For the Level 19 skill, this will look more like :


<Before Eval>


for (var i = 20; i < 23; ++i) {


   target.removeState(i);


}


for(var i = 24; i < 25; ++i){


   if (target.isStateAffected(i) == true) {


      target.ABORDCASTING!


      var text = ’ Spell Failed - You cannot overwrite stronger Spell ’;


      $gameMessage.add(text);


   }


}


</Before Eval>


Someone can help me?


Thx!

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-skill-eval.68709/