await this.save(city);
// barracks can drop this by 0.01% for each barrack.
- const barracksOffset = _.round((this.barracksImprovement(city) * unit.time) + unit.time, 2);
- const due = Duration.fromObject({ hours: barracksOffset});
+ let additionalOffset = 0;
+ if(unit.slug === 'sp_attackers') {
+ additionalOffset = (this.spAttackerTraininerBoost(city) * unit.time);
+ }
+ else if(unit.slug === 'sp_defenders') {
+ additionalOffset = (this.spDefenderTraininerBoost(city) * unit.time);
+ }
+
+ const barracksOffset = _.round((this.barracksImprovement(city) * unit.time) + unit.time - additionalOffset, 2);
+
+ const due = Duration.fromObject({ hours: barracksOffset });
const queue = await this.unitTrainigQueue.create(
city.owner,
return city.barracks * 0.0001;
}
+ spAttackerTraininerBoost(city: City): number {
+ return city.special_attacker_trainer * 0.002;
+ }
+
+ spDefenderTraininerBoost(city: City): number {
+ return city.special_defender_trainer * 0.002;
+ }
+
maxPopulation(city: City): number {
return city.homes * 25;
}