# RMMVYanfly Element Core, slight issue?

#### ZankokuNoYami

##### Veteran
So I am using this plugin:

I have it set to ADDITIVE. This is because my game revolves around dual elements. Every character attack and spell has dual elements (really, i define them as one Element and one Attribute... it is set to encourage you to use strategy to always ensure maximum damage).

What this results into is one of several equations:
50% + 50% = 0 damage
50% + 100% = 1/2 damage
100% + 100% = normal damage
50% + 200% = 1.5x damage
100% + 200% = 2x damage
200% + 200% = 4x damage

The ONLY issue is when I reach 200% + 200%... I get 300% instead of 400%, or, 3x instead of 4x damage. And 200/100 + 200/100 in math is 4... when turned into a percentage, is 400. Or a simple multiplication of damage x4. So not sure WHERE the math is going wrong or WHY. Can the plugin not do math beyond 400%? Is that a core restriction somewhere?

All I need is this last thing to work and this plugin will do exactly what I need it to do, haha. Any help would be appreciated!

#### caethyril

##### ^_^
Remember 100% is normal output:
• 50% is -50% from that; 2 * -50% is -100%, giving 100% - 100% = 0%.
• 100% is +0% from normal; 2 * +0% is still 0%, i.e. 100% normal output.
• 200% becomes +100%; 2 * +100% is +200%, giving 100% + 200% = 300%.

#### ZankokuNoYami

##### Veteran
Remember 100% is normal output:
• 50% is -50% from that; 2 * -50% is -100%, giving 100% - 100% = 0%.
• 100% is +0% from normal; 2 * +0% is still 0%, i.e. 100% normal output.
• 200% becomes +100%; 2 * +100% is +200%, giving 100% + 200% = 300%.

Yeah, that is why when I had 100% and 100% (basically, no weakness or strength) I figured it would equal 100%. Exactly as intended.

But why is 200% becoming 100%? I understood the math perfectly up until that and it actually produced the exact numbers based on my formula until I hit 200% + 200%.

And is there anyway to make it actually do that? Because the idea is basically 50% for strong against, 100% for neither, 200% for weakness. So you are doing 1/2 damage per enemy strength, and 2x damage per enemy weakness. Allowing a 4x damage total.

#### caethyril

##### ^_^
Try thinking in terms of the bonus damage:
• 50 is 100 - 50 => -50%
• 100 is 100 + 0 => +0%
• 200 is 100 + 100 => +100%
• 50% & 200% => -50 + 100 = +50 = 50% more damage;
• 100% & 50% => 0 - 50 = -50 = 50% less damage;
• 200% & 200% => 100 + 100 = +200 = 200% more damage.
For 4x normal damage with two weaknesses, you'd need element rates of 250%. That's a bonus of +150% each, yielding +300% for two: 100% + 300% = 400%.

I'm not sure how to achieve what you're seeking...I think you'd need an element combination formula more complicated than simple addition, but maybe someone else has some creative ideas~

#### ZankokuNoYami

##### Veteran
I see... that is a lot different than the additive that it felt like it was doing up to that point. Since yeah, all I want is it to add up the damage twice... or simply multiply the damage by 4.

I am no expert, naturally, but I feel it would just need some sort of else or if case. Like 'if element 1 = 2 and element 2 = 2, then damage is = x4' or whatever the proper language would be. Since this is a very specific case in which there would be no further variables. Every character has one element and one attribute. Every enemy has a weakness to one element and attribute and one strength to an element and attribute.

Thanks for the run down! When I hear additive, I am throwing it into a calculator going base damage x (element + element). Where it adds up the bonus damage from the elements (2 and 2) and just multiplies the damage by the result. Super simple easy math, haha.

#### caethyril

##### ^_^
Thanks for the run down! When I hear additive, I am throwing it into a calculator going base damage x (element + element). Where it adds up the bonus damage from the elements (2 and 2) and just multiplies the damage by the result. Super simple easy math, haha.
Note that while that does give you the 400% you're after, it's not consistent with the other values, e.g.
• 50% & 50% => 50 + 50 = 100 = normal damage?
• 100% & 100% => 100 + 100 = 200 = double damage?
• 200% & 200% => 200 + 200 = 400 = 4x damage!
Luckily in this case it sounds like you have only very specific cases for element rate, so you can use a piecewise/case-based formula like you mentioned~

I wrote a quick extension for Element Core that I think should do what you want; it's running the code, but I haven't really tested damage outputs. Either save the code below as a .js file and import as a plugin, or ditto with the attachment (the file name doesn't matter).
• Make sure the extension loads after YEP_ElementCore.
• Set Element Core's "Multi-Element Rulings" parameter to 5 (via the Text tab).
• Save your project to apply plugin changes before testing.
JavaScript:
``````(function(alias) {
Game_Action.prototype.calcElementRateRule = function(target, elementId, finalRate, eleRate, rule) {
finalRate = alias.apply(this, arguments);
switch (rule) {
case 5:
if (finalRate === undefined) finalRate = eleRate;
else if (eleRate === 2 && finalRate === 2) finalRate = 4;
else finalRate += eleRate - 1;
break;
}
return finalRate;
};
})(Game_Action.prototype.calcElementRateRule);``````

#### Attachments

• eleCoreRule5.js
593 bytes · Views: 1

#### ZankokuNoYami

##### Veteran
I forgot to reply to this, wow.

Yes, that small edit did exactly what I needed. Thank you so much!

### Latest Profile Posts

Finally started working on Grim Trigger episode 2 today it's half comic/half visual novel!

Is it interesting to get more backstory on villains? A key moment in their past, their childhood, or maybe something that shows they've always been that way? To see or not to see?
"Everything tastes like chicken until it's chicken, then it doesn't taste like chicken."
Context: chicken samosas do not taste like chicken. I thought it was veggie samosas.
Just another ordinary evening.
This pig girl is a merchant and playable character.
Currently there's no name for her yet. a suggestion is welcomed.
Want for a Nail: I'm trying to figure out what controllers work with MZ, one support thread, a plugin request thread, a dead controller, and a \$48 eBay purchase, and a PS1/PS2 USB adapter later. Still stuck with keyboard controls...