mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-07-04 05:55:47 -07:00
petra cleanup
This was SVN commit r17679.
This commit is contained in:
parent
87886b7b03
commit
cccd33e7fe
6 changed files with 67 additions and 68 deletions
|
|
@ -110,7 +110,7 @@ m.AttackPlan = function(gameState, Config, uniqueID, type, data)
|
|||
this.unitStat.Cavalry = { "priority": 1, "minSize": 2, "targetSize": 4, "batchSize": 2, "classes": ["Cavalry", "CitizenSoldier"],
|
||||
"interests": [ ["strength",1], ["cost",1] ] };
|
||||
if (data && data.targetSize)
|
||||
this.unitStat["Infantry"]["targetSize"] = data.targetSize;
|
||||
this.unitStat.Infantry.targetSize = data.targetSize;
|
||||
this.neededShips = 1;
|
||||
}
|
||||
else if (type === "Raid")
|
||||
|
|
@ -435,7 +435,7 @@ m.AttackPlan.prototype.updatePreparation = function(gameState)
|
|||
}
|
||||
this.trainMoreUnits(gameState);
|
||||
// may happen if we have no more training facilities and build orders are canceled
|
||||
if (this.buildOrder.length == 0)
|
||||
if (!this.buildOrder.length)
|
||||
return 0; // will abort the plan
|
||||
}
|
||||
return 1;
|
||||
|
|
@ -788,13 +788,14 @@ m.AttackPlan.prototype.chooseTarget = function(gameState)
|
|||
// sameLand true means that we look for a target for which we do not need to take a transport
|
||||
m.AttackPlan.prototype.getNearestTarget = function(gameState, position, sameLand)
|
||||
{
|
||||
var targets;
|
||||
if (this.type === "Raid")
|
||||
var targets = this.raidTargetFinder(gameState);
|
||||
targets = this.raidTargetFinder(gameState);
|
||||
else if (this.type === "Rush" || this.type === "Attack")
|
||||
var targets = this.rushTargetFinder(gameState, this.targetPlayer);
|
||||
targets = this.rushTargetFinder(gameState, this.targetPlayer);
|
||||
else
|
||||
var targets = this.defaultTargetFinder(gameState, this.targetPlayer);
|
||||
if (targets.length == 0)
|
||||
targets = this.defaultTargetFinder(gameState, this.targetPlayer);
|
||||
if (!targets.length)
|
||||
return undefined;
|
||||
|
||||
var land = gameState.ai.accessibility.getAccessValue(position);
|
||||
|
|
@ -854,11 +855,12 @@ m.AttackPlan.prototype.defaultTargetFinder = function(gameState, playerEnemy)
|
|||
m.AttackPlan.prototype.rushTargetFinder = function(gameState, playerEnemy)
|
||||
{
|
||||
var targets = new API3.EntityCollection(gameState.sharedScript);
|
||||
var buildings;
|
||||
if (playerEnemy !== undefined)
|
||||
var buildings = gameState.getEnemyStructures(playerEnemy).toEntityArray();
|
||||
buildings = gameState.getEnemyStructures(playerEnemy).toEntityArray();
|
||||
else
|
||||
var buildings = gameState.getEnemyStructures().toEntityArray();
|
||||
if (buildings.length == 0)
|
||||
buildings = gameState.getEnemyStructures().toEntityArray();
|
||||
if (!buildings.length)
|
||||
return targets;
|
||||
|
||||
this.position = this.unitCollection.getCentrePosition();
|
||||
|
|
@ -897,7 +899,7 @@ m.AttackPlan.prototype.rushTargetFinder = function(gameState, playerEnemy)
|
|||
if (target)
|
||||
targets.addEnt(target);
|
||||
|
||||
if (targets.length == 0)
|
||||
if (!targets.length)
|
||||
{
|
||||
if (this.type === "Attack")
|
||||
targets = this.defaultTargetFinder(gameState, playerEnemy);
|
||||
|
|
@ -1030,7 +1032,7 @@ m.AttackPlan.prototype.StartAttack = function(gameState)
|
|||
// Runs every turn after the attack is executed
|
||||
m.AttackPlan.prototype.update = function(gameState, events)
|
||||
{
|
||||
if (this.unitCollection.length == 0)
|
||||
if (!this.unitCollection.length)
|
||||
return 0;
|
||||
|
||||
Engine.ProfileStart("Update Attack");
|
||||
|
|
@ -1105,13 +1107,13 @@ m.AttackPlan.prototype.update = function(gameState, events)
|
|||
}
|
||||
// Are we arrived at destination ?
|
||||
var maybe = true;
|
||||
if (attackedUnitNB == 0)
|
||||
if (!attackedUnitNB)
|
||||
{
|
||||
let siegeNB = 0;
|
||||
for (let ent of this.unitCollection.values())
|
||||
if (this.isSiegeUnit(gameState, ent))
|
||||
siegeNB++;
|
||||
if (siegeNB == 0)
|
||||
if (!siegeNB)
|
||||
maybe = false;
|
||||
}
|
||||
if (maybe && ((gameState.ai.HQ.territoryMap.getOwner(this.position) === this.targetPlayer && attackedNB > 1) || attackedNB > 3))
|
||||
|
|
@ -1306,7 +1308,7 @@ m.AttackPlan.prototype.update = function(gameState, events)
|
|||
var ourUnit = gameState.getEntityById(evt.target);
|
||||
if (this.isSiegeUnit(gameState, ourUnit))
|
||||
{ // if our siege units are attacked, we'll send some units to deal with enemies.
|
||||
var collec = this.unitCollection.filter(API3.Filters.not(API3.Filters.byClass("Siege"))).filterNearest(ourUnit.position(), 5);
|
||||
let collec = this.unitCollection.filter(API3.Filters.not(API3.Filters.byClass("Siege"))).filterNearest(ourUnit.position(), 5);
|
||||
for (let ent of collec.values())
|
||||
{
|
||||
if (this.isSiegeUnit(gameState, ent)) // needed as mauryan elephants are not filtered out
|
||||
|
|
@ -1325,7 +1327,7 @@ m.AttackPlan.prototype.update = function(gameState, events)
|
|||
{
|
||||
if (this.isSiegeUnit(gameState, attacker))
|
||||
{ // if our unit is attacked by a siege unit, we'll send some melee units to help it.
|
||||
var collec = this.unitCollection.filter(API3.Filters.byClass("Melee")).filterNearest(ourUnit.position(), 5);
|
||||
let collec = this.unitCollection.filter(API3.Filters.byClass("Melee")).filterNearest(ourUnit.position(), 5);
|
||||
for (var ent of collec.values())
|
||||
{
|
||||
ent.attack(attacker.id(), false);
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@ m.BaseManager.prototype.getResourceLevel = function (gameState, type, nearbyOnly
|
|||
{
|
||||
var count = 0;
|
||||
var check = {};
|
||||
var nearby = this.dropsiteSupplies[type]["nearby"];
|
||||
var nearby = this.dropsiteSupplies[type].nearby;
|
||||
for (let supply of nearby)
|
||||
{
|
||||
if (check[supply.id]) // avoid double counting as same resource can appear several time
|
||||
|
|
@ -407,7 +407,7 @@ m.BaseManager.prototype.getResourceLevel = function (gameState, type, nearbyOnly
|
|||
}
|
||||
if (nearbyOnly)
|
||||
return count;
|
||||
var medium = this.dropsiteSupplies[type]["medium"];
|
||||
var medium = this.dropsiteSupplies[type].medium;
|
||||
for (let supply of medium)
|
||||
{
|
||||
if (check[supply.id])
|
||||
|
|
@ -448,7 +448,7 @@ m.BaseManager.prototype.checkResourceLevels = function (gameState, queues)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (queues.dropsites.length() == 0 && gameState.getOwnFoundations().filter(API3.Filters.byClass("Storehouse")).length == 0)
|
||||
else if (!queues.dropsites.length() && !gameState.getOwnFoundations().filter(API3.Filters.byClass("Storehouse")).length)
|
||||
{
|
||||
if (gameState.ai.playedTurn > this.gatherers[type].nextCheck)
|
||||
{
|
||||
|
|
@ -469,7 +469,7 @@ m.BaseManager.prototype.checkResourceLevels = function (gameState, queues)
|
|||
var newDP = this.findBestDropsiteLocation(gameState, type);
|
||||
if (newDP.quality > 50 && gameState.ai.HQ.canBuild(gameState, "structures/{civ}_storehouse"))
|
||||
queues.dropsites.addPlan(new m.ConstructionPlan(gameState, "structures/{civ}_storehouse", { "base": this.ID, "type": type }, newDP.pos));
|
||||
else if (gameState.getOwnFoundations().filter(API3.Filters.byClass("CivCentre")).length == 0 && queues.civilCentre.length() == 0)
|
||||
else if (!gameState.getOwnFoundations().filter(API3.Filters.byClass("CivCentre")).length && !queues.civilCentre.length())
|
||||
{
|
||||
// No good dropsite, try to build a new base if no base already planned,
|
||||
// and if not possible, be less strict on dropsite quality
|
||||
|
|
@ -482,7 +482,7 @@ m.BaseManager.prototype.checkResourceLevels = function (gameState, queues)
|
|||
this.gatherers[type].used = 0;
|
||||
this.gatherers[type].lost = 0;
|
||||
}
|
||||
else if (total == 0)
|
||||
else if (total === 0)
|
||||
this.gatherers[type].nextCheck = gameState.ai.playedTurn + 10;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ m.DiplomacyManager.prototype.tributes = function(gameState)
|
|||
tribute[res] = 100;
|
||||
toSend = true;
|
||||
}
|
||||
else if (this.Config.chat && availableResources[res] == 0 && allyResources[res] > totalResources[res] + 600)
|
||||
else if (this.Config.chat && availableResources[res] === 0 && allyResources[res] > totalResources[res] + 600)
|
||||
{
|
||||
if (gameState.ai.elapsedTime < this.nextTributeRequest.get("all"))
|
||||
continue;
|
||||
|
|
@ -97,9 +97,9 @@ m.DiplomacyManager.prototype.checkEvents = function (gameState, events)
|
|||
for (let evt of events.Attacked)
|
||||
{
|
||||
let target = gameState.getEntityById(evt.target);
|
||||
if (!target || !target.position()
|
||||
|| gameState.ai.HQ.territoryMap.getOwner(target.position()) !== PlayerID
|
||||
|| !gameState.isPlayerEnemy(target.owner()))
|
||||
if (!target || !target.position() ||
|
||||
gameState.ai.HQ.territoryMap.getOwner(target.position()) !== PlayerID ||
|
||||
!gameState.isPlayerEnemy(target.owner()))
|
||||
continue;
|
||||
let attacker = gameState.getEntityById(evt.attacker);
|
||||
if (!attacker || attacker.owner() === PlayerID || !gameState.isPlayerAlly(attacker.owner()))
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ m.allowCapture = function(ent, target)
|
|||
// Makes the worker deposit the currently carried resources at the closest accessible dropsite
|
||||
m.returnResources = function(gameState, ent)
|
||||
{
|
||||
if (!ent.resourceCarrying() || ent.resourceCarrying().length == 0 || !ent.position())
|
||||
if (!ent.resourceCarrying() || !ent.resourceCarrying().length || !ent.position())
|
||||
return false;
|
||||
|
||||
var resource = ent.resourceCarrying()[0].type;
|
||||
|
|
@ -122,8 +122,8 @@ m.IsSupplyFull = function(gameState, ent)
|
|||
return true;
|
||||
var turnCache = gameState.ai.HQ.turnCache;
|
||||
var count = ent.resourceSupplyNumGatherers();
|
||||
if (turnCache["resourceGatherer"] && turnCache["resourceGatherer"][ent.id()])
|
||||
count += turnCache["resourceGatherer"][ent.id()];
|
||||
if (turnCache.resourceGatherer && turnCache.resourceGatherer[ent.id()])
|
||||
count += turnCache.resourceGatherer[ent.id()];
|
||||
if (count >= ent.maxGatherers())
|
||||
return true;
|
||||
return false;
|
||||
|
|
@ -197,15 +197,15 @@ m.dumpEntity = function(ent)
|
|||
{
|
||||
if (!ent)
|
||||
return;
|
||||
API3.warn(" >>> id " + ent.id() + " name " + ent.genericName() + " pos " + ent.position()
|
||||
+ " state " + ent.unitAIState());
|
||||
API3.warn(" base " + ent.getMetadata(PlayerID, "base") + " >>> role " + ent.getMetadata(PlayerID, "role")
|
||||
+ " subrole " + ent.getMetadata(PlayerID, "subrole"));
|
||||
API3.warn(" >>> id " + ent.id() + " name " + ent.genericName() + " pos " + ent.position() +
|
||||
" state " + ent.unitAIState());
|
||||
API3.warn(" base " + ent.getMetadata(PlayerID, "base") + " >>> role " + ent.getMetadata(PlayerID, "role") +
|
||||
" subrole " + ent.getMetadata(PlayerID, "subrole"));
|
||||
API3.warn("owner " + ent.owner() + " health " + ent.hitpoints() + " healthMax " + ent.maxHitpoints());
|
||||
API3.warn(" garrisoning " + ent.getMetadata(PlayerID, "garrisoning") + " garrisonHolder " + ent.getMetadata(PlayerID, "garrisonHolder")
|
||||
+ " plan " + ent.getMetadata(PlayerID, "plan") + " transport " + ent.getMetadata(PlayerID, "transport")
|
||||
+ " gather-type " + ent.getMetadata(PlayerID, "gather-type") + " target-foundation " + ent.getMetadata(PlayerID, "target-foundation")
|
||||
+ " PartOfArmy " + ent.getMetadata(PlayerID, "PartOfArmy"));
|
||||
API3.warn(" garrisoning " + ent.getMetadata(PlayerID, "garrisoning") + " garrisonHolder " + ent.getMetadata(PlayerID, "garrisonHolder") +
|
||||
" plan " + ent.getMetadata(PlayerID, "plan") + " transport " + ent.getMetadata(PlayerID, "transport") +
|
||||
" gather-type " + ent.getMetadata(PlayerID, "gather-type") + " target-foundation " + ent.getMetadata(PlayerID, "target-foundation") +
|
||||
" PartOfArmy " + ent.getMetadata(PlayerID, "PartOfArmy"));
|
||||
};
|
||||
|
||||
return m;
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ m.HQ.prototype.checkEvents = function (gameState, events, queues)
|
|||
if (!ent.position())
|
||||
{
|
||||
// we are autogarrisoned, check that the holder is registered in the garrisonManager
|
||||
let holderId = ent.unitAIOrderData()[0]["target"];
|
||||
let holderId = ent.unitAIOrderData()[0].target;
|
||||
let holder = gameState.getEntityById(holderId);
|
||||
if (holder)
|
||||
this.garrisonManager.registerHolder(gameState, holder);
|
||||
|
|
@ -361,7 +361,7 @@ m.HQ.prototype.checkEvents = function (gameState, events, queues)
|
|||
if (decayToGaia)
|
||||
continue;
|
||||
let ratioMax = 0.70;
|
||||
for (let evt of events["Attacked"])
|
||||
for (let evt of events.Attacked)
|
||||
{
|
||||
if (ent.id() != evt.target)
|
||||
continue;
|
||||
|
|
@ -426,10 +426,7 @@ m.HQ.prototype.trainMoreWorkers = function(gameState, queues)
|
|||
// and adapt the batch size of the first and second queued workers and females to the present population
|
||||
// to ease a possible recovery if our population was drastically reduced by an attack
|
||||
// (need to go up to second queued as it is accounted in queueManager)
|
||||
if (numWorkers < 12)
|
||||
var size = 1;
|
||||
else
|
||||
var size = Math.min(5, Math.ceil(numWorkers / 10));
|
||||
var size = numWorkers < 12 ? 1 : Math.min(5, Math.ceil(numWorkers / 10));
|
||||
if (queues.villager.plans[0])
|
||||
{
|
||||
queues.villager.plans[0].number = Math.min(queues.villager.plans[0].number, size);
|
||||
|
|
@ -624,7 +621,7 @@ m.HQ.prototype.getTotalResourceLevel = function(gameState)
|
|||
// This is not per-se exact, it performs a few adjustments ad-hoc to account for travel distance, stuffs like that.
|
||||
m.HQ.prototype.GetCurrentGatherRates = function(gameState)
|
||||
{
|
||||
if (!this.turnCache["gatherRates"])
|
||||
if (!this.turnCache.gatherRates)
|
||||
{
|
||||
for (let res in this.currentRates)
|
||||
this.currentRates[res] = 0.5 * this.GetTCResGatherer(res);
|
||||
|
|
@ -641,7 +638,7 @@ m.HQ.prototype.GetCurrentGatherRates = function(gameState)
|
|||
this.currentRates[res] = 0;
|
||||
}
|
||||
}
|
||||
this.turnCache["gatherRates"] = true;
|
||||
this.turnCache.gatherRates = true;
|
||||
}
|
||||
|
||||
return this.currentRates;
|
||||
|
|
@ -812,10 +809,10 @@ m.HQ.prototype.findEconomicCCLocation = function(gameState, template, resource,
|
|||
if (this.borderMap.map[j] > 0) // disfavor the borders of the map
|
||||
norm *= 0.5;
|
||||
|
||||
var val = 2*gameState.sharedScript.CCResourceMaps[resource].map[j]
|
||||
+ gameState.sharedScript.CCResourceMaps["wood"].map[j]
|
||||
+ gameState.sharedScript.CCResourceMaps["stone"].map[j]
|
||||
+ gameState.sharedScript.CCResourceMaps["metal"].map[j];
|
||||
var val = 2*gameState.sharedScript.CCResourceMaps[resource].map[j] +
|
||||
gameState.sharedScript.CCResourceMaps.wood.map[j] +
|
||||
gameState.sharedScript.CCResourceMaps.stone.map[j] +
|
||||
gameState.sharedScript.CCResourceMaps.metal.map[j];
|
||||
val *= norm;
|
||||
|
||||
if (bestVal !== undefined && val < bestVal)
|
||||
|
|
@ -1312,7 +1309,7 @@ m.HQ.prototype.buildMoreHouses = function(gameState,queues)
|
|||
{
|
||||
let requirements = gameState.getPhaseRequirements(2);
|
||||
let count = gameState.getOwnStructures().filter(API3.Filters.byClass(requirements["class"])).length;
|
||||
if (requirements && count < requirements["number"] && this.stopBuilding.has(gameState.applyCiv("structures/{civ}_house")))
|
||||
if (requirements && count < requirements.number && this.stopBuilding.has(gameState.applyCiv("structures/{civ}_house")))
|
||||
{
|
||||
if (this.Config.debug > 1)
|
||||
API3.warn("no room to place a house ... try to be less restrictive");
|
||||
|
|
@ -1324,7 +1321,7 @@ m.HQ.prototype.buildMoreHouses = function(gameState,queues)
|
|||
{
|
||||
if (houseQueue[i].isGo(gameState))
|
||||
++count;
|
||||
else if (count < requirements["number"])
|
||||
else if (count < requirements.number)
|
||||
{
|
||||
houseQueue[i].isGo = function () { return true; };
|
||||
++count;
|
||||
|
|
@ -1335,7 +1332,7 @@ m.HQ.prototype.buildMoreHouses = function(gameState,queues)
|
|||
if (this.requireHouses)
|
||||
{
|
||||
let requirements = gameState.getPhaseRequirements(2);
|
||||
if (gameState.getOwnStructures().filter(API3.Filters.byClass(requirements["class"])).length >= requirements["number"])
|
||||
if (gameState.getOwnStructures().filter(API3.Filters.byClass(requirements["class"])).length >= requirements.number)
|
||||
this.requireHouses = undefined;
|
||||
}
|
||||
|
||||
|
|
@ -1634,7 +1631,7 @@ m.HQ.prototype.trainEmergencyUnits = function(gameState, positions)
|
|||
{
|
||||
for (var item of nearestAnchor._entity.trainingQueue)
|
||||
{
|
||||
if (item.metadata && item.metadata["garrisonType"])
|
||||
if (item.metadata && item.metadata.garrisonType)
|
||||
numGarrisoned += item.count;
|
||||
else if (!item.progress && (!item.metadata || !item.metadata.trainer))
|
||||
nearestAnchor.stopProduction(item.id);
|
||||
|
|
@ -1892,9 +1889,9 @@ m.HQ.prototype.isNearInvadingArmy = function(pos)
|
|||
|
||||
m.HQ.prototype.isUnderEnemyFire = function(gameState, pos, radius = 0)
|
||||
{
|
||||
if (!this.turnCache["firingStructures"])
|
||||
this.turnCache["firingStructures"] = gameState.updatingCollection("FiringStructures", API3.Filters.hasDefensiveFire(), gameState.getEnemyStructures());
|
||||
for (let ent of this.turnCache["firingStructures"].values())
|
||||
if (!this.turnCache.firingStructures)
|
||||
this.turnCache.firingStructures = gameState.updatingCollection("FiringStructures", API3.Filters.hasDefensiveFire(), gameState.getEnemyStructures());
|
||||
for (let ent of this.turnCache.firingStructures.values())
|
||||
{
|
||||
let range = radius + ent.attackRange("Ranged").max;
|
||||
if (API3.SquareVectorDistance(ent.position(), pos) < range*range)
|
||||
|
|
@ -1908,33 +1905,33 @@ m.HQ.prototype.isUnderEnemyFire = function(gameState, pos, radius = 0)
|
|||
// add a gatherer to the turn cache for this supply.
|
||||
m.HQ.prototype.AddTCGatherer = function(supplyID)
|
||||
{
|
||||
if (this.turnCache["resourceGatherer"] && this.turnCache["resourceGatherer"][supplyID] !== undefined)
|
||||
++this.turnCache["resourceGatherer"][supplyID];
|
||||
if (this.turnCache.resourceGatherer && this.turnCache.resourceGatherer[supplyID] !== undefined)
|
||||
++this.turnCache.resourceGatherer[supplyID];
|
||||
else
|
||||
{
|
||||
if (!this.turnCache["resourceGatherer"])
|
||||
this.turnCache["resourceGatherer"] = {};
|
||||
this.turnCache["resourceGatherer"][supplyID] = 1;
|
||||
if (!this.turnCache.resourceGatherer)
|
||||
this.turnCache.resourceGatherer = {};
|
||||
this.turnCache.resourceGatherer[supplyID] = 1;
|
||||
}
|
||||
};
|
||||
|
||||
// remove a gatherer to the turn cache for this supply.
|
||||
m.HQ.prototype.RemoveTCGatherer = function(supplyID)
|
||||
{
|
||||
if (this.turnCache["resourceGatherer"] && this.turnCache["resourceGatherer"][supplyID])
|
||||
--this.turnCache["resourceGatherer"][supplyID];
|
||||
if (this.turnCache.resourceGatherer && this.turnCache.resourceGatherer[supplyID])
|
||||
--this.turnCache.resourceGatherer[supplyID];
|
||||
else
|
||||
{
|
||||
if (!this.turnCache["resourceGatherer"])
|
||||
this.turnCache["resourceGatherer"] = {};
|
||||
this.turnCache["resourceGatherer"][supplyID] = -1;
|
||||
if (!this.turnCache.resourceGatherer)
|
||||
this.turnCache.resourceGatherer = {};
|
||||
this.turnCache.resourceGatherer[supplyID] = -1;
|
||||
}
|
||||
};
|
||||
|
||||
m.HQ.prototype.GetTCGatherer = function(supplyID)
|
||||
{
|
||||
if (this.turnCache["resourceGatherer"] && this.turnCache["resourceGatherer"][supplyID])
|
||||
return this.turnCache["resourceGatherer"][supplyID];
|
||||
if (this.turnCache.resourceGatherer && this.turnCache.resourceGatherer[supplyID])
|
||||
return this.turnCache.resourceGatherer[supplyID];
|
||||
else
|
||||
return 0;
|
||||
};
|
||||
|
|
@ -1946,7 +1943,7 @@ m.HQ.prototype.AddTCResGatherer = function(resource)
|
|||
++this.turnCache["resourceGatherer-" + resource];
|
||||
else
|
||||
this.turnCache["resourceGatherer-" + resource] = 1;
|
||||
this.turnCache["gatherRates"] = false;
|
||||
this.turnCache.gatherRates = false;
|
||||
};
|
||||
|
||||
m.HQ.prototype.GetTCResGatherer = function(resource)
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ m.TradeManager.prototype.performBarter = function(gameState)
|
|||
{
|
||||
barterers[0].barter(bestToBuy, "food", 100);
|
||||
if (this.Config.debug > 2)
|
||||
API3.warn("Contingency bartering: sold food for " + bestToBuy + " available sell " + available["food"] +
|
||||
API3.warn("Contingency bartering: sold food for " + bestToBuy + " available sell " + available.food +
|
||||
" available buy " + available[bestToBuy] + " barterRate " + getBarterRate(prices, bestToBuy, "food"));
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue