mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-18 06:13:55 -07:00
Fix some formal issues noticed by elexis in dc17836fe5.
This was SVN commit r19622.
This commit is contained in:
parent
2d8d082289
commit
1558272fd2
3 changed files with 7 additions and 4 deletions
|
|
@ -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, {
|
||||
|
|
|
|||
Loading…
Reference in a new issue