survivorFORT property
get FORT stats from survivor squads.
Implementation
Map<String, int> get survivorFORT {
int fortitude = 0;
int resistance = 0;
int offense = 0;
int tech = 0;
for (var squad in survivorSquads.values.toList()) {
STWWorker? leadWorker;
if (squad.where((s) => s.squad?["slotIdx"] == 0).isNotEmpty) {
leadWorker = squad.firstWhere((s) => s.squad?["slotIdx"] == 0);
}
for (STWWorker worker in squad) {
num totalBonus = worker.rating;
if (worker.squad?["slotIdx"] == 0) {
totalBonus += worker.leadBonus;
} else if (leadWorker != null) {
totalBonus += worker.bonus(leadWorker);
}
switch (worker.squad?["type"]) {
case "medicine":
fortitude += totalBonus.toInt();
break;
case "arms":
offense += totalBonus.toInt();
break;
case "synthesis":
tech += totalBonus.toInt();
break;
case "scavenging":
resistance += totalBonus.toInt();
break;
}
}
}
return {
"fortitude": fortitude,
"resistance": resistance,
"offense": offense,
"tech": tech,
};
}