Skip to content

Commit

Permalink
feat(project): Integration revision, conform spec rules
Browse files Browse the repository at this point in the history
  • Loading branch information
NadhifRadityo committed May 24, 2024
1 parent efca76b commit 48549fe
Show file tree
Hide file tree
Showing 29 changed files with 1,202 additions and 1,310 deletions.
6 changes: 3 additions & 3 deletions data/generator/gamesave/createnpc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const randString = () => {
name: trainerName,
password: randString() + randString() + randString(),
role: "npc",
money: 150 + Math.round(Math.random() * 400)
money: 300 + Math.round(Math.random() * 400)
}
trainerUsers.push(trainerUser);
}
Expand All @@ -36,7 +36,7 @@ const randString = () => {
let j = 0;
for(let i = 0; i < trainerUsers.length; i++) {
const trainerUser = trainerUsers[i];
const monsterCount = 1 + Math.floor(Math.random() * 5);
const monsterCount = 3 + Math.floor(Math.random() * 5);
for(let k = 0; k < monsterCount; k++) {
const monsterType = monsters[Math.floor(Math.random() * monsters.length)];
const trainerMonster = {
Expand All @@ -45,7 +45,7 @@ const randString = () => {
referenceId: monsterType.id,
name: monsterType.name,
experiencePoints: 30 + Math.round(Math.random() * 600),
healthPoints: monsterType.healthPoints + Math.floor((Math.random() * 2 - 1) * 0.3 * monsterType.healthPoints),
healthPoints: monsterType.healthPoints,
attackPower: monsterType.attackPower + Math.floor((Math.random() * 2 - 1) * 0.3 * monsterType.attackPower),
defensePower: monsterType.defensePower + Math.floor((Math.random() * 2 - 1) * 0.3 * monsterType.defensePower),
activePotions: []
Expand Down
6 changes: 3 additions & 3 deletions data/generator/gamesave/generatelaboratory.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
continue;
}
let cost = 0;
cost += (currentMonster.healthPoints - lastMonster.healthPoints) * 2.2;
cost += (currentMonster.attackPower - lastMonster.attackPower) * 14.2;
cost += (currentMonster.defensePower - lastMonster.defensePower) * 11.7;
cost += (currentMonster.healthPoints - lastMonster.healthPoints) * 13.2;
cost += (currentMonster.attackPower - lastMonster.attackPower) * 40.2;
cost += (currentMonster.defensePower - lastMonster.defensePower) * 74.3;
cost = Math.round(cost / 75) * 75;
cost = Math.max(300, cost);
upgradeOptions.push({
Expand Down
281 changes: 0 additions & 281 deletions data/generator/gamesave/laboratory.csv

This file was deleted.

42 changes: 7 additions & 35 deletions data/generator/monsters/generateogmonsters.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
for(let i = 0; i < 5; i++) {
const m = sameFamilies[i];
if(i == 0) {
m.defensePower = Math.round(m.defensePower / 200 * 100);
newMonsters.push(m);
continue;
}
if(m != null) {
newMonsters.push({
...m,
healthPoints: Math.round(baseMonster.healthPoints * i * 1.1),
attackPower: Math.round(baseMonster.attackPower * i * 1.1),
defensePower: Math.round(baseMonster.defensePower * i * 1.1),
healthPoints: Math.round(baseMonster.healthPoints * (1 + i * 0.1)),
attackPower: Math.round(baseMonster.attackPower * (1 + i * 0.1)),
defensePower: Math.min(50, Math.round(baseMonster.defensePower * (1 + i * 0.1))),
});
continue;
}
Expand All @@ -36,44 +37,15 @@ const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
strId: `${lastMonster.strId}-${i - sameFamilies.length}`,
name: `${lastMonster.name}-${i - sameFamilies.length + 1}`,
level: i + 1,
healthPoints: Math.round(baseMonster.healthPoints * i * 1.1),
attackPower: Math.round(baseMonster.attackPower * i * 1.1),
defensePower: Math.round(baseMonster.defensePower * i * 1.1),
healthPoints: Math.round(baseMonster.healthPoints * (1 + i * 0.1)),
attackPower: Math.round(baseMonster.attackPower * (1 + i * 0.1)),
defensePower: Math.min(50, Math.round(baseMonster.defensePower * (1 + i * 0.1))),
});
}
}
newMonsters.forEach((m, i) => m.id = i);
monsters.splice(0, monsters.length, ...newMonsters);

const upgradeOptions = [];
for(const family of families) {
let currentLevel = 1;
let lastMonster = null;
while(true) {
const currentMonster = monsters.find(m => m.family == family && m.level == currentLevel);
if(currentMonster == null)
break;
if(lastMonster == null) {
currentLevel++;
lastMonster = currentMonster;
continue;
}
let cost = 0;
cost += (currentMonster.healthPoints - lastMonster.healthPoints) * 2.2;
cost += (currentMonster.attackPower - lastMonster.attackPower) * 14.2;
cost += (currentMonster.defensePower - lastMonster.defensePower) * 11.7;
cost = Math.round(cost / 75) * 75;
cost = Math.max(300, cost);
upgradeOptions.push({
fromMonsterId: lastMonster.id,
toMonsterId: currentMonster.id,
cost: cost
});
currentLevel++;
lastMonster = currentMonster;
}
}

await fs.writeFile(path.join(__dirname, "og-database_monster.json"), JSON.stringify(monsters, null, 4));

const csv = monsters.map(m => [
Expand Down
1 change: 0 additions & 1 deletion data/saves/default-save/database_inventory_item.csv
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
0;1;4;2
Loading

0 comments on commit 48549fe

Please sign in to comment.