Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/tests/test_Player.js
Resources = { | Resources = { | ||||
"GetCodes": () => ["food", "metal", "stone", "wood"], | "GetCodes": () => ["food", "wood", "stone", "metal"], | ||||
"GetResource": () => ({}), | "GetResource": () => ({}), | ||||
"BuildSchema": (type) => { | "BuildSchema": (type) => { | ||||
let schema = ""; | let schema = ""; | ||||
for (let res of Resources.GetCodes()) | for (let res of Resources.GetCodes()) | ||||
schema += | schema += | ||||
"<optional>" + | "<optional>" + | ||||
"<element name='" + res + "'>" + | "<element name='" + res + "'>" + | ||||
"<ref name='" + type + "'/>" + | "<ref name='" + type + "'/>" + | ||||
▲ Show 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | |||||
diplo = [1, 1, 0]; | diplo = [1, 1, 0]; | ||||
cmpPlayer.SetDiplomacy(diplo); | cmpPlayer.SetDiplomacy(diplo); | ||||
diplo[1] = -1; | diplo[1] = -1; | ||||
TS_ASSERT(cmpPlayer.IsAlly(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": { | ||||
"food": 1.0, | |||||
"wood": 1.0, | "wood": 1.0, | ||||
"stone": 1.0, | "stone": 1.0, | ||||
"metal": 1.0 | "metal": 1.0 | ||||
}, | }, | ||||
"sell": { | "sell": { | ||||
"food": 1.0, | |||||
"wood": 1.0, | "wood": 1.0, | ||||
"stone": 1.0, | "stone": 1.0, | ||||
"metal": 1.0 | "metal": 1.0 | ||||
} | } | ||||
}); | }); |
Wildfire Games · Phabricator