forked from mirrors/0ad
Fix some formal issues noticed by elexis in dc17836fe5.
This was SVN commit r19622.
This commit is contained in:
@@ -118,7 +118,7 @@ Barter.prototype.ExchangeResources = function(playerEntity, resourceToSell, reso
|
||||
}
|
||||
|
||||
// Increase price difference for both exchange resources.
|
||||
// Overal price difference (dynamic +- constant) can't exceed +-99%.
|
||||
// Overall price difference (dynamic +/- constant) can't exceed +-99%.
|
||||
this.priceDifferences[resourceToSell] -= this.DIFFERENCE_PER_DEAL * numberOfDeals;
|
||||
this.priceDifferences[resourceToSell] = Math.min(99 - this.CONSTANT_DIFFERENCE, Math.max(this.CONSTANT_DIFFERENCE - 99, this.priceDifferences[resourceToSell]));
|
||||
this.priceDifferences[resourceToBuy] += this.DIFFERENCE_PER_DEAL * numberOfDeals;
|
||||
|
||||
@@ -57,7 +57,10 @@ Player.prototype.Init = function()
|
||||
this.disabledTechnologies = {};
|
||||
this.startingTechnologies = [];
|
||||
this.spyCostMultiplier = +this.template.SpyCostMultiplier;
|
||||
this.barterMultiplier = {"buy": this.template.BarterMultiplier.Buy, "sell": this.template.BarterMultiplier.Sell };
|
||||
this.barterMultiplier = {
|
||||
"buy": this.template.BarterMultiplier.Buy,
|
||||
"sell": this.template.BarterMultiplier.Sell
|
||||
};
|
||||
|
||||
// Initial resources and trading goods probability in steps of 5
|
||||
let resCodes = Resources.GetCodes();
|
||||
@@ -762,7 +765,7 @@ Player.prototype.OnValueModification = function(msg)
|
||||
if (msg.valueNames.indexOf("Player/SpyCostMultiplier") != -1)
|
||||
this.spyCostMultiplier = ApplyValueModificationsToPlayer("Player/SpyCostMultiplier", +this.template.SpyCostMultiplier, this.entity, this.playerID);
|
||||
|
||||
if (msg.valueNames.toString().search("Player/BarterMultiplier") != -1)
|
||||
if (msg.valueNames.some(mod => mod.startsWith("Player/BarterMultiplier/")) != -1)
|
||||
for (let res in this.template.BarterMultiplier.Buy)
|
||||
{
|
||||
this.barterMultiplier.buy[res] = ApplyValueModificationsToEntity("Player/BarterMultiplier/Buy/"+res, +this.template.BarterMultiplier.Buy[res], this.entity);
|
||||
|
||||
@@ -59,7 +59,7 @@ AddMock(playerEnt, IID_Player, {
|
||||
bought = amount;
|
||||
return true;
|
||||
},
|
||||
"GetBarterMultiplier": () => (multiplier)
|
||||
"GetBarterMultiplier": () => multiplier
|
||||
});
|
||||
|
||||
AddMock(SYSTEM_ENTITY, IID_RangeManager, {
|
||||
|
||||
Reference in New Issue
Block a user