Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/tests/test_Player.js
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | |||||
var playerID = 1; | var playerID = 1; | ||||
cmpPlayer.SetPlayerID(playerID); | cmpPlayer.SetPlayerID(playerID); | ||||
TS_ASSERT_EQUALS(cmpPlayer.GetPlayerID(), playerID); | TS_ASSERT_EQUALS(cmpPlayer.GetPlayerID(), playerID); | ||||
TS_ASSERT_EQUALS(cmpPlayer.GetPopulationCount(), 0); | TS_ASSERT_EQUALS(cmpPlayer.GetPopulationCount(), 0); | ||||
TS_ASSERT_EQUALS(cmpPlayer.GetPopulationLimit(), 0); | TS_ASSERT_EQUALS(cmpPlayer.GetPopulationLimit(), 0); | ||||
cmpPlayer.SetDiplomacy([-1, 1, 0, 1, -1]); | |||||
TS_ASSERT_UNEVAL_EQUALS(cmpPlayer.GetAllies(), [1, 3]); | |||||
TS_ASSERT_UNEVAL_EQUALS(cmpPlayer.GetEnemies(), [0, 4]); | |||||
var diplo = cmpPlayer.GetDiplomacy(); | |||||
diplo[0] = 1; | |||||
TS_ASSERT(cmpPlayer.IsEnemy(0)); | |||||
diplo = [1, 1, 0]; | |||||
cmpPlayer.SetDiplomacy(diplo); | |||||
diplo[1] = -1; | |||||
TS_ASSERT(cmpPlayer.IsAlly(1)); | |||||
TS_ASSERT_EQUALS(cmpPlayer.GetSpyCostMultiplier(), 1); | TS_ASSERT_EQUALS(cmpPlayer.GetSpyCostMultiplier(), 1); | ||||
TS_ASSERT_UNEVAL_EQUALS(cmpPlayer.GetBarterMultiplier(), { | TS_ASSERT_UNEVAL_EQUALS(cmpPlayer.GetBarterMultiplier(), { | ||||
"buy": { | "buy": { | ||||
"wood": 1.0, | "wood": 1.0, | ||||
"stone": 1.0, | "stone": 1.0, | ||||
"metal": 1.0 | "metal": 1.0 | ||||
}, | }, | ||||
"sell": { | "sell": { | ||||
Show All 31 Lines |
Wildfire Games · Phabricator