Skip to content

Commit 60e4896

Browse files
committed
Merge branch 'schema'
2 parents 1c49674 + c785861 commit 60e4896

5 files changed

Lines changed: 52 additions & 4 deletions

File tree

client/src/colors.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,35 @@ export const Presets: ColorPreset[] = [
154154
TEAM_TWO: '#c91c7e'
155155
}
156156
}
157+
},
158+
{
159+
displayName: 'Battlecode 2025',
160+
data: {
161+
version: 0,
162+
colors: {
163+
GAMEAREA_BACKGROUND: '#2e2323',
164+
SIDEBAR_BACKGROUND: '#3f3131',
165+
RED: '#ff9194',
166+
PINK: '#ffb4c1',
167+
GREEN: '#00a28e',
168+
CYAN: '#02a7b9',
169+
CYAN_DARK: '#1899a7',
170+
BLUE: '#04a2d9',
171+
BLUE_LIGHT: '#26abd9',
172+
BLUE_DARK: '#00679e',
173+
DARK: '#1f2937',
174+
DARK_HIGHLIGHT: '#140f0f',
175+
BLACK: '#140f0f',
176+
WHITE: '#fcdede',
177+
LIGHT: '#aaaaaa22',
178+
LIGHT_HIGHLIGHT: '#ffffff33',
179+
LIGHT_CARD: '#f7f7f722',
180+
WALLS_COLOR: '#547f31',
181+
TILES_COLOR: '#4c301e',
182+
TEAM_ONE: '#cdcdcc',
183+
TEAM_TWO: '#fee493'
184+
}
185+
}
157186
}
158187
]
159188

client/src/components/sidebar/game/game.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,16 @@ export const GamePage: React.FC<Props> = React.memo((props) => {
143143
<div /*className="flex items-center gap-2"*/>
144144
{/* Note: to keep animation smooth, we should still keep the elements rendered, but we pass showStats into
145145
them so that they don't render any data (since we're likely hiding stats to prevent lag) */}
146+
<ResourceGraph
147+
active={showStats}
148+
property="globalCheeseAmount"
149+
propertyDisplayName="Global Cheese "
150+
/>
151+
<br />
146152
<ResourceGraph
147153
active={showStats}
148154
property="cheeseAmount"
149-
propertyDisplayName="Cheese Amount "
155+
propertyDisplayName="Cheese Transferred "
150156
/>
151157
<br />
152158
<ResourceGraph

client/src/components/sidebar/game/team-table.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export const ResourceTable: React.FC<ResourceTableProps> = ({ map, teamStat, tea
6262
let catDamagePercent = 0
6363
let ratKingCount = 0
6464
let ratKingPercent = 0
65+
let globalCheese = 0
6566

6667
if (map && teamStat) {
6768
cheeseAmount = teamStat.cheeseAmount
@@ -70,6 +71,7 @@ export const ResourceTable: React.FC<ResourceTableProps> = ({ map, teamStat, tea
7071
catDamagePercent = teamStat.catDamagePercent
7172
ratKingCount = teamStat.ratKingCount
7273
ratKingPercent = teamStat.ratKingPercent
74+
globalCheese = teamStat.globalCheeseAmount
7375
}
7476

7577
const formatPercent = (val: number) => (val * 100).toFixed(1).toString() + '%'
@@ -131,6 +133,7 @@ export const ResourceTable: React.FC<ResourceTableProps> = ({ map, teamStat, tea
131133
</div>
132134
</div>
133135
</div>
136+
<div className="flex items-center w-full mt-2 mb-1 text-xs font-bold justify-around">Global Cheese Amount: {globalCheese}</div>
134137
</div>
135138
)
136139
}
@@ -148,9 +151,9 @@ export const UnitsTable: React.FC<UnitsTableProps> = ({ teamStat, teamIdx }) =>
148151
['Baby Rats', <UnitsIcon teamIdx={teamIdx} img="rat" key="3" />]
149152
]
150153

151-
let data: [string, number[]][] = [['Count', [0, 0, 0, 0]]]
154+
let data: [string, number[]][] = [['Count:', [0, 0, 0, 0]]]
152155
if (teamStat) {
153-
data = [['Count', [teamStat.dirtAmount, teamStat.ratTrapAmount, teamStat.catTrapAmount, teamStat.babyRatCount]]]
156+
data = [['Count:', [teamStat.dirtAmount, teamStat.ratTrapAmount, teamStat.catTrapAmount, teamStat.babyRatCount]]]
154157
}
155158

156159
return (

client/src/playback/Map.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,11 @@ export class CurrentMap {
317317
}
318318
if (ratTrap) {
319319
info.push('Rat Trap')
320+
info.push(`Placed by ${TEAM_COLOR_NAMES[ratTrap - 2]}`)
320321
}
321322
if (catTrap) {
322323
info.push('Cat Trap')
324+
info.push(`Placed by ${TEAM_COLOR_NAMES[catTrap - 2]}`)
323325
}
324326
if (cheese) {
325327
info.push(`Cheese: ${cheese}`)

client/src/playback/RoundStat.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export class TeamRoundStat {
1919
ratKingCount: number = 0
2020
ratKingPercent: number = 0
2121
dirtAmount: number = 0
22+
globalCheeseAmount: number = 0
2223
babyRatCount: number = 0
2324
ratTrapAmount: number = 0
2425
catTrapAmount: number = 0
@@ -75,10 +76,13 @@ export default class RoundStat {
7576
let totalCheese = 0
7677
let totalCatDamage = 0
7778
let totalRatKings = 0
79+
80+
7881
for (let i = 0; i < delta.teamIdsLength(); i++) {
82+
const combinedStat = delta.teamAliveRatKings(i)!
7983
totalCheese += delta.teamCheeseTransferred(i)!
8084
totalCatDamage += delta.teamCatDamage(i)!
81-
totalRatKings += delta.teamAliveRatKings(i)!
85+
totalRatKings += (combinedStat%10) //lmao
8286
}
8387

8488
for (let i = 0; i < delta.teamIdsLength(); i++) {
@@ -87,10 +91,14 @@ export default class RoundStat {
8791
const teamStat = this.teams.get(team) ?? assert.fail(`team ${i} not found in team stats in round`)
8892

8993
teamStat.cheeseAmount = delta.teamCheeseTransferred(i) ?? assert.fail('missing cheese amount')
94+
teamStat.globalCheeseAmount = Math.floor(delta.teamAliveRatKings(i)! / 10)
9095
teamStat.cheesePercent = totalCheese ? teamStat.cheeseAmount / totalCheese : 0
9196
teamStat.catDamageAmount = delta.teamCatDamage(i) ?? assert.fail('missing cat damage amount')
9297
teamStat.catDamagePercent = totalCatDamage ? teamStat.catDamageAmount / totalCatDamage : 0
98+
9399
teamStat.ratKingCount = delta.teamAliveRatKings(i) ?? assert.fail('missing rat king count')
100+
teamStat.ratKingCount %= 10
101+
94102
teamStat.ratKingPercent = totalRatKings ? teamStat.ratKingCount / totalRatKings : 0
95103
teamStat.dirtAmount = delta.teamDirtAmounts(i) ?? assert.fail('missing dirt amount')
96104
teamStat.ratTrapAmount = delta.teamRatTrapCount(i) ?? assert.fail('missing rat trap amount')

0 commit comments

Comments
 (0)