@gaia-project/engine
Advanced tools
Comparing version 4.8.50 to 4.8.51
{ | ||
"name": "@gaia-project/engine", | ||
"version": "4.8.50", | ||
"version": "4.8.51", | ||
"description": "Javascript engine for project gaia", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -547,6 +547,5 @@ "use strict"; | ||
// Taklons & Nevlas have different power rules, so this is why we use that roundabout way | ||
const spentPower = this.spendablePowerTokens(); | ||
const creditGain = spentPower * this.tokenModifier; | ||
const creditGain = this.spendablePowerTokens(); | ||
if (creditGain > 0) { | ||
gain(new reward_1.default(-creditGain, enums_1.Resource.ChargePower), new reward_1.default(creditGain, enums_1.Resource.Credit)); | ||
gain(new reward_1.default(-creditGain / this.tokenModifier, enums_1.Resource.ChargePower), new reward_1.default(creditGain, enums_1.Resource.Credit)); | ||
} | ||
@@ -553,0 +552,0 @@ const qics = this.qics; |
{ | ||
"name": "@gaia-project/engine", | ||
"version": "4.8.50", | ||
"version": "4.8.51", | ||
"description": "Javascript engine for project gaia", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -7,2 +7,23 @@ import { expect } from "chai"; | ||
const movesWithPi = ` | ||
init 2 randomSeed | ||
p1 faction firaks | ||
p2 faction nevlas | ||
p1 build m -1x-1 | ||
p2 build m -1x0 | ||
p2 build m 3x-3 | ||
p1 build m 3x-2 | ||
p2 booster booster3 | ||
p1 booster booster7 | ||
p1 build ts -1x-1. | ||
p2 charge 1pw | ||
p2 build ts -1x0. | ||
p1 charge 2pw | ||
p1 build PI -1x-1. | ||
p2 charge 2pw | ||
p2 build PI -1x0. | ||
p1 charge 3pw | ||
p1 up terra. | ||
`; | ||
describe("Nevlas", () => { | ||
@@ -50,24 +71,3 @@ it("should allow Nevlas to use action power using empowered tokens and free actions", () => { | ||
it("should move the correct number of tokens to area 1", () => { | ||
const engine = new Engine( | ||
parseMoves(` | ||
init 2 randomSeed | ||
p1 faction firaks | ||
p2 faction nevlas | ||
p1 build m -1x-1 | ||
p2 build m -1x0 | ||
p2 build m 3x-3 | ||
p1 build m 3x-2 | ||
p2 booster booster3 | ||
p1 booster booster7 | ||
p1 build ts -1x-1. | ||
p2 charge 1pw | ||
p2 build ts -1x0. | ||
p1 charge 2pw | ||
p1 build PI -1x-1. | ||
p2 charge 2pw | ||
p2 build PI -1x0. | ||
p1 charge 3pw | ||
p1 up terra. | ||
`) | ||
); | ||
const engine = new Engine(parseMoves(movesWithPi)); | ||
@@ -80,2 +80,19 @@ const area1 = engine.player(Player.Player2).data.power.area1; | ||
}); | ||
it("should respect token modifier in final resource handing", () => { | ||
const engine = new Engine(parseMoves(movesWithPi)); | ||
const player = engine.player(Player.Player2); | ||
const data = player.data; | ||
data.victoryPoints = 0; | ||
data.credits = 0; | ||
data.ores = 0; | ||
data.qics = 0; | ||
data.knowledge = 0; | ||
data.power.area2 = 0; | ||
data.power.area3 = 5; | ||
data.finalResourceHandling(); | ||
expect(data.victoryPoints).to.equal(3); | ||
}); | ||
}); |
@@ -628,6 +628,5 @@ import assert from "assert"; | ||
// Taklons & Nevlas have different power rules, so this is why we use that roundabout way | ||
const spentPower = this.spendablePowerTokens(); | ||
const creditGain = spentPower * this.tokenModifier; | ||
const creditGain = this.spendablePowerTokens(); | ||
if (creditGain > 0) { | ||
gain(new Reward(-creditGain, Resource.ChargePower), new Reward(creditGain, Resource.Credit)); | ||
gain(new Reward(-creditGain / this.tokenModifier, Resource.ChargePower), new Reward(creditGain, Resource.Credit)); | ||
} | ||
@@ -634,0 +633,0 @@ |
Sorry, the diff of this file is not supported yet
1173115
24118