mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-22 22:35:24 +00:00
Discounts can only be used one time (#892)
## Description: Discounts on structures and warships can only be used one time. ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors --------- Co-authored-by: Scott Anderson <scottanderson@users.noreply.github.com>
This commit is contained in:
@@ -466,8 +466,7 @@ export class FakeHumanExecution implements Execution {
|
||||
|
||||
private maybeSpawnStructure(type: UnitType, maxNum: number): boolean {
|
||||
if (this.player === null) throw new Error("not initialized");
|
||||
const units = this.player.unitsIncludingConstruction(type);
|
||||
if (units.length >= maxNum) {
|
||||
if (this.player.unitsOwned(type) >= maxNum) {
|
||||
return false;
|
||||
}
|
||||
if (this.player.gold() < this.cost(type)) {
|
||||
|
||||
Reference in New Issue
Block a user