gotchi-battler-game-logic 2.0.8 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.cursor/rules/cursor-rules.mdc +67 -0
- package/.cursor/rules/directory-structure.mdc +63 -0
- package/.cursor/rules/self-improvement.mdc +64 -0
- package/.cursor/rules/tech-stack.mdc +99 -0
- package/README.md +7 -3
- package/eslint.config.js +31 -0
- package/game-logic/index.js +2 -5
- package/game-logic/v1.4/constants.js +0 -23
- package/game-logic/v1.4/index.js +64 -56
- package/game-logic/v1.5/constants.js +0 -23
- package/game-logic/v1.5/index.js +27 -21
- package/game-logic/v1.6/constants.js +0 -23
- package/game-logic/v1.6/index.js +27 -21
- package/game-logic/v1.7/constants.js +0 -23
- package/game-logic/v1.7/helpers.js +18 -3
- package/game-logic/v1.7/index.js +24 -18
- package/game-logic/v1.8/constants.js +112 -0
- package/game-logic/v1.8/helpers.js +628 -0
- package/game-logic/v1.8/index.js +832 -0
- package/game-logic/v2.0/constants.js +112 -0
- package/game-logic/v2.0/helpers.js +713 -0
- package/game-logic/v2.0/index.js +782 -0
- package/game-logic/v2.0/statuses.json +439 -0
- package/package.json +11 -4
- package/schemas/crystal.js +14 -0
- package/schemas/effect.js +25 -0
- package/schemas/gotchi.js +53 -0
- package/schemas/ingameteam.js +14 -0
- package/schemas/item.js +13 -0
- package/schemas/leaderskill.js +15 -0
- package/schemas/leaderskillstatus.js +12 -0
- package/schemas/special.js +22 -0
- package/schemas/team.js +24 -0
- package/schemas/team.json +254 -116
- package/scripts/balancing/createCSV.js +1 -1
- package/scripts/balancing/createTrainingGotchis.js +267 -0
- package/scripts/balancing/extractOnchainTraits.js +61 -0
- package/scripts/balancing/fixTrainingGotchis.js +41 -41
- package/scripts/balancing/processSims.js +6 -6
- package/scripts/balancing/sims.js +10 -17
- package/scripts/balancing/v1.7/mapGotchi.js +119 -0
- package/scripts/balancing/v1.7/setTeamPositions.js +2 -2
- package/scripts/balancing/v1.7/training_gotchis_traits.json +520 -0
- package/scripts/balancing/v1.7.1/mapGotchi.js +119 -0
- package/scripts/balancing/v1.7.1/setTeamPositions.js +2 -2
- package/scripts/balancing/v1.7.1/training_gotchis_traits.json +520 -0
- package/scripts/balancing/v1.7.2/mapGotchi.js +157 -0
- package/scripts/balancing/v1.7.2/setTeamPositions.js +2 -2
- package/scripts/balancing/v1.7.2/training_gotchis_traits.json +520 -0
- package/scripts/balancing/v1.7.3/class_combos.js +44 -0
- package/scripts/balancing/v1.7.3/mapGotchi.js +164 -0
- package/scripts/balancing/v1.7.3/setTeamPositions.js +122 -0
- package/scripts/balancing/v1.7.3/training_gotchis.json +22402 -0
- package/scripts/balancing/v1.7.3/training_gotchis_traits.json +37 -0
- package/scripts/balancing/v1.7.3/trait_combos.json +10 -0
- package/scripts/data/dungeon_mob_1.json +87 -0
- package/scripts/data/dungeon_mob_2.json +87 -0
- package/scripts/data/immaterialTeam1.json +374 -0
- package/scripts/data/immaterialTeam2.json +365 -0
- package/scripts/data/tournaments.json +5 -0
- package/scripts/generateAllSpecialsLogs.js +93 -0
- package/scripts/generateSpecialLogs.js +94 -0
- package/scripts/runCampaignBattles.js +41 -0
- package/scripts/runLocalBattle.js +6 -3
- package/scripts/runLocalDungeon.js +52 -0
- package/scripts/runPvPBattle.js +16 -0
- package/scripts/runRealBattle.js +8 -8
- package/scripts/simRealBattle.js +8 -8
- package/scripts/validateBattle.js +23 -16
- package/scripts/validateTournament.js +9 -9
- package/tests/getModifiedStats.test.js +78 -0
- package/utils/errors.js +13 -13
- package/utils/transforms.js +2 -8
- package/scripts/output/.gitkeep +0 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
const trainingGotchis = require('./training_gotchis.json')
|
|
2
|
+
|
|
3
|
+
const getFrontRowScore = (gotchiId, leaderId) => {
|
|
4
|
+
const gotchi = trainingGotchis.find(gotchi => gotchi.id === gotchiId)
|
|
5
|
+
const leader = trainingGotchis.find(gotchi => gotchi.id === leaderId)
|
|
6
|
+
|
|
7
|
+
if (gotchi.name.includes('avg')) {
|
|
8
|
+
|
|
9
|
+
let score = 0
|
|
10
|
+
|
|
11
|
+
switch (gotchi.specialId) {
|
|
12
|
+
case 1: // Ninja
|
|
13
|
+
score = 2
|
|
14
|
+
break
|
|
15
|
+
case 2: // Enlightened
|
|
16
|
+
score = 6
|
|
17
|
+
break
|
|
18
|
+
case 3: // Cleaver
|
|
19
|
+
score = 0
|
|
20
|
+
break
|
|
21
|
+
case 4: // Tank
|
|
22
|
+
score = 2
|
|
23
|
+
break
|
|
24
|
+
case 5: // Cursed
|
|
25
|
+
score = 4
|
|
26
|
+
break
|
|
27
|
+
case 6: // Healer
|
|
28
|
+
// If leader is healer then healer is good up front
|
|
29
|
+
if (leader.specialId === 6) {
|
|
30
|
+
score = 5
|
|
31
|
+
} else {
|
|
32
|
+
score = 1
|
|
33
|
+
}
|
|
34
|
+
break
|
|
35
|
+
case 7: // Mage
|
|
36
|
+
score = 0
|
|
37
|
+
break
|
|
38
|
+
case 8: // Troll
|
|
39
|
+
score = 0
|
|
40
|
+
break
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return score
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// High health gotchis do well up front
|
|
47
|
+
const isHighHealth = gotchi.nrg < 50
|
|
48
|
+
|
|
49
|
+
// High armor gotchis do well up front
|
|
50
|
+
const isLowAgg = gotchi.agg < 50
|
|
51
|
+
|
|
52
|
+
// High evasion gotchis do well up front
|
|
53
|
+
const isHighSpk = gotchi.spk >= 50
|
|
54
|
+
|
|
55
|
+
const isLowBrn = gotchi.brn < 50
|
|
56
|
+
|
|
57
|
+
// Create a score from 0 to 6 based on how much they favour the front
|
|
58
|
+
|
|
59
|
+
let score = 0
|
|
60
|
+
|
|
61
|
+
if (gotchi.specialId === 2) score +=2 // Enlightened
|
|
62
|
+
if (isHighHealth) score++
|
|
63
|
+
if (isLowBrn) score++
|
|
64
|
+
if (isLowAgg) score++
|
|
65
|
+
if (isHighSpk) score++
|
|
66
|
+
|
|
67
|
+
return score
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
module.exports = (team) => {
|
|
71
|
+
// All gotchis are currently in the back row
|
|
72
|
+
// Get the score for each gotchi for how much they favour the front row
|
|
73
|
+
const teamFrontRowScores = team.formation.back.map((gotchi) => getFrontRowScore(gotchi.id, team.leader));
|
|
74
|
+
|
|
75
|
+
[0,1,2,3,4].forEach((i) => {
|
|
76
|
+
const gotchi = team.formation.back[i]
|
|
77
|
+
const score = teamFrontRowScores[i]
|
|
78
|
+
|
|
79
|
+
// If score is >= 3 then move to front row
|
|
80
|
+
if (score >= 3) {
|
|
81
|
+
team.formation.front[i] = gotchi
|
|
82
|
+
team.formation.back[i] = null
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
// If you have 5 gotchis in the front then send the lowest 2 to the back
|
|
87
|
+
const frontGotchis = team.formation.front.filter(gotchi => gotchi)
|
|
88
|
+
if (frontGotchis.length === 5) {
|
|
89
|
+
// Sort the gotchis by score in ascending order (lowest score first)
|
|
90
|
+
const orderedGotchis = JSON.parse(JSON.stringify(frontGotchis)).sort((a, b) => getFrontRowScore(a.id, team.leader) - getFrontRowScore(b.id, team.leader))
|
|
91
|
+
|
|
92
|
+
// Loop through the front row and the first 2 gotchis that have a score of either orderedGotchis[0] or orderedGotchis[1] move to the back
|
|
93
|
+
let hasMoved = 0
|
|
94
|
+
team.formation.front.forEach((gotchi, i) => {
|
|
95
|
+
if (hasMoved < 2 && (gotchi.id === orderedGotchis[0].id || gotchi.id === orderedGotchis[1].id)) {
|
|
96
|
+
team.formation.back[i] = gotchi
|
|
97
|
+
team.formation.front[i] = null
|
|
98
|
+
|
|
99
|
+
hasMoved++
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// If you have 5 gotchis in the back then send the highest 2 to the front
|
|
105
|
+
const backGotchis = team.formation.back.filter(gotchi => gotchi)
|
|
106
|
+
if (backGotchis.length === 5) {
|
|
107
|
+
// Sort the gotchis by score in descending order (highest score first)
|
|
108
|
+
const orderedGotchis = JSON.parse(JSON.stringify(backGotchis)).sort((a, b) => getFrontRowScore(b.id, team.leader) - getFrontRowScore(a.id, team.leader))
|
|
109
|
+
|
|
110
|
+
// Loop through the back row and the first 2 gotchis that have a score of either orderedGotchis[0] or orderedGotchis[1] move to the front
|
|
111
|
+
let hasMoved = 0
|
|
112
|
+
team.formation.back.forEach((gotchi, i) => {
|
|
113
|
+
if (hasMoved < 2 && (gotchi.id === orderedGotchis[0].id || gotchi.id === orderedGotchis[1].id)) {
|
|
114
|
+
team.formation.front[i] = gotchi
|
|
115
|
+
team.formation.back[i] = null
|
|
116
|
+
|
|
117
|
+
hasMoved++
|
|
118
|
+
}
|
|
119
|
+
})
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|