Why not just use the elements and element rate traits in the default system?
Like make your "water" enemy have a Plant Element Rate of more than 100% so it takes more damage from plant attacks
Element Rate > 100 = takes higher damae
Element Rate < 100 = takes less damage
Element Rate = 0 = takes no damage
I see.. Then we need an idea of how you handle each attack etc to be able to help further. We cant help you if we dont know how you're handling things.
Anyway, you can still use the data from the Traits box for easier setup, then just reference them using script calls in your on-map battle system.
Hmmm it seems like you've already gotten almost everything about the damage calculation done, adding the element check is simply a matter of doing a database comparison between the attacker element and the enemy element.
Like you can just make a JS object that stores element damage factors as its properties and read from that.
No need for conditionals, we just need a JS object where you store the corresponding damage factors like PlantVsWater = 150%
That way you practically just do
Damage*FactorOfPlantVsWater
I'm not with my comp right now so I cant test things right now
Well you can get creative with naming the JS object properties like you actually make a JS object called elementRates and you name its properties like PlantVsWater, and so on so you can just get the element of attacker, concat Vs, then concat the element of the target.
Or you can make an array for each attacker element, and save the corresponding target element rate as its members like
var elementPlant = [1.00,1.50,0.00];
So if your attacker element is Plant, you just call elementPlant[ID] where ID is the index of the target's element. This means you need to have your elements have a corresponding static index (like Plant is 0, Fire is 1, Water is 2 etc)
This approach would need a check though to get the right element array for the attacker. I dont know if JS supports multidimensional array or Tables which will make it a lot easier.
do you mean like (i don't know what the specific code would look like.)
*figure out what the attacker's element is
*compare the target's element to the three categories of Strong against, unaffected, weak against for the attacker's element
*if the target enemy's element is in the strong against category add a modifier to the damage, if weak add a modifier to the damage, if unaffected do nothing
so like
Plantstrong = [water]
Plantnothing = [plant]
Plantweak = [fire]
^ and then do that for every element? since the actual two variables of the target's element and the attacker's, there would only need to be one time that i would need to write it because the event responsible would copy the value of the attacker's element and the target's in the event that handles the attacker's turn before the plugin's function is called? that's really what i could figure out from what you suggested.