Skip to content

Commit f8c1261

Browse files
authored
Merge pull request #92 from battlecode/master
release engine 1.2.3
2 parents 9b05f3b + 7f44e14 commit f8c1261

6 files changed

Lines changed: 56 additions & 6 deletions

File tree

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { schema } from 'battlecode-schema'
55
import { TeamRoundStat } from '../../../playback/RoundStat'
66
import { DoubleChevronUpIcon } from '../../../icons/chevron'
77
import { CurrentMap } from '../../../playback/Map'
8-
import { useRound } from '../../../playback/GameRunner'
8+
import { useRound, useTurnNumber } from '../../../playback/GameRunner'
99

1010
interface UnitsIconProps {
1111
teamIdx: 0 | 1
@@ -34,6 +34,8 @@ interface TeamTableProps {
3434

3535
export const TeamTable: React.FC<TeamTableProps> = (props: TeamTableProps) => {
3636
const round = useRound()
37+
// force react to re-render when using turn playback
38+
const _turn = useTurnNumber()
3739
const teamStat = round?.stat?.getTeamStat(round?.match.game.teams[props.teamIdx])
3840
const map = round?.map
3941

@@ -63,6 +65,7 @@ export const ResourceTable: React.FC<ResourceTableProps> = ({ map, teamStat, tea
6365
let ratKingCount = 0
6466
let ratKingPercent = 0
6567
let globalCheese = 0
68+
let rawCheese = 0
6669

6770
if (map && teamStat) {
6871
cheeseAmount = teamStat.cheeseAmount
@@ -72,6 +75,7 @@ export const ResourceTable: React.FC<ResourceTableProps> = ({ map, teamStat, tea
7275
ratKingCount = teamStat.ratKingCount
7376
ratKingPercent = teamStat.ratKingPercent
7477
globalCheese = teamStat.globalCheeseAmount
78+
rawCheese = teamStat.globalRawCheeseAmount
7579
}
7680

7781
const formatPercent = (val: number) => (val * 100).toFixed(1).toString() + '%'
@@ -133,7 +137,11 @@ export const ResourceTable: React.FC<ResourceTableProps> = ({ map, teamStat, tea
133137
</div>
134138
</div>
135139
</div>
136-
<div className="flex items-center w-full mt-2 mb-1 text-xs font-bold justify-around">Global Cheese Amount: {globalCheese}</div>
140+
<div className="flex items-center w-full mt-2 mb-1 text-xs font-bold justify-around">
141+
<div>Global Cheese: {globalCheese}</div>
142+
<div>Raw Cheese: {rawCheese}</div>
143+
</div>
144+
137145
</div>
138146
)
139147
}

client/src/components/sidebar/map-editor/map-editor.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ export const MapEditorPage: React.FC<Props> = (props) => {
145145

146146
const applyBrush = (point: { x: number; y: number }) => {
147147
if (!openBrush) return
148+
if (point === null) return
148149

149150
const undoFunc = openBrush.apply(point.x, point.y, openBrush.fields, true)
150151
strokeUndoStack.current.push(undoFunc)

client/src/constants.ts

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,47 @@ export const ENGINE_BUILTIN_MAP_NAMES: string[] = [
2525
// Default
2626
'DefaultSmall',
2727
'DefaultMedium',
28-
'DefaultLarge'
28+
'DefaultLarge',
2929
// Sprint 1
30+
'sittingducks',
31+
'starvation',
32+
'thunderdome',
33+
'popthecork',
34+
'cheesefarm',
35+
'rift',
36+
'ZeroDay',
37+
'pipes',
38+
'Nofreecheese',
39+
'wallsofparadis',
40+
'dirtpassageway',
41+
'trapped',
42+
'arrows',
43+
'Meow',
44+
'dirtfulcat',
45+
'keepout',
3046
// Sprint 2
47+
'5t4rv4t10n_1337',
48+
'cheesebottles',
49+
'hatefullattice',
50+
'knifefight',
51+
'mercifullattice',
52+
'peaceinourtime',
53+
'jail',
54+
'safelycontained',
55+
'minimaze',
56+
'averyfineline',
57+
'averystrangespace',
58+
'canyoudig',
59+
'streetsofnewyork',
60+
'TheHeist',
61+
'closeup',
62+
'corridorofdoomanddespair',
63+
'EscapeTheNight',
64+
'tiny',
65+
'toomuchcheese',
66+
'uneruesansfin',
67+
'whatsthecatdoin',
68+
'whereisthecheese'
3169
// HS
3270
// Quals
3371
]

client/src/playback/RoundStat.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export class TeamRoundStat {
2020
ratKingPercent: number = 0
2121
dirtAmount: number = 0
2222
globalCheeseAmount: number = 0
23+
globalRawCheeseAmount: number = 0
2324
babyRatCount: number = 0
2425
ratTrapAmount: number = 0
2526
catTrapAmount: number = 0
@@ -132,7 +133,10 @@ export default class RoundStat {
132133
// Count number of alive robots
133134
if (body.dead) continue
134135

135-
if (body.robotType == schema.RobotType.RAT) teamStat.babyRatCount++
136+
if (body.robotType == schema.RobotType.RAT) {
137+
teamStat.babyRatCount++
138+
teamStat.globalRawCheeseAmount += body.cheese
139+
}
136140
}
137141

138142
const timems = Date.now() - time

engine/src/main/battlecode/world/RobotControllerImpl.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,8 +556,7 @@ public RobotInfo senseRobotAtLocation(MapLocation loc) throws GameActionExceptio
556556
@Override
557557
public boolean canSenseRobot(int id) {
558558
InternalRobot sensedRobot = getRobotByID(id);
559-
Boolean isFlying = sensedRobot.isBeingThrown();
560-
return sensedRobot != null && isFlying && canSenseLocation(sensedRobot.getLocation());
559+
return sensedRobot != null && !sensedRobot.isBeingThrown() && canSenseLocation(sensedRobot.getLocation());
561560
}
562561

563562
@Override

specs/specs.pdf

-1.12 MB
Binary file not shown.

0 commit comments

Comments
 (0)