Skip to content

Commit 51dcb81

Browse files
committed
get backstabbing team
1 parent be51465 commit 51dcb81

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

engine/src/main/battlecode/common/RobotController.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ public interface RobotController {
5353
*/
5454
boolean isCooperation();
5555

56+
/**
57+
* Returns the backstabbing team, or null if still in cooperation mode.
58+
*
59+
* @return the team that performed the backstab, or null if still in cooperation mode.
60+
*
61+
* @battlecode.doc.costlymethod
62+
*/
63+
Team getBackstabbingTeam();
64+
5665
// *********************************
5766
// ****** UNIT QUERY METHODS *******
5867
// *********************************

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,10 @@ public boolean isCooperation() {
405405
return this.isCooperation;
406406
}
407407

408+
public Team getBackStabbingTeam(){
409+
return this.backstabber;
410+
}
411+
408412
public int getRoundsSinceBackstab() {
409413
if (this.isCooperation) {
410414
return 0;

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ public boolean isCooperation() {
106106
return this.gameWorld.isCooperation();
107107
}
108108

109+
@Override
110+
public Team getBackstabbingTeam() {
111+
return this.gameWorld.getBackStabbingTeam();
112+
}
113+
109114
// *********************************
110115
// ****** UNIT QUERY METHODS *******
111116
// *********************************

0 commit comments

Comments
 (0)