User blog:Fredy-san/Converting Strings to Numbers, Stuffs to Note and Freaking Switch.

This blog will mainly talk about the stats calculator I made.

So first thing first is that I need to convert those HTML strings into numbers foir the Javascript to read in calculation. If you think writing something like "100 + 50 * 2" would results a displayed number of "200" then you are wrong, you will get "100100" instead displayed in the page. Gonna need time to write that.

Then another thing is the level stat increase variance. As Heli said, the stats gained from level-up changed to only half when certain level reached and this also changed based on the rarity of the unit (or even if has special level or such like Crazed SR units). I need to write an if-else statement for that. But here comes another things to solve: Future support and flexibility. So I decided to not relying on JS too much and instead try use what we have in here.

That would be where the #switch used for. My plan is to design a switch template like this

Template set rarity = value


 * 1) switch = rarity value | normal = 50 | special = 50 | rare = 60 bla bla bla the rest of stuffs.

So with only a single JS where if the custom stats level sum reached the rarity switch, it will trigger the stats gain reduction. It is also easy to edit and allows users who not understand JS to access.

The placeholders are ready. But I think I will edit the code later on since I am busy with work atm.