[common] clock bonus freeze team instead tanks
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
* Updated `CreateGamePopup` for any screen sizes
|
* Updated `CreateGamePopup` for any screen sizes
|
||||||
* Fixed tank destroy zero score label
|
* Fixed tank destroy zero score label
|
||||||
* Added custom size map support
|
* Added custom size map support
|
||||||
|
* Fixed clock bonus for spawned tanks
|
||||||
|
|
||||||
0.14.0
|
0.14.0
|
||||||
------
|
------
|
||||||
|
|||||||
2
WORK.md
2
WORK.md
@@ -1,4 +1,3 @@
|
|||||||
* [bug] **clock** bonus for spawned tanks
|
|
||||||
* [feature] **shovel** bonus with armor bricks
|
* [feature] **shovel** bonus with armor bricks
|
||||||
* [feature] bonuses in dota/death mod
|
* [feature] bonuses in dota/death mod
|
||||||
* [feature] tanks and bullets speed balancing
|
* [feature] tanks and bullets speed balancing
|
||||||
@@ -6,3 +5,4 @@
|
|||||||
* [feature] network game series
|
* [feature] network game series
|
||||||
* [feature] map packs (create in editor, import in game, save imported in local storage)
|
* [feature] map packs (create in editor, import in game, save imported in local storage)
|
||||||
* [feature] update bots
|
* [feature] update bots
|
||||||
|
* [feature] improve bonuses system
|
||||||
|
|||||||
@@ -74,6 +74,9 @@ class GameRunner extends Game implements EngineListener {
|
|||||||
private function spawn(task:SpawnTask):Void {
|
private function spawn(task:SpawnTask):Void {
|
||||||
var player = getPlayer(task.playerId);
|
var player = getPlayer(task.playerId);
|
||||||
var tank = builder.buildTank(task.point, task.playerId, task.tankType, player.state.color, player.state.name);
|
var tank = builder.buildTank(task.point, task.playerId, task.tankType, player.state.color, player.state.name);
|
||||||
|
if (getTeam(player.id.team).freezing) {
|
||||||
|
tank.freezing = true;
|
||||||
|
}
|
||||||
engine.spawn(tank);
|
engine.spawn(tank);
|
||||||
gameEventSignal.emit(EventUtil.buildTankSpawn(tank));
|
gameEventSignal.emit(EventUtil.buildTankSpawn(tank));
|
||||||
if (player.config.protect > 0) {
|
if (player.config.protect > 0) {
|
||||||
@@ -101,6 +104,8 @@ class GameRunner extends Game implements EngineListener {
|
|||||||
|
|
||||||
private function freezeTank(tank:Tank, duration:Float):Void {
|
private function freezeTank(tank:Tank, duration:Float):Void {
|
||||||
tank.freezing = true;
|
tank.freezing = true;
|
||||||
|
tank.stop();
|
||||||
|
gameEventSignal.emit(STOP(TANK(tank.id)));
|
||||||
gameEventSignal.emit(CHANGE(TANK_FREEZE(tank.id, tank.freezing)));
|
gameEventSignal.emit(CHANGE(TANK_FREEZE(tank.id, tank.freezing)));
|
||||||
engine.ticker.emit(function() {
|
engine.ticker.emit(function() {
|
||||||
tank.freezing = false;
|
tank.freezing = false;
|
||||||
@@ -108,6 +113,23 @@ class GameRunner extends Game implements EngineListener {
|
|||||||
}, Std.int(duration * 1000));
|
}, Std.int(duration * 1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function freezeTeam(teamId:TeamId, duration:Float):Void {
|
||||||
|
getTeam(teamId).freezing = true;
|
||||||
|
for (tank in engine.iterTanks(teamTank(teamId))) {
|
||||||
|
tank.freezing = true;
|
||||||
|
tank.stop();
|
||||||
|
gameEventSignal.emit(STOP(TANK(tank.id)));
|
||||||
|
gameEventSignal.emit(CHANGE(TANK_FREEZE(tank.id, tank.freezing)));
|
||||||
|
}
|
||||||
|
engine.ticker.emit(function() {
|
||||||
|
getTeam(teamId).freezing = false;
|
||||||
|
for (tank in engine.iterTanks(teamTank(teamId))) {
|
||||||
|
tank.freezing = false;
|
||||||
|
gameEventSignal.emit(CHANGE(TANK_FREEZE(tank.id, tank.freezing)));
|
||||||
|
}
|
||||||
|
}, Std.int(duration * 1000));
|
||||||
|
}
|
||||||
|
|
||||||
private function checkComplete():Void {
|
private function checkComplete():Void {
|
||||||
var actives:Array<TeamId> = [];
|
var actives:Array<TeamId> = [];
|
||||||
for (team in teams.iterator()) {
|
for (team in teams.iterator()) {
|
||||||
@@ -121,12 +143,17 @@ class GameRunner extends Game implements EngineListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (actives.length == 1) {
|
switch actives {
|
||||||
|
case [winner]: complete(winner);
|
||||||
|
case []: complete(null);
|
||||||
|
case _:
|
||||||
|
}
|
||||||
|
/*if (actives.length == 1) {
|
||||||
complete(actives[0]);
|
complete(actives[0]);
|
||||||
}
|
}
|
||||||
if (actives.length == 0) {
|
if (actives.length == 0) {
|
||||||
complete(null);
|
complete(null);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private function complete(winner:TeamId):Void {
|
private function complete(winner:TeamId):Void {
|
||||||
@@ -244,6 +271,10 @@ class GameRunner extends Game implements EngineListener {
|
|||||||
gameEventSignal.emit(EventUtil.buildBonusSpawn(bonus));
|
gameEventSignal.emit(EventUtil.buildBonusSpawn(bonus));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private inline function teamTank(team:TeamId):Tank->Bool {
|
||||||
|
return function(tank:Tank):Bool return team == tank.playerId.team;
|
||||||
|
}
|
||||||
|
|
||||||
private inline function alienTank(team:TeamId):Tank->Bool {
|
private inline function alienTank(team:TeamId):Tank->Bool {
|
||||||
return function(tank:Tank):Bool return team != tank.playerId.team;
|
return function(tank:Tank):Bool return team != tank.playerId.team;
|
||||||
}
|
}
|
||||||
@@ -261,11 +292,14 @@ class GameRunner extends Game implements EngineListener {
|
|||||||
case "helmet":
|
case "helmet":
|
||||||
protectTank(tank, bonus.config.duration);
|
protectTank(tank, bonus.config.duration);
|
||||||
case "clock":
|
case "clock":
|
||||||
for (t in engine.iterTanks(alienTank(tank.playerId.team))) {
|
for (team in teams) {
|
||||||
freezeTank(t, bonus.config.duration);
|
if (team.id != tank.playerId.team) {
|
||||||
t.stop();
|
freezeTeam(team.id, bonus.config.duration);
|
||||||
gameEventSignal.emit(STOP(TANK(t.id)));
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
/*for (t in engine.iterTanks(alienTank(tank.playerId.team))) {
|
||||||
|
freezeTank(t, bonus.config.duration);
|
||||||
|
}*/
|
||||||
case "shovel":
|
case "shovel":
|
||||||
// ToDo: protect eagle/area
|
// ToDo: protect eagle/area
|
||||||
var team:Team = teams[tank.playerId.team];
|
var team:Team = teams[tank.playerId.team];
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package ru.m.tankz.game;
|
package ru.m.tankz.game;
|
||||||
|
|
||||||
import ru.m.tankz.game.GameState.TeamState;
|
|
||||||
import ru.m.tankz.Type;
|
|
||||||
import ru.m.tankz.config.Config;
|
import ru.m.tankz.config.Config;
|
||||||
|
import ru.m.tankz.game.GameState;
|
||||||
|
import ru.m.tankz.Type;
|
||||||
|
|
||||||
class Team {
|
class Team {
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@ class Team {
|
|||||||
public var eagleId(default, default):Int;
|
public var eagleId(default, default):Int;
|
||||||
private var active(default, default):Int;
|
private var active(default, default):Int;
|
||||||
public var state(default, default):TeamState;
|
public var state(default, default):TeamState;
|
||||||
|
public var freezing(default, default):Bool;
|
||||||
|
|
||||||
public function new(config:TeamConfig, points:Array<SpawnPoint>, state:TeamState = null) {
|
public function new(config:TeamConfig, points:Array<SpawnPoint>, state:TeamState = null) {
|
||||||
this.id = config.id;
|
this.id = config.id;
|
||||||
|
|||||||
Reference in New Issue
Block a user