Yanlfy Libra Skill - Expandend

Hey guys! How are you, I need help and i hope some of you will be able to help me as my Javascript skills are very below average.

So for those who don't know Yanlfy made a code to use in a Libra skill of theirs Tips & Tricks – Libra <=== This one to be specific.

Now, I managed to edit the code to also work on allies, no problem in there, but want to do two other things, the first is to add a Reflect in the element information displayed, I am using using YEP.107 – Element Core And i guess that information should be there, but i don't know how to call for it.

The I also want to be able to show if an enemy or ally is resistant or immune to certain states, I think I managed to call the information of the states but this is the result.

Spoiler
Sin título.png

So yeah I'm doing something wrong, but i simply don't know how to make it work.

And finally, this is my edited code which i need help with.

Spoiler
<Before Eval>
if (target.isEnemy()) {
var id = target._enemyId;
} else {
var id = target._actorId;
}

var text = target.name() + '\n';
text += '\\px[100]\\c[4]HP:\\c[0] ' + target.hp;
text += '/' + target.mhp;
text += '\\px[400]\\c[4]MP:\\c[0] ' + target.mp;
text += '/' + target.mmp;
text += '\\px[700]\\c[4]TP:\\c[0] ' + target.tp;
text += '\n';
text += '\\px[100]\\c[4]ATK:\\c[0] ' + target.atk;
text += '\\px[400]\\c[4]MAT:\\c[0] ' + target.mat;
text += '\\px[700]\\c[4]AGI:\\c[0] ' + target.agi;
text += '\n';
text += '\\px[100]\\c[4]DEF:\\c[0] ' + target.def;
text += '\\px[400]\\c[4]MDF:\\c[0] ' + target.mdf;
text += '\\px[700]\\c[4]LUK:\\c[0] ' + target.luk;
$gameMessage.add(text);

var weakness = '';
var resist = '';
var immune = '';
var absorb = '';
var elements = $dataSystem.elements;
for (var i = 1; i < elements.length; ++i) {
var name = elements;
var rate = target.elementRate(i);
if (rate > 1) {
weakness += name + ' ';
} else if (rate < 0) {
absorb += name + ' ';
} else if (rate === 0) {
immune += name + ' ';
} else if (rate < 1) {
resist += name + ' ';
}
}
if (weakness === '') weakness = 'None';
if (resist === '') resist = 'None';
if (immune === '') immune = 'None';
if (absorb === '') absorb = 'None';
weakness = '\\c[4]Weakness:\\c[0] ' + weakness + '\n';
resist = '\\c[4]Resist:\\c[0] ' + resist + '\n';
immune = '\\c[4]Immune:\\c[0] ' + immune + '\n';
absorb = '\\c[4]Absorb:\\c[0] ' + absorb;
text = weakness + resist + immune + absorb;
$gameMessage.add(text);

var resistS = '';
var immuneS = '';
var states = $dataStates;
for (var i = 1; i < states.length; ++i) {
var name = states;
var rate = target.stateRate(i);
if (rate === 0) {
immuneS += name + ' ';
} else if (rate < 1) {
resistS += name + ' ';
}
}
if (resistS === '') resistS = 'None';
if (immuneS === '') immuneS = 'None';
resistS = '\\c[4]Resist:\\c[0] ' + resistS + '\n';
immuneS = '\n' + '\\c[4]Immune:\\c[0] ' + immuneS + '\n';
text = resistS + immuneS;
$gameMessage.add(text);
</Before Eval>

Thanks to anyone who can help me with this, I also fully believe that everyone will benefit from having a Libra skill that can display all of this information.


In a side note I'm also planning of making the skill react to bosses, aka not displaying certain information like HP MP or even stats, but I can do that with a conditional so it's not much of a hassle, but just so you can know.
Bump
Bump
Bump again because I do need this.
I'll post the code found in the sample project, it inculdes what you're asking for, just give me a few hours untill home and can post it..
@Zarsla Hey If you could, I would gladly appreciate it.
Here it is , it's using Yanfly's Skill Core and Message Micros

<After Eval>

if (target.isEnemy()) {

var id = target._enemyId;



var text = target.name() + '\n';

text += '\\px[50]\\c[4]'+ TextManager.hpA + ':\\c[0] ' + target.hp;

text += '/' + target.mhp;

text += '\\px[400]\\c[4]'+ TextManager.mpA + ':\\c[0] ' + target.mp;

text += '/' + target.mmp;

text += '\\px[750]\\c[4]'+ TextManager.tpA + ':\\c[0] ' + target.tp;

text += '\n';



text += '\\px[50]\\c[4]'+ TextManager.param(2) + ':\\c[0] ' + target.atk;

text += '\\px[400]\\c[4]'+ TextManager.param(4) + ':\\c[0] ' + target.mat;

text += '\\px[750]\\c[4]'+ TextManager.param(6) + ':\\c[0] ' + target.agi;

text += '\n';

text += '\\px[50]\\c[4]'+ TextManager.param(3) + ':\\c[0] ' + target.def;

text += '\\px[400]\\c[4]'+ TextManager.param(5) + ':\\c[0] ' + target.mdf;

text += '\\px[750]\\c[4]'+ TextManager.param(7) + ':\\c[0] ' + target.luk;

$gameMessage.add(text);



var weakness = '';

var resist = '';

var immune = '';

var absorb = '';

var elements = $dataSystem.elements;

for (var i = 1; i < elements.length; ++i) {

var name = elements;

var rate = target.elementRate(i);

if (rate > 1) {

weakness += name + ' ';

} else if (rate < 0) {

absorb += name + ' ';

} else if (rate === 0) {

immune += name + ' ';

} else if (rate < 1) {

resist += name + ' ';

}

}

if (weakness === '') weakness = 'None';

if (resist === '') resist = 'None';

if (immune === '') immune = 'None';

if (absorb === '') absorb = 'None';

weakness = '\\c[4]Weakness:\\c[0] ' + weakness + '\n';

resist = '\\c[4]Resist:\\c[0] ' + resist + '\n';

immune = '\\c[4]Immune:\\c[0] ' + immune + '\n';

absorb = '\\c[4]Absorb:\\c[0] ' + absorb;

text = weakness + resist + immune + absorb;

$gameMessage.add(text);

}

</After Eval>
I don't think it is If I am reading it correctly is the same one I am using just made easier to look with the help of the message macros... But definitely, no States and Reflect setting that I can look for.

Original thread: https://forums.rpgmakerweb.com/threads/yanlfy-libra-skill-expandend.73997/