FEF Calculator Progress Update #1 (January 8, 2017)Work started in early December, 2016? Perhaps a little bit before? It was based on work I had done months prior on a FEF website that I made for a school project, which was supposed to include a working calculator that could run FEF battles. After several weeks of work, it was in a testable state but was nowhere near complete enough to be used as a tool for playing the game.
This guy right here is the big breakthrough lately. At first I was thinking we'd need to actually do some kind of file upload system but now it's looking like I could make things entirely based in a single HTML page.
// set up character stat arrays
function setCharStats(charSheet) { // the charSheet argument should be the ID of the input box that receives the pasted character sheet
var reg = new RegExp(/\d{1,3}(?![\d%]))/gm); // regular expression that parses the integers out and ignores stat growth percentages by detecting '%' signs following integers
var str = document.getElementById(charSheet).value; // when you instantiate a new setCharStats make sure the charSheet argument is closed in single quotes, ex. setCharStats('input1')
var res = str.match(reg);
// create methods for character stats to improve readability later on!
this.health = res[0];
this.strength = res[1];
this.magic = res[2];
this.skill = res[3];
this.constitution = res[4];
this.aid = res[5];
this.luck = res[6];
this.defence = res[7];
this.resistance = res[8];
this.speed = res[9];
this.move = res[10]; // move might not be needed now but there's no reason not to define it
// create methods for weapon stats
this.attack = res[11];
this.hit = res[12];
this.attackSkill = res[13];
this.evasion = res[14];
this.critical = res[15];
this.dodge = res[16];
}
It turns a text input into an array containing just the values I need in order to operate, then assigns them to intuitive sounding methods that I can call later when I need the stat. Basically you plug in your Current Stats and the Battle Stats of the weapon a character is using, and it automatically plugs those numbers into the calculator.
In order for your input to work correctly:
1.
All of the values must be filled in. If a stat isn't used, it needs to be a 0, not a - and not blank, otherwise it skips that stat and all the stats below it will fill in the gap. It also cannot have any extraneous values
other than growth percentages for character stats.
2.
You must post Current Stats, THEN Battle Stats, otherwise AT is going to be used for HP calculations, Hit will be used for Strength calculations, and so on.
3.
If you include growth percentages for Current Stats, they must be followed by a percent sign! The regular expression I used grabs all integers, EXCEPT those followed by percent symbols.
Current Stats
HP: 24 (70%)
STR: 3 (5%)
MAG: 12 (60%)
SKL: 8 (60%)
CON: 8
AID: 7
LCK: 3 (15%)
DEF: 6 (45%)
RES: 9 (50%)
SPD: 11 (70%)
MOV: 5
Battle Stats (Flux):
AT: 20
Hit: 87
AS: 11
Eva: 25
Crt: 4
DG: 3
24
3
12
8
8
7
3
6
9
11
5
20
87
11
25
4
3
HP: 24 (70) // there is no percent sign for the growth rate here. now your Strength is 70!
STR: 3 (5%)
MAG: 12 (60%)
SKL: 8 (60%)
CON: 8
AID: 7
LCK: 3 (15%)
DEF: 6 (45%)
RES: 9 (50%)
SPD: 11 (70%)
MOV: 5
Battle Stats (Flux):
AT: 20
Hit: 87
AS: 11 - (9-{8+2}=0) = 11 // the extraneous and unnecessary integers in this stat will be punched into the array and foul calculations further down the line
Eva: 25
Crt: 4
DG: 3
I could probably develop more foolproof logic that accounts for some of these mistakes but right now, I think it's simple enough to move on so I can actually get this thing into a testable state.
Here's a working example I developed:
http://www.w3schools.com/code/tryit.asp?filename=FBJPMJI6PBI6Try changing the stat values in the input box, then hitting the Create button to see the array change.
Later on, I can probably use this framework I've developed in order to spit out formatted character sheets.
TL;DR: When the calculator is finished running battles will be as simple as copying text from character sheets and dumping them into text boxes, then pushing a button.