Skip to content

Commit 0399647

Browse files
authored
Update mainapi.md
1 parent a2ac8d8 commit 0399647

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

mainapi.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,28 @@ Anyway, here are the examples :)
1717

1818
Yo-kai Example #1: Fixes IVs of all Yo-kai:
1919
```js
20-
(function fixYokaiData() {
21-
const yokaiList = getAllYokai();
20+
(function fixYokaiData() { // define an IIFE for no reason (you dont need to do this I just felt like it when I made this example)
21+
const yokaiList = getAllYokai(); // get all yokai
2222
console.log(`Fixing ${yokaiList.length} Yo-kai...`);
2323

24-
let ivTotalTarget = 40;
24+
let ivTotalTarget = 40; // IV sum
2525

26-
yokaiList.forEach((yokai, index) => {
26+
yokaiList.forEach((yokai, index) => { // iterate through - this is kinda obvious
2727
// --- Fix IVs ---
28-
let IV_HP = yokai.get("IV_HP");
28+
let IV_HP = yokai.get("IV_HP"); // get all the Ivs of the current yokai
2929
let IV_Str = yokai.get("IV_Str");
3030
let IV_Spr = yokai.get("IV_Spr");
3131
let IV_Def = yokai.get("IV_Def");
3232
let IV_Spd = yokai.get("IV_Spd");
3333

34-
let IV_Sum = Math.floor(IV_HP / 2) + IV_Str + IV_Spr + IV_Def + IV_Spd;
34+
let IV_Sum = Math.floor(IV_HP / 2) + IV_Str + IV_Spr + IV_Def + IV_Spd; // should be 40 if it has valid IVs - HP is worth half
3535

36-
let needsFix = (IV_HP % 2 !== 0) || (IV_Sum !== ivTotalTarget);
36+
let needsFix = (IV_HP % 2 !== 0) || (IV_Sum !== ivTotalTarget); // checks if its valid HP must be even since the point goal is 40 and nothing else can be decimal except HP so if HP isnt whole the goal cant be reached - meaning HP must be even
3737

3838
if (needsFix) {
3939
let ivs = [0, 0, 0, 0, 0];
4040

41-
for (let i = 0; i < ivTotalTarget; ++i) {
41+
for (let i = 0; i < ivTotalTarget; ++i) { // good ol trial and error
4242
let r = Math.floor(Math.random() * 5);
4343
ivs[r]++;
4444
}

0 commit comments

Comments
 (0)