[common] add gun bonus

This commit is contained in:
2019-04-02 23:22:21 +03:00
parent 663935bd75
commit 4e2b65c225
12 changed files with 21 additions and 11 deletions

View File

@@ -52,12 +52,12 @@ class CollisionProcessor {
// Nothing
} else {
if (!tank.protect.active) {
if (tank.config.downgrade != null) {
tank.config = engine.config.getTank(tank.config.downgrade);
engine.change(tank, TYPE);
} else if (tank.hits > 0) {
if (tank.hits > 0) {
tank.hits--;
engine.change(tank, HIT);
} else if (tank.config.downgrade != null) {
tank.config = engine.config.getTank(tank.config.downgrade);
engine.change(tank, TYPE);
} else {
engine.destroy(tank, bullet.tank.playerId);
}

View File

@@ -323,6 +323,16 @@ class Game extends GameDispatcher {
eagle.protect.on(bonus.config.duration);
engine.change(eagle, EntityChange.PROTECT);
}
case 'gun':
if (tank.config.upgrade != null) {
while (tank.config.upgrade != null) {
tank.config = config.getTank(tank.config.upgrade);
}
engine.change(tank, EntityChange.TYPE);
} else {
tank.hits++;
engine.change(tank, EntityChange.HIT);
}
case _:
engine.destroy(tank); // :-D
}

View File

@@ -30,10 +30,10 @@ player:
color: 0xFFFFFF
bonus: 0.25
tanks:
- {type: bot0, rate: 0.25}
- {type: bot1, rate: 0.25}
- {type: bot2, rate: 0.25}
- {type: bot3, rate: 0.25}
- {type: bot0, rate: 0.30}
- {type: bot1, rate: 0.28}
- {type: bot2, rate: 0.27}
- {type: bot3, rate: 0.15}
presets:
# player1
@@ -117,7 +117,7 @@ tanks:
skin: pc
- type: human3
upgrade: human3
# upgrade: human3
downgrade: human2
width: 42
height: 38
@@ -181,4 +181,4 @@ bonuses:
- {score: 500, type: life}
- {score: 500, type: shovel, duration: 10}
- {score: 500, type: star}
- {score: 500, type: gun}