From e9103acb076636f9e1df4091d4200e69ee556fb3 Mon Sep 17 00:00:00 2001 From: Wrycu Date: Sat, 22 Jun 2019 14:30:27 -0700 Subject: [PATCH] feat(attack): base attack - now spawn all CAP aircraft when a base is attacked --- game/event/baseattack.py | 4 ++-- theater/base.py | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/game/event/baseattack.py b/game/event/baseattack.py index 77a7cb03..dfe08ff1 100644 --- a/game/event/baseattack.py +++ b/game/event/baseattack.py @@ -84,8 +84,8 @@ class BaseAttackEvent(Event): departure_cp=self.departure_cp, to_cp=self.to_cp) - defenders = self.to_cp.base.scramble_sweep(self.game.settings.multiplier) - defenders.update(self.to_cp.base.scramble_cas(self.game.settings.multiplier)) + defenders = self.to_cp.base.scramble_last_defense() + #defenders.update(self.to_cp.base.scramble_cas(self.game.settings.multiplier)) op.setup(cas=flights[CAS], escort=flights[CAP], diff --git a/theater/base.py b/theater/base.py index 163879ad..e77057df 100644 --- a/theater/base.py +++ b/theater/base.py @@ -164,6 +164,11 @@ class Base: def scramble_sweep(self, multiplier: float) -> typing.Dict[PlaneType, int]: return self._find_best_planes(CAP, self.scramble_count(multiplier, CAP)) + def scramble_last_defense(self): + # return as many CAP-capable aircraft as we can since this is the last defense of the base + # (but not more than 20 - that's just nuts) + return self._find_best_planes(CAP, min(self.total_planes, 20)) + def scramble_cas(self, multiplier: float) -> typing.Dict[PlaneType, int]: return self._find_best_planes(CAS, self.scramble_count(multiplier, CAS))