Home
/
browser-rts.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
94edfb6
)
barracks improve training time
author
xangelo
<git@xangelo.ca>
Tue, 24 May 2022 16:43:59 +0000
(12:43 -0400)
committer
xangelo
<git@xangelo.ca>
Tue, 24 May 2022 16:43:59 +0000
(12:43 -0400)
src/repository/city.ts
patch
|
blob
|
history
diff --git
a/src/repository/city.ts
b/src/repository/city.ts
index 9c2153c263cb79655c7ce9c91c3c386ee3394b14..56b57d030bd8f5a7b82edd73d76f08dccf74fcdb 100644
(file)
--- a/
src/repository/city.ts
+++ b/
src/repository/city.ts
@@
-269,7
+269,11
@@
where l.sector_id = ?`, [sector_id]);
await this.save(city);
await this.save(city);
- const due = Duration.fromObject({ hours: unit.time});
+ // 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});
+
const queue = await this.unitTrainigQueue.create(
city.owner,
DateTime.now().plus({ milliseconds: due.as('milliseconds') }).toMillis(),
const queue = await this.unitTrainigQueue.create(
city.owner,
DateTime.now().plus({ milliseconds: due.as('milliseconds') }).toMillis(),
@@
-295,6
+299,10
@@
where l.sector_id = ?`, [sector_id]);
return power
}
return power
}
+ barracksImprovement(city: City): number {
+ return city.barracks * 0.0001;
+ }
+
maxPopulation(city: City): number {
return city.homes * 25;
}
maxPopulation(city: City): number {
return city.homes * 25;
}