Skip to content
Permalink
Browse files
Implement support for disabling team damage
  • Loading branch information
RussellLVP committed Jul 5, 2020
1 parent ed7643d commit 9f4a27a4e6d76e7531c4c9ea7504de83876bca9b
Showing 3 changed files with 22 additions and 4 deletions.
@@ -44,7 +44,7 @@ export class MockPlayer extends Player {
#fightingStyle_ = Player.kFightingStyleNormal;
#gravity_ = 0.008;
#score_ = 0;
#team_ = 255; // NO_TEAM
#team_ = Player.kNoTeam;
#time_ = [0, 0];
#wantedLevel_ = 0;

@@ -132,13 +132,17 @@ export class DeathmatchGame extends Game {
// and will ensure that all settings for the |player| are synchronized to others.
enableTeamStateForPlayer(player) {
// TODO: Map marker visibility
// TODO: Player team settings

if (this.#teams_.has(player) && !this.#teamDamage_)
player.team = this.#teams_.get(player);
}

// Disables the team-specific state for the given |player|. This will reset the team that they
// are part of when damage has been disabled, clean up marker state, etecetera.
clearTeamStateForPlayer(player) {
// TODO: Map marker visibility
// TODO: Player team settings

if (this.#teams_.has(player) && !this.#teamDamage_)
player.team = Player.kNoTeam;
}
}
@@ -134,6 +134,10 @@ describe('GamesDeathmatch', (it, beforeEach) => {
maximumPlayers: 4,
});

assert.equal(gunther.team, Player.kNoTeam);
assert.equal(russell.team, Player.kNoTeam);
assert.equal(lucy.team, Player.kNoTeam);

assert.isTrue(await gunther.issueCommand('/bubble'));
assert.isTrue(await russell.issueCommand('/bubble'));
assert.isTrue(await lucy.issueCommand('/bubble'));
@@ -148,7 +152,12 @@ describe('GamesDeathmatch', (it, beforeEach) => {
assert.equal(game.getTeamForPlayer(lucy), DeathmatchGame.kTeamBravo);

// TODO: Verify the expected map marker visibility.
// TODO: Verify the expected player team values.

assert.equal(gunther.team, game.getTeamForPlayer(gunther));
assert.equal(russell.team, game.getTeamForPlayer(russell));
assert.equal(lucy.team, game.getTeamForPlayer(lucy));

assert.equal(gunther.team, russell.team);

assert.isTrue(await gunther.issueCommand('/leave'));
assert.isTrue(await russell.issueCommand('/leave'));
@@ -158,6 +167,11 @@ describe('GamesDeathmatch', (it, beforeEach) => {

// Verify that the Game instance has been destroyed, together with all supporting infra.
assert.throws(() => getGameInstance());

assert.equal(gunther.team, Player.kNoTeam);
assert.equal(russell.team, Player.kNoTeam);
assert.equal(lucy.team, Player.kNoTeam);

});

it('should maintain statistics of all participants in the game', async (assert) => {

0 comments on commit 9f4a27a

Please sign in to comment.