@gaia-project/engine
Advanced tools
Comparing version 4.8.26 to 4.8.27
{ | ||
"name": "@gaia-project/engine", | ||
"version": "4.8.26", | ||
"version": "4.8.27", | ||
"description": "Javascript engine for project gaia", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -95,3 +95,3 @@ "use strict"; | ||
/** reserved op for planetary institute and academies becoming 4pw structures */ | ||
Operator["Special"] = "PA->4pw"; | ||
Operator["FourPowerBuildings"] = "PA->4pw"; | ||
})(Operator = exports.Operator || (exports.Operator = {})); | ||
@@ -98,0 +98,0 @@ var Condition; |
@@ -56,3 +56,3 @@ "use strict"; | ||
let remaining; | ||
if ([enums_1.Operator.Special].includes(this.spec)) { | ||
if ([enums_1.Operator.FourPowerBuildings].includes(this.spec)) { | ||
this.condition = enums_1.Condition.None; | ||
@@ -59,0 +59,0 @@ this.rewards = []; |
@@ -94,3 +94,3 @@ "use strict"; | ||
[enums_1.Operator.Pass]: [], | ||
[enums_1.Operator.Special]: [], | ||
[enums_1.Operator.FourPowerBuildings]: [], | ||
}; | ||
@@ -104,2 +104,10 @@ // Did we decline the last offer? | ||
} | ||
resourceIncome(resource) { | ||
const i = this.income; | ||
const index = i.search(new RegExp("[0-9]+" + resource)); | ||
if (index < 0) { | ||
return 0; | ||
} | ||
return parseInt(i.substr(index)); | ||
} | ||
get actions() { | ||
@@ -552,3 +560,7 @@ return this.events[enums_1.Operator.Activate].map((event) => event.action()); | ||
tile.enabled = false; | ||
this.removeEvents(events_1.default.parse(techs_1.default[tile.tile], `tech-${pos}`)); | ||
const events = events_1.default.parse(techs_1.default[tile.tile], `tech-${pos}`); | ||
this.removeEvents(events); | ||
if (events.some((event) => event.operator === enums_1.Operator.FourPowerBuildings)) { | ||
this.federationCache = null; | ||
} | ||
} | ||
@@ -662,3 +674,3 @@ incomeSelection(additionalEvents) { | ||
} | ||
const hasSpecialOperator = (_c = options === null || options === void 0 ? void 0 : options.hasSpecialOperator) !== null && _c !== void 0 ? _c : this.events[enums_1.Operator.Special].length > 0; | ||
const hasSpecialOperator = (_c = options === null || options === void 0 ? void 0 : options.hasSpecialOperator) !== null && _c !== void 0 ? _c : this.events[enums_1.Operator.FourPowerBuildings].length > 0; | ||
if (baseValue === 3 && hasSpecialOperator) { | ||
@@ -665,0 +677,0 @@ baseValue = 4; |
@@ -8,3 +8,3 @@ "use strict"; | ||
[enums_1.TechTile.Tech2]: ["pt > k"], | ||
[enums_1.TechTile.Tech3]: [enums_1.Operator.Special], | ||
[enums_1.TechTile.Tech3]: [enums_1.Operator.FourPowerBuildings], | ||
[enums_1.TechTile.Tech4]: ["7vp"], | ||
@@ -11,0 +11,0 @@ [enums_1.TechTile.Tech5]: ["+o,pw"], |
{ | ||
"name": "@gaia-project/engine", | ||
"version": "4.8.26", | ||
"version": "4.8.27", | ||
"description": "Javascript engine for project gaia", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -92,3 +92,3 @@ export enum Planet { | ||
/** reserved op for planetary institute and academies becoming 4pw structures */ | ||
Special = "PA->4pw", | ||
FourPowerBuildings = "PA->4pw", | ||
} | ||
@@ -95,0 +95,0 @@ |
@@ -22,3 +22,3 @@ import { expect } from "chai"; | ||
expect(event.operator).to.equal(Operator.Special); | ||
expect(event.operator).to.equal(Operator.FourPowerBuildings); | ||
}); | ||
@@ -25,0 +25,0 @@ |
@@ -101,3 +101,3 @@ import { | ||
if ([Operator.Special].includes(this.spec as Operator)) { | ||
if ([Operator.FourPowerBuildings].includes(this.spec as Operator)) { | ||
this.condition = Condition.None; | ||
@@ -104,0 +104,0 @@ this.rewards = []; |
@@ -26,2 +26,3 @@ import assert from "assert"; | ||
Resource, | ||
Resource as ResourceEnum, | ||
Ship, | ||
@@ -115,3 +116,3 @@ TechPos, | ||
[Operator.Pass]: [], | ||
[Operator.Special]: [], | ||
[Operator.FourPowerBuildings]: [], | ||
}; | ||
@@ -139,2 +140,13 @@ // To avoid recalculating federations every time | ||
resourceIncome(resource: ResourceEnum) { | ||
const i = this.income; | ||
const index = i.search(new RegExp("[0-9]+" + resource)); | ||
if (index < 0) { | ||
return 0; | ||
} | ||
return parseInt(i.substr(index)); | ||
} | ||
get actions() { | ||
@@ -685,3 +697,9 @@ return this.events[Operator.Activate].map((event) => event.action()); | ||
tile.enabled = false; | ||
this.removeEvents(Event.parse(techs[tile.tile], `tech-${pos}` as TechPos)); | ||
const events = Event.parse(techs[tile.tile], `tech-${pos}` as TechPos); | ||
this.removeEvents(events); | ||
if (events.some((event) => event.operator === Operator.FourPowerBuildings)) { | ||
this.federationCache = null; | ||
} | ||
} | ||
@@ -829,3 +847,3 @@ | ||
const hasSpecialOperator = options?.hasSpecialOperator ?? this.events[Operator.Special].length > 0; | ||
const hasSpecialOperator = options?.hasSpecialOperator ?? this.events[Operator.FourPowerBuildings].length > 0; | ||
if (baseValue === 3 && hasSpecialOperator) { | ||
@@ -832,0 +850,0 @@ baseValue = 4; |
@@ -6,3 +6,3 @@ import { AdvTechTile, AdvTechTilePos, Operator, TechTile, TechTilePos } from "../enums"; | ||
[TechTile.Tech2]: ["pt > k"], | ||
[TechTile.Tech3]: [Operator.Special], | ||
[TechTile.Tech3]: [Operator.FourPowerBuildings], | ||
[TechTile.Tech4]: ["7vp"], | ||
@@ -9,0 +9,0 @@ [TechTile.Tech5]: ["+o,pw"], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1081090
22413