summaryrefslogtreecommitdiff
path: root/server/lib/core/game_methods.dart
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2026-11-23 15:38:13 +0100
committerJoel Klinghed <the_jk@spawned.biz>2026-11-23 15:38:13 +0100
commit7ee14396b1f1f96ed0472b5949ce82a7f9313276 (patch)
treecddf00fe4049908155a15e813bb8d226ad710f81 /server/lib/core/game_methods.dart
parent4a45fe143bd050d89183427443dedfd656f507bc (diff)
server: make local variables final (prefer_final_locals)
270 locals across 52 files. Six of them were declared with an unnecessarily nullable type (ModifierDeck? / LootDeckModel?) although the initializer is non-nullable; non-final locals were silently flow-promoted to the initializer's type, but final locals are not, so the nullability is dropped where it was wrong.
Diffstat (limited to 'server/lib/core/game_methods.dart')
-rw-r--r--server/lib/core/game_methods.dart18
1 files changed, 9 insertions, 9 deletions
diff --git a/server/lib/core/game_methods.dart b/server/lib/core/game_methods.dart
index cf43ab7..646a9f2 100644
--- a/server/lib/core/game_methods.dart
+++ b/server/lib/core/game_methods.dart
@@ -47,7 +47,7 @@ class GameMethods {
static int getCoinValue({GameState? gameState}) {
final gs = gameState ?? getIt<GameState>();
- int level = gs.level;
+ final int level = gs.level;
if (level == _kCoinMaxLevel) {
return _kCoinMaxValue;
}
@@ -162,7 +162,7 @@ class GameMethods {
}
static List<Character> getCurrentCharactersForState(GameState state) {
- List<Character> characters = [];
+ final List<Character> characters = [];
for (ListItemData data in state.currentList) {
if (data is Character &&
!GameMethods.isObjectiveOrEscort(data.characterClass)) {
@@ -291,7 +291,7 @@ class GameMethods {
}
static List<Monster> getCurrentMonsters({GameState? gameState}) {
- List<Monster> monsters = [];
+ final List<Monster> monsters = [];
final gs = gameState ?? getIt<GameState>();
for (ListItemData data in gs.currentList) {
if (data is Monster) {
@@ -304,7 +304,7 @@ class GameMethods {
static int getNextAvailableBnBStandee(Monster data, {GameState? gameState}) {
final gs = gameState ?? getIt<GameState>();
- int nrOfStandees = data.type.count;
+ final int nrOfStandees = data.type.count;
for (int i = 0; i < nrOfStandees; i++) {
bool isAvailable = true;
for (final item in data.monsterInstances) {
@@ -346,7 +346,7 @@ class GameMethods {
nrOfStandees =
_kPolarBearStandees; //for the special case where there are only 4 standees in first printing
}
- List<int> available = [];
+ final List<int> available = [];
for (int i = 0; i < nrOfStandees; i++) {
bool isAvailable = true;
for (final item in data.monsterInstances) {
@@ -400,7 +400,7 @@ class GameMethods {
if (item.id == ownerId) {
if (item is Monster) {
for (final instance in item.monsterInstances) {
- String id =
+ final String id =
instance.name + instance.gfx + instance.standeeNr.toString();
if (id == figureId) {
return instance;
@@ -408,7 +408,7 @@ class GameMethods {
}
} else if (item is Character) {
for (final instance in item.characterState.summonList) {
- String id =
+ final String id =
instance.name + instance.gfx + instance.standeeNr.toString();
if (id == figureId) {
return instance;
@@ -488,7 +488,7 @@ class GameMethods {
GameState? gameState,
}) {
final gs = gameState ?? getIt<GameState>();
- String scenario = gs.scenario;
+ final String scenario = gs.scenario;
if (edition == "Solo") {
if (scenario.contains("${"#19"} ")) {
return false; //this is forgotten circles
@@ -584,7 +584,7 @@ class GameMethods {
}
static List<ModifierCard> getFactionCards(String faction) {
- List<ModifierCard> retVal = [];
+ final List<ModifierCard> retVal = [];
if (faction == "Demons") {
retVal.add(ModifierCard(CardType.add, "Demons-perks/plus1any"));
retVal.add(