Skip to content

Commit

Permalink
Merge branch 'client'
Browse files Browse the repository at this point in the history
  • Loading branch information
TheApplePieGod committed Jan 6, 2025
2 parents 6bed4c8 + ead41a7 commit 498cd53
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 39 deletions.
Binary file modified client/icons/icon.ico
Binary file not shown.
2 changes: 2 additions & 0 deletions client/src/components/sidebar/queue/queue-game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export const QueuedGame: React.FC<Props> = (props) => {
return 'by resignation '
case schema.WinType.MAJORITY_PAINTED:
return 'by having paint majority '
case schema.WinType.ALL_UNITS_DESTROYED:
return 'by destroying all enemy units '
case schema.WinType.AREA_PAINTED:
return 'by painting more territory '
case schema.WinType.MORE_TOWERS:
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/sidebar/runner/scaffold.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ async function dispatchMatch(
break
}
case SupportedLanguage.Python: {
options = [`run.py`, `run`, `--p1=${teamA}`, `--p2=${teamB}`, `--map=${[...selectedMaps][0]}`]
options = [`run.py`, `run`, `--p1=${teamA}`, `--p2=${teamB}`, `--maps=${[...selectedMaps].join(',')}`]
break
}
}
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/sidebar/update-warning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export const UpdateWarning = () => {
<p className="text-yellow-800 text-xs">
<b>NEW VERSION AVAILABLE!</b>
<br />
download with <code>gradle update</code> followed by <code>gradle build</code>, and then restart the
client: v{update.latest}
download with (<code>gradle update</code> followed by <code>gradle build</code>) for java and (
<code>python run.py update</code>) for python, and then restart the client: v{update.latest}
</p>
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion client/src/playback/Actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const ACTION_DEFINITIONS: Record<schema.Action, typeof Action<ActionUnion
const target = round.bodies.getById(this.actionData.id())

// Apply damage to the target
target.hp -= this.actionData.damage()
target.hp = Math.max(target.hp - this.actionData.damage(), 0)
}
},
[schema.Action.SplashAction]: class SplashAction extends Action<schema.SplashAction> {
Expand Down
2 changes: 1 addition & 1 deletion client/src/playback/Bodies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export default class Bodies {

// Update properties
body.pos = { x: turn.x(), y: turn.y() }
body.hp = turn.health()
body.hp = Math.max(turn.health(), 0)
body.paint = turn.paint()
body.moveCooldown = turn.moveCooldown()
body.actionCooldown = turn.actionCooldown()
Expand Down
3 changes: 2 additions & 1 deletion client/src/playback/Match.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,9 @@ export default class Match {
for (let i = 0; i < footer.timelineMarkersLength(); i++) {
const marker = footer.timelineMarkers(i)!

// Add one to round so that the visualizer properly shows the action completed state
this.timelineMarkers.push({
round: marker.round(),
round: marker.round() + 1,
team: marker.team(),
colorHex: marker.colorHex(),
label: marker.label() ?? 'Unknown'
Expand Down
15 changes: 8 additions & 7 deletions schema/java/battlecode/schema/WinType.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ public final class WinType {
private WinType() { }
public static final byte RESIGNATION = 0;
public static final byte MAJORITY_PAINTED = 1;
public static final byte AREA_PAINTED = 2;
public static final byte MORE_TOWERS = 3;
public static final byte MORE_MONEY = 4;
public static final byte MORE_STORED_PAINT = 5;
public static final byte MORE_ROBOTS = 6;
public static final byte COIN_FLIP = 7;
public static final byte ALL_UNITS_DESTROYED = 2;
public static final byte AREA_PAINTED = 3;
public static final byte MORE_TOWERS = 4;
public static final byte MORE_MONEY = 5;
public static final byte MORE_STORED_PAINT = 6;
public static final byte MORE_ROBOTS = 7;
public static final byte COIN_FLIP = 8;

public static final String[] names = { "RESIGNATION", "MAJORITY_PAINTED", "AREA_PAINTED", "MORE_TOWERS", "MORE_MONEY", "MORE_STORED_PAINT", "MORE_ROBOTS", "COIN_FLIP", };
public static final String[] names = { "RESIGNATION", "MAJORITY_PAINTED", "ALL_UNITS_DESTROYED", "AREA_PAINTED", "MORE_TOWERS", "MORE_MONEY", "MORE_STORED_PAINT", "MORE_ROBOTS", "COIN_FLIP", };

public static String name(int e) { return names[e]; }
}
Expand Down
13 changes: 7 additions & 6 deletions schema/js/battlecode/schema/win-type.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
export declare enum WinType {
RESIGNATION = 0,
MAJORITY_PAINTED = 1,
AREA_PAINTED = 2,
MORE_TOWERS = 3,
MORE_MONEY = 4,
MORE_STORED_PAINT = 5,
MORE_ROBOTS = 6,
COIN_FLIP = 7
ALL_UNITS_DESTROYED = 2,
AREA_PAINTED = 3,
MORE_TOWERS = 4,
MORE_MONEY = 5,
MORE_STORED_PAINT = 6,
MORE_ROBOTS = 7,
COIN_FLIP = 8
}
13 changes: 7 additions & 6 deletions schema/js/battlecode/schema/win-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ var WinType;
(function (WinType) {
WinType[WinType["RESIGNATION"] = 0] = "RESIGNATION";
WinType[WinType["MAJORITY_PAINTED"] = 1] = "MAJORITY_PAINTED";
WinType[WinType["AREA_PAINTED"] = 2] = "AREA_PAINTED";
WinType[WinType["MORE_TOWERS"] = 3] = "MORE_TOWERS";
WinType[WinType["MORE_MONEY"] = 4] = "MORE_MONEY";
WinType[WinType["MORE_STORED_PAINT"] = 5] = "MORE_STORED_PAINT";
WinType[WinType["MORE_ROBOTS"] = 6] = "MORE_ROBOTS";
WinType[WinType["COIN_FLIP"] = 7] = "COIN_FLIP";
WinType[WinType["ALL_UNITS_DESTROYED"] = 2] = "ALL_UNITS_DESTROYED";
WinType[WinType["AREA_PAINTED"] = 3] = "AREA_PAINTED";
WinType[WinType["MORE_TOWERS"] = 4] = "MORE_TOWERS";
WinType[WinType["MORE_MONEY"] = 5] = "MORE_MONEY";
WinType[WinType["MORE_STORED_PAINT"] = 6] = "MORE_STORED_PAINT";
WinType[WinType["MORE_ROBOTS"] = 7] = "MORE_ROBOTS";
WinType[WinType["COIN_FLIP"] = 8] = "COIN_FLIP";
})(WinType || (exports.WinType = WinType = {}));
4 changes: 2 additions & 2 deletions schema/python/battlecode/schema/MatchFooter.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class MatchFooter(object):
def GetRootAsMatchFooter(cls, buf: bytes, offset: int) -> MatchFooter: ...
def Init(self, buf: bytes, pos: int) -> None: ...
def Winner(self) -> int: ...
def WinType(self) -> typing.Literal[WinType.RESIGNATION, WinType.MAJORITY_PAINTED, WinType.AREA_PAINTED, WinType.MORE_TOWERS, WinType.MORE_MONEY, WinType.MORE_STORED_PAINT, WinType.MORE_ROBOTS, WinType.COIN_FLIP]: ...
def WinType(self) -> typing.Literal[WinType.RESIGNATION, WinType.MAJORITY_PAINTED, WinType.ALL_UNITS_DESTROYED, WinType.AREA_PAINTED, WinType.MORE_TOWERS, WinType.MORE_MONEY, WinType.MORE_STORED_PAINT, WinType.MORE_ROBOTS, WinType.COIN_FLIP]: ...
def TotalRounds(self) -> int: ...
def TimelineMarkers(self, i: int) -> TimelineMarker | None: ...
def TimelineMarkersLength(self) -> int: ...
Expand All @@ -29,7 +29,7 @@ class MatchFooter(object):
def MatchFooterStart(builder: flatbuffers.Builder) -> None: ...
def Start(builder: flatbuffers.Builder) -> None: ...
def MatchFooterAddWinner(builder: flatbuffers.Builder, winner: int) -> None: ...
def MatchFooterAddWinType(builder: flatbuffers.Builder, winType: typing.Literal[WinType.RESIGNATION, WinType.MAJORITY_PAINTED, WinType.AREA_PAINTED, WinType.MORE_TOWERS, WinType.MORE_MONEY, WinType.MORE_STORED_PAINT, WinType.MORE_ROBOTS, WinType.COIN_FLIP]) -> None: ...
def MatchFooterAddWinType(builder: flatbuffers.Builder, winType: typing.Literal[WinType.RESIGNATION, WinType.MAJORITY_PAINTED, WinType.ALL_UNITS_DESTROYED, WinType.AREA_PAINTED, WinType.MORE_TOWERS, WinType.MORE_MONEY, WinType.MORE_STORED_PAINT, WinType.MORE_ROBOTS, WinType.COIN_FLIP]) -> None: ...
def MatchFooterAddTotalRounds(builder: flatbuffers.Builder, totalRounds: int) -> None: ...
def MatchFooterAddTimelineMarkers(builder: flatbuffers.Builder, timelineMarkers: uoffset) -> None: ...
def MatchFooterStartTimelineMarkersVector(builder: flatbuffers.Builder, num_elems: int) -> uoffset: ...
Expand Down
13 changes: 7 additions & 6 deletions schema/python/battlecode/schema/WinType.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
class WinType(object):
RESIGNATION = 0
MAJORITY_PAINTED = 1
AREA_PAINTED = 2
MORE_TOWERS = 3
MORE_MONEY = 4
MORE_STORED_PAINT = 5
MORE_ROBOTS = 6
COIN_FLIP = 7
ALL_UNITS_DESTROYED = 2
AREA_PAINTED = 3
MORE_TOWERS = 4
MORE_MONEY = 5
MORE_STORED_PAINT = 6
MORE_ROBOTS = 7
COIN_FLIP = 8
1 change: 1 addition & 0 deletions schema/python/battlecode/schema/WinType.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ uoffset: typing.TypeAlias = flatbuffers.number_types.UOffsetTFlags.py_type
class WinType(object):
RESIGNATION: int
MAJORITY_PAINTED: int
ALL_UNITS_DESTROYED: int
AREA_PAINTED: int
MORE_TOWERS: int
MORE_MONEY: int
Expand Down
13 changes: 7 additions & 6 deletions schema/ts/battlecode/schema/win-type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
export enum WinType {
RESIGNATION = 0,
MAJORITY_PAINTED = 1,
AREA_PAINTED = 2,
MORE_TOWERS = 3,
MORE_MONEY = 4,
MORE_STORED_PAINT = 5,
MORE_ROBOTS = 6,
COIN_FLIP = 7
ALL_UNITS_DESTROYED = 2,
AREA_PAINTED = 3,
MORE_TOWERS = 4,
MORE_MONEY = 5,
MORE_STORED_PAINT = 6,
MORE_ROBOTS = 7,
COIN_FLIP = 8
}
Binary file modified specs/specs.pdf
Binary file not shown.

0 comments on commit 498cd53

Please sign in to comment.