diff options
Diffstat (limited to 'server/lib/core')
138 files changed, 25727 insertions, 0 deletions
diff --git a/server/lib/core/action_handler.dart b/server/lib/core/action_handler.dart new file mode 100644 index 0000000..2c73bb1 --- /dev/null +++ b/server/lib/core/action_handler.dart @@ -0,0 +1,179 @@ +import 'package:logging/logging.dart'; + +import 'game_event.dart'; +import 'state/game_state.dart'; + +final _log = Logger('ActionHandler'); + +/// Executes commands and maintains undo/redo history. +/// +/// Server port of the reference app's `ActionHandler`: the `ValueNotifier`s +/// are plain fields, and the server/client branching is gone — this process +/// is always the server, so every action runs locally, saves, and notifies +/// the (Phase 2) broadcast hook [onAction]. +class ActionHandler { + int commandIndex = -1; + final List<Command?> _commands = []; + final List<String> _commandDescriptions = []; + final List<GameSaveState?> _gameSaveStates = []; + + List<Command?> get commands => List.unmodifiable(_commands); + List<String> get commandDescriptions => + List.unmodifiable(_commandDescriptions); + List<GameSaveState?> get gameSaveStates => List.unmodifiable(_gameSaveStates); + + /// The event produced by the most recent state transition. + /// + /// Set before [commandIndex] changes so that listeners can read the + /// correct event during their rebuild. + GameEvent lastEvent = const NoEvent(); + + final int maxUndo = 250; + + final GameState _gameState; + + /// Set by the network layer (Phase 2); null in tests. + /// + /// Invoked after every action/undo/redo with the new command index, the + /// action's `describe()` string, and the serialized [GameEvent] — the + /// pieces the reference app put into its `{i, d, e, s}` envelope. + void Function(int index, String description, String eventJson)? onAction; + + ActionHandler({required GameState gameState}) : _gameState = gameState; + + /// Resets all command/description/save-state history to a clean slate, + /// keeping only the most recent save state as the baseline. + void resetCommandHistory() { + _commands.clear(); + _commandDescriptions.clear(); + if (_gameSaveStates.length > 1) { + _gameSaveStates.removeRange(0, _gameSaveStates.length - 1); + } + } + + /// Clears only the local commands list. + void clearLocalCommands() { + _commands.clear(); + } + + /// Inserts a description received from the network at [index]. + void insertReceivedDescription(int index, String description) { + _commandDescriptions.insert(index, description); + } + + /// Appends a save-state snapshot. Called by [GameState.save] and [GameState.load]. + void addSaveState(GameSaveState state) { + _gameSaveStates.add(state); + } + + void updateAllUI() { + _gameState.notifyListeners(); + _gameState.notifyAllMonsterInstances(); + } + + Command getCurrent() { + final cmd = _commands[commandIndex]; + if (cmd == null) throw StateError('No command at index $commandIndex'); + return cmd; + } + + void undo() { + if (commandIndex >= 0) { + // Guard against out-of-bounds access: in the server multiplayer path + // updateStateFromMessage sets commandIndex directly then calls save() + // once, which can leave commandIndex >= gameSaveStates.length. + final saveState = commandIndex < _gameSaveStates.length + ? _gameSaveStates[commandIndex] + : null; + if (saveState != null) { + saveState.load(_gameState); + saveState.saveToDisk(_gameState); + updateAllUI(); + _sendState('undo'); + } + lastEvent = const NoEvent(); + commandIndex--; + } + } + + void redo() { + if (commandIndex < _commandDescriptions.length - 1) { + lastEvent = const NoEvent(); + commandIndex++; + final nextIdx = commandIndex + 1; + final nextState = (nextIdx < _gameSaveStates.length) + ? _gameSaveStates[nextIdx] + : null; + if (nextState == null) return; // save state evicted by maxUndo + nextState.load(_gameState); + nextState.saveToDisk(_gameState); + //also run generic update ui function + updateAllUI(); + } + _sendState('redo'); + } + + /// Broadcasts the current command index + description after an undo/redo, + /// mirroring the reference app's server-side `StateEnvelope` send. + void _sendState(String action) { + final idx = commandIndex; + if (idx >= 0 && idx < _commandDescriptions.length) { + _log.info( + 'server sends, $action index: $idx, description:${_commandDescriptions[idx]}', + ); + onAction?.call( + idx, + _commandDescriptions[idx], + const NoEvent().toJsonString(), + ); + } + } + + void action(Command command) { + command.execute(); + if (_commands.length > commandIndex) { + _commands.insert(commandIndex + 1, command); + _commandDescriptions.insert(commandIndex + 1, command.describe()); + } else { + _commands.add(command); + _commandDescriptions.add(command.describe()); + } + + // Set event before commandIndex changes so listener callbacks see the + // correct value. + lastEvent = command.event; + commandIndex++; + + //remove possible redo list + if (_commands.length - 1 > commandIndex) { + _commands.removeRange(commandIndex + 1, _commands.length); + _commandDescriptions.removeRange( + commandIndex + 1, + _commandDescriptions.length, + ); + } + if (_gameSaveStates.length > commandIndex + 1) { + //remove future game states + _gameSaveStates.removeRange(commandIndex + 1, _gameSaveStates.length); + } + + _gameState.save(); //save after each action + + //send last game state if connected + String description = command.describe(); + String eventJson = command.event.toJsonString(); + _log.info('server sends, index: $commandIndex, description:$description'); + onAction?.call(commandIndex, description, eventJson); + + //TODO: this is breaking if command index is not in sync with commands. and in connected state. + //really need to go over this again: do we really need to save commands at all, or are save states + descriptions enough also for offline? + if (commandIndex >= maxUndo) { + if (_commands.length > commandIndex) { + _commands[commandIndex - maxUndo] = null; + } + if (_gameSaveStates.length > commandIndex - maxUndo) { + _gameSaveStates[commandIndex - maxUndo] = null; + } + } + } +} diff --git a/server/lib/core/card_stack.dart b/server/lib/core/card_stack.dart new file mode 100644 index 0000000..599c6b3 --- /dev/null +++ b/server/lib/core/card_stack.dart @@ -0,0 +1,92 @@ +import 'dart:math'; + +import 'package:collection/collection.dart'; + +//todo: make whole thing safe (only expose immutable values) + +/// A mutable ordered pile of cards. +/// +/// Plain class in the server port — the reference app's `ChangeNotifier` +/// notifications were UI-only and are dropped (state is pushed to clients +/// wholesale instead). +class CardStack<E> { + final _list = <E>[]; + + E get peek => _list.last; + + bool get isEmpty => _list.isEmpty; + bool get isNotEmpty => _list.isNotEmpty; + + void push(E value) { + _list.add(value); + } + + E pop() { + return _list.removeLast(); + } + + @override + String toString() { + String retVal = "["; + for (final item in _list) { + retVal += "${item.toString()},"; + } + if (_list.isNotEmpty) { + retVal = retVal.substring(0, retVal.length - 1); + } + retVal += "]"; + return retVal; + } + + void init(List<E> list) { + _list.addAll(list); + } + + void shuffle() { + _list.shuffle(Random()); + } + + int size() { + return _list.length; + } + + List<E> getList() { + return _list.toList(); + } + + void remove(E card) { + _list.remove(card); + } + + E removeAt(int index) { + return _list.removeAt(index); + } + + void clear() { + _list.clear(); + } + + void removeWhere(bool Function(E) test) { + _list.removeWhere(test); + } + + void removeFirstWhere(bool Function(E) test) { + final object = _list.firstWhereOrNull(test); + if (object != null) { + _list.remove(object); + } + } + + void add(E card) { + _list.add(card); + } + + void insert(int index, E card) { + _list.insert(index, card); + } + + void setList(List<E> list) { + _list.clear(); + _list.addAll(list); + } +} diff --git a/server/lib/core/commands/activate_monster_type_command.dart b/server/lib/core/commands/activate_monster_type_command.dart new file mode 100644 index 0000000..cc967ec --- /dev/null +++ b/server/lib/core/commands/activate_monster_type_command.dart @@ -0,0 +1,53 @@ +import '../enums.dart'; +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class ActivateMonsterTypeCommand extends Command { + final String name; + final bool activate; + final GameState _gameState; + + ActivateMonsterTypeCommand( + this.name, + this.activate, { + required GameState gameState, + }) : _gameState = gameState; + + @override + void execute() { + Monster? monster; + for (final item in _gameState.currentList) { + if (item.id == name) { + if (item is Monster) { + item.setActive(stateAccess, activate); + monster = item; + } + } + } + if (activate) { + final roundState = _gameState.roundState; + if (roundState == RoundState.chooseInitiative) { + RoundMethods.sortCharactersFirst(stateAccess); + } else if (roundState == RoundState.playTurns) { + DeckMethods.drawAbilityCardFromInactiveDeck(stateAccess); + if (monster != null) { + RoundMethods.sortItemToPlace( + stateAccess, + name, + GameMethods.getInitiative(monster), + ); + } + } + } + _gameState.notifyListeners(); + } + + @override + String describe() { + if (activate) { + return commandL10n.cmdActivateMonster(name); + } + return commandL10n.cmdDeactivateMonster(name); + } +} diff --git a/server/lib/core/commands/add_character_command.dart b/server/lib/core/commands/add_character_command.dart new file mode 100644 index 0000000..8510927 --- /dev/null +++ b/server/lib/core/commands/add_character_command.dart @@ -0,0 +1,47 @@ +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class AddCharacterCommand extends Command { + final String _id; + final String _edition; + final int _level; + final String? _display; + Character? character; + + AddCharacterCommand(this._id, this._edition, this._display, this._level) { + final created = CharacterMethods.createCharacter( + stateAccess, + _id, + _edition, + _display, + _level, + ); + if (created == null) { + throw StateError( + 'AddCharacterCommand: character class not found: $_id (edition: $_edition)', + ); + } + character = created; + } + + @override + void execute() { + final char = character; + if (char == null) return; + //add new character on top of list + RoundMethods.addToMainList(stateAccess, 0, char); + + if (!GameMethods.isObjectiveOrEscort(char.characterClass)) { + ScenarioMethods.applyDifficulty(stateAccess); + } + + RoundMethods.updateForSpecialRules(stateAccess); + ScenarioMethods.unlockClass(stateAccess, char.characterClass.id); + } + + @override + String describe() { + return commandL10n.cmdAddCharacter(_id); + } +} diff --git a/server/lib/core/commands/add_condition_command.dart b/server/lib/core/commands/add_condition_command.dart new file mode 100644 index 0000000..663d6b0 --- /dev/null +++ b/server/lib/core/commands/add_condition_command.dart @@ -0,0 +1,56 @@ +import '../enums.dart'; +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class AddConditionCommand extends Command { + final Condition condition; + final String? ownerId; + final String figureId; + final GameState _gameState; + + AddConditionCommand( + this.condition, + this.figureId, + this.ownerId, { + required GameState gameState, + }) : _gameState = gameState; + + @override + void execute() { + FigureState? figure = GameMethods.getFigure(ownerId, figureId); + if (figure != null) { + List<Condition> newList = []; + newList.addAll(figure.conditions); + if (!newList.contains(condition) || //block from adding same condition + condition == Condition.chill || + condition == Condition.plague) { + newList.add(condition); + } + figure.setConditions(stateAccess, newList); + + if (condition == Condition.chill) { + figure.setChill(stateAccess, figure.chill + 1); + } + if (condition == Condition.plague) { + figure.setPlague(stateAccess, figure.plague + 1); + } + + //only added this turn if is current or done + for (final item in _gameState.currentList) { + if (item.id == ownerId) { + if (item.turnState != TurnsState.notDone && + _gameState.roundState == RoundState.playTurns) { + figure.addToConditionsThisTurn(stateAccess, condition); + } + } + } + _gameState.notifyListeners(); + } + } + + @override + String describe() { + return commandL10n.cmdAddCondition(condition.getName()); + } +} diff --git a/server/lib/core/commands/add_cs_party_card_command.dart b/server/lib/core/commands/add_cs_party_card_command.dart new file mode 100644 index 0000000..4f59e4b --- /dev/null +++ b/server/lib/core/commands/add_cs_party_card_command.dart @@ -0,0 +1,26 @@ +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class AddCSPartyCardCommand extends Command { + final String characterId; + final int type; + final GameState _gameState; + + AddCSPartyCardCommand( + this.characterId, + this.type, { + required GameState gameState, + }) : _gameState = gameState; + + @override + void execute() { + ModifierDeck? deck = GameMethods.getModifierDeck(characterId, _gameState); + deck.addCSPartyCard(stateAccess, type); + } + + @override + String describe() { + return commandL10n.cmdAddPartyCard(characterId, type.toString()); + } +} diff --git a/server/lib/core/commands/add_faction_card_command.dart b/server/lib/core/commands/add_faction_card_command.dart new file mode 100644 index 0000000..00bbf0d --- /dev/null +++ b/server/lib/core/commands/add_faction_card_command.dart @@ -0,0 +1,34 @@ +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class AddFactionCardCommand extends Command { + final String characterId; + final String cardId; + final bool add; + final GameState _gameState; + + AddFactionCardCommand( + this.characterId, + this.cardId, + this.add, { + required GameState gameState, + }) : _gameState = gameState; + + @override + void execute() { + ModifierDeck? deck = GameMethods.getModifierDeck(characterId, _gameState); + if (add) { + deck.addCard(stateAccess, cardId, CardType.add); + } else { + deck.removeCard(stateAccess, cardId); + } + } + + @override + String describe() { + return add + ? commandL10n.cmdAddFactionCard(characterId) + : commandL10n.cmdRemoveFactionCard(characterId); + } +} diff --git a/server/lib/core/commands/add_loot_card_command.dart b/server/lib/core/commands/add_loot_card_command.dart new file mode 100644 index 0000000..9e446c5 --- /dev/null +++ b/server/lib/core/commands/add_loot_card_command.dart @@ -0,0 +1,19 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class AddLootCardCommand extends Command { + AddLootCardCommand(this.resourceType, {required GameState gameState}) + : _gameState = gameState; + final String resourceType; + final GameState _gameState; + + @override + void execute() { + _gameState.lootDeck.addExtraCard(stateAccess, resourceType); + } + + @override + String describe() { + return commandL10n.cmdAddLootCard(resourceType); + } +} diff --git a/server/lib/core/commands/add_monster_command.dart b/server/lib/core/commands/add_monster_command.dart new file mode 100644 index 0000000..0aeba27 --- /dev/null +++ b/server/lib/core/commands/add_monster_command.dart @@ -0,0 +1,30 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class AddMonsterCommand extends Command { + final String _name; + final int? _level; + final bool _isAlly; + Monster? monster; + + AddMonsterCommand( + this._name, + this._level, + this._isAlly, { + required GameState gameState, + }) { + monster = MonsterMethods.createMonster(stateAccess, _name, _level, _isAlly); + } + + @override + void execute() { + final m = monster; + if (m == null) return; + RoundMethods.addToMainList(stateAccess, null, m); + } + + @override + String describe() { + return commandL10n.cmdAddMonster(monster?.type.display ?? ''); + } +} diff --git a/server/lib/core/commands/add_note_row_command.dart b/server/lib/core/commands/add_note_row_command.dart new file mode 100644 index 0000000..ff4d32f --- /dev/null +++ b/server/lib/core/commands/add_note_row_command.dart @@ -0,0 +1,26 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +/// Adds a [NoteRow] to the main list. If the note is linked, the list's reflow +/// step positions it directly beneath its target; otherwise it is appended. +class AddNoteRowCommand extends Command { + AddNoteRowCommand(this.noteRow, {required GameState gameState}) + : _gameState = gameState; + final NoteRow noteRow; + final GameState _gameState; + + @override + void execute() { + RoundMethods.addToMainList( + stateAccess, + null, + noteRow, + gameState: _gameState, + ); + } + + @override + String describe() { + return commandL10n.cmdAddNoteRow; + } +} diff --git a/server/lib/core/commands/add_perk_command.dart b/server/lib/core/commands/add_perk_command.dart new file mode 100644 index 0000000..c961e05 --- /dev/null +++ b/server/lib/core/commands/add_perk_command.dart @@ -0,0 +1,28 @@ +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class AddPerkCommand extends Command { + final String characterId; + final int index; + + AddPerkCommand(this.characterId, this.index); + + @override + void execute() { + Character? character = GameMethods.getCharacterByName(characterId); + if (character != null) { + character.flipPerk(stateAccess, index); + } + } + + @override + String describe() { + Character? character = GameMethods.getCharacterByName(characterId); + final charId = character?.id ?? characterId; + if (character != null && !character.characterState.perkList[index]) { + return commandL10n.cmdRemovePerk(charId, index); + } + return commandL10n.cmdAddPerk(charId, index); + } +} diff --git a/server/lib/core/commands/add_special_loot_card_command.dart b/server/lib/core/commands/add_special_loot_card_command.dart new file mode 100644 index 0000000..3f34aed --- /dev/null +++ b/server/lib/core/commands/add_special_loot_card_command.dart @@ -0,0 +1,28 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class AddSpecialLootCardCommand extends Command { + static const int _kCard1418 = 1418; + static const int _kCard1419 = 1419; + + int nr; + final GameState _gameState; + + AddSpecialLootCardCommand(this.nr, {required GameState gameState}) + : _gameState = gameState; + + @override + void execute() { + if (nr == _kCard1418) { + _gameState.lootDeck.addSpecial1418(stateAccess); + } + if (nr == _kCard1419) { + _gameState.lootDeck.addSpecial1419(stateAccess); + } + } + + @override + String describe() { + return commandL10n.cmdAddSpecialLootCard(nr); + } +} diff --git a/server/lib/core/commands/add_standee_command.dart b/server/lib/core/commands/add_standee_command.dart new file mode 100644 index 0000000..ec10701 --- /dev/null +++ b/server/lib/core/commands/add_standee_command.dart @@ -0,0 +1,64 @@ +import 'package:x_haven_server/core/state/game_state.dart'; + +import '../enums.dart'; +import 'command_l10n.dart'; + +class AddStandeeCommand extends Command { + final int nr; + final SummonData? summon; + final MonsterType type; + final String ownerId; + final bool addAsSummon; + final GameState _gameState; + + AddStandeeCommand( + this.nr, + this.summon, + this.ownerId, + this.type, + this.addAsSummon, { + required GameState gameState, + }) : _gameState = gameState; + + @override + void execute() { + MonsterMethods.executeAddStandee( + stateAccess, + nr, + summon, + type, + ownerId, + addAsSummon, + ); + + _gameState.notifyListeners(); + } + + @override + String describe() { + final sum = summon; + String name = sum == null ? ownerId : sum.name; + + return commandL10n.cmdAddStandee(name, nr); + } +} + +class SummonData { + int standeeNr; + String name; + int health; + int move; + int attack; + int range; + String gfx; + + SummonData( + this.standeeNr, + this.name, + this.health, + this.move, + this.attack, + this.range, + this.gfx, + ); +} diff --git a/server/lib/core/commands/amd_add_minus_one_command.dart b/server/lib/core/commands/amd_add_minus_one_command.dart new file mode 100644 index 0000000..8958dba --- /dev/null +++ b/server/lib/core/commands/amd_add_minus_one_command.dart @@ -0,0 +1,22 @@ +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class AmdAddMinusOneCommand extends Command { + String name; + final GameState _gameState; + + AmdAddMinusOneCommand(this.name, {required GameState gameState}) + : _gameState = gameState; + + @override + void execute() { + final deck = GameMethods.getModifierDeck(name, _gameState); + deck.addMinusOne(stateAccess); + } + + @override + String describe() { + return commandL10n.cmdAddMinusOne; + } +} diff --git a/server/lib/core/commands/amd_cassandra_special_command.dart b/server/lib/core/commands/amd_cassandra_special_command.dart new file mode 100644 index 0000000..b1d1d5f --- /dev/null +++ b/server/lib/core/commands/amd_cassandra_special_command.dart @@ -0,0 +1,30 @@ +import 'package:x_haven_server/core/game_methods.dart'; + +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class AMDCassandraSpecialCommand extends Command { + String deckId; + bool on; + final GameState _gameState; + + AMDCassandraSpecialCommand( + this.deckId, + this.on, { + required GameState gameState, + }) : _gameState = gameState; + + @override + void execute() { + ModifierDeck deck = GameMethods.getModifierDeck(deckId, _gameState); + deck.setCassandraSpecial(stateAccess, on); + } + + @override + String describe() { + if (on) { + return commandL10n.cmdCassandraLeaveRevealed(deckId); + } + return commandL10n.cmdCassandraSpecialOff(deckId); + } +} diff --git a/server/lib/core/commands/amd_imbue1_command.dart b/server/lib/core/commands/amd_imbue1_command.dart new file mode 100644 index 0000000..3cf52bc --- /dev/null +++ b/server/lib/core/commands/amd_imbue1_command.dart @@ -0,0 +1,19 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class AMDImbue1Command extends Command { + final GameState _gameState; + + AMDImbue1Command({required GameState gameState}) : _gameState = gameState; + + @override + void execute() { + ModifierDeck deck = _gameState.modifierDeck; + deck.setImbue1(stateAccess); + } + + @override + String describe() { + return commandL10n.cmdImbueMonsterDeck; + } +} diff --git a/server/lib/core/commands/amd_imbue2_command.dart b/server/lib/core/commands/amd_imbue2_command.dart new file mode 100644 index 0000000..891d1f0 --- /dev/null +++ b/server/lib/core/commands/amd_imbue2_command.dart @@ -0,0 +1,19 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class AMDImbue2Command extends Command { + final GameState _gameState; + + AMDImbue2Command({required GameState gameState}) : _gameState = gameState; + + @override + void execute() { + ModifierDeck deck = _gameState.modifierDeck; + deck.setImbue2(stateAccess); + } + + @override + String describe() { + return commandL10n.cmdAdvancedImbueMonsterDeck; + } +} diff --git a/server/lib/core/commands/amd_remove_imbue_command.dart b/server/lib/core/commands/amd_remove_imbue_command.dart new file mode 100644 index 0000000..0b37b5b --- /dev/null +++ b/server/lib/core/commands/amd_remove_imbue_command.dart @@ -0,0 +1,20 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class AMDRemoveImbueCommand extends Command { + final GameState _gameState; + + AMDRemoveImbueCommand({required GameState gameState}) + : _gameState = gameState; + + @override + void execute() { + ModifierDeck deck = _gameState.modifierDeck; + deck.resetImbue(stateAccess); + } + + @override + String describe() { + return commandL10n.cmdRemoveImbueMonsterDeck; + } +} diff --git a/server/lib/core/commands/amd_remove_minus_1_command.dart b/server/lib/core/commands/amd_remove_minus_1_command.dart new file mode 100644 index 0000000..506c6fd --- /dev/null +++ b/server/lib/core/commands/amd_remove_minus_1_command.dart @@ -0,0 +1,22 @@ +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class AMDRemoveMinus1Command extends Command { + String name; + final GameState _gameState; + + AMDRemoveMinus1Command(this.name, {required GameState gameState}) + : _gameState = gameState; + + @override + void execute() { + final deck = GameMethods.getModifierDeck(name, _gameState); + deck.removeMinusOne(stateAccess); + } + + @override + String describe() { + return commandL10n.cmdRemoveMinusOne; + } +} diff --git a/server/lib/core/commands/amd_remove_minus_2_command.dart b/server/lib/core/commands/amd_remove_minus_2_command.dart new file mode 100644 index 0000000..401cc8c --- /dev/null +++ b/server/lib/core/commands/amd_remove_minus_2_command.dart @@ -0,0 +1,32 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class AMDRemoveMinus2Command extends Command { + bool allies; + bool remove = false; + final GameState _gameState; + + AMDRemoveMinus2Command(this.allies, {required GameState gameState}) + : _gameState = gameState; + + @override + void execute() { + ModifierDeck deck = _gameState.modifierDeck; + if (allies) { + deck = _gameState.modifierDeckAllies; + } + remove = deck.hasMinus2(); + if (remove) { + deck.removeMinusTwo(stateAccess); + } else { + deck.addMinusTwo(stateAccess); + } + } + + @override + String describe() { + return remove + ? commandL10n.cmdRemoveMinusTwo + : commandL10n.cmdAddBackMinusTwo; + } +} diff --git a/server/lib/core/commands/amd_remove_plus_0_command.dart b/server/lib/core/commands/amd_remove_plus_0_command.dart new file mode 100644 index 0000000..c6878e0 --- /dev/null +++ b/server/lib/core/commands/amd_remove_plus_0_command.dart @@ -0,0 +1,29 @@ +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class AmdRemovePlus0Command extends Command { + final String name; + final bool remove; + final GameState _gameState; + + AmdRemovePlus0Command(this.name, this.remove, {required GameState gameState}) + : _gameState = gameState; + + @override + void execute() { + final deck = GameMethods.getModifierDeck(name, _gameState); + if (remove) { + deck.moveCardToRemovedPile(stateAccess, "plus0"); + } else { + deck.restoreCardFromRemovedPile(stateAccess, "plus0", CardType.add); + } + } + + @override + String describe() { + return remove + ? commandL10n.cmdRemovePlusZero + : commandL10n.cmdAddBackPlusZero; + } +} diff --git a/server/lib/core/commands/amd_reveal_command.dart b/server/lib/core/commands/amd_reveal_command.dart new file mode 100644 index 0000000..1a0a1a3 --- /dev/null +++ b/server/lib/core/commands/amd_reveal_command.dart @@ -0,0 +1,27 @@ +import 'package:x_haven_server/core/game_methods.dart'; + +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class AMDRevealCommand extends Command { + final int amount; + final String name; + final GameState _gameState; + + AMDRevealCommand({ + required this.amount, + required this.name, + required GameState gameState, + }) : _gameState = gameState; + + @override + void execute() { + ModifierDeck deck = GameMethods.getModifierDeck(name, _gameState); + deck.revealCards(stateAccess, amount); + } + + @override + String describe() { + return commandL10n.cmdRevealModifierCards(amount); + } +} diff --git a/server/lib/core/commands/bad_omen_command.dart b/server/lib/core/commands/bad_omen_command.dart new file mode 100644 index 0000000..71fd85b --- /dev/null +++ b/server/lib/core/commands/bad_omen_command.dart @@ -0,0 +1,32 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class BadOmenCommand extends Command { + static const int _kBadOmenIncrement = 6; + + final bool allies; + final GameState _gameState; + + BadOmenCommand(this.allies, {required GameState gameState}) + : _gameState = gameState; + + @override + void execute() { + if (allies) { + _gameState.modifierDeckAllies.setBadOmen( + stateAccess, + _gameState.modifierDeckAllies.badOmen + _kBadOmenIncrement, + ); + } else { + _gameState.modifierDeck.setBadOmen( + stateAccess, + _gameState.modifierDeck.badOmen + _kBadOmenIncrement, + ); + } + } + + @override + String describe() { + return commandL10n.badOmen; + } +} diff --git a/server/lib/core/commands/change_name_command.dart b/server/lib/core/commands/change_name_command.dart new file mode 100644 index 0000000..9a99da2 --- /dev/null +++ b/server/lib/core/commands/change_name_command.dart @@ -0,0 +1,28 @@ +import 'package:collection/collection.dart'; + +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class ChangeNameCommand extends Command { + ChangeNameCommand(this.name, this.characterId, {required GameState gameState}) + : _gameState = gameState; + final String name; + final String characterId; + final GameState _gameState; + + @override + void execute() { + final match = _gameState.currentList.firstWhereOrNull( + (element) => element.id == characterId, + ); + final Character? character = match is Character ? match : null; + if (character != null) { + character.characterState.setDisplay(stateAccess, name); + } + } + + @override + String describe() { + return commandL10n.cmdChangeName; + } +} diff --git a/server/lib/core/commands/change_stat_commands/change_bless_command.dart b/server/lib/core/commands/change_stat_commands/change_bless_command.dart new file mode 100644 index 0000000..94f83ae --- /dev/null +++ b/server/lib/core/commands/change_stat_commands/change_bless_command.dart @@ -0,0 +1,46 @@ +import '../../game_methods.dart'; +import '../../state/game_state.dart'; +import 'change_stat_command.dart'; +import '../command_l10n.dart'; + +class ChangeBlessCommand extends ChangeStatCommand { + ModifierDeck? deck; + ChangeBlessCommand( + super.change, + super.figureId, + super.ownerId, { + required super.gameState, + }); + ChangeBlessCommand.deck(this.deck, {required GameState gameState}) + : super(0, '', '', gameState: gameState); + + @override + void execute() { + if (deck == null) { + deck = gameState.modifierDeck; + for (final item in gameState.currentList) { + if (item.id == ownerId) { + if (item is Monster && + item.isAlly && + (gameState.allyDeckInOGGloom || + !GameMethods.isOgGloomEdition())) { + deck = gameState.modifierDeckAllies; + } + if (item is Character) { + deck = item.characterState.modifierDeck; + } + } + } + } + + deck?.addRemovableValue(stateAccess, "bless", change); + } + + @override + String describe() { + if (change > 0) { + return commandL10n.cmdAddBless; + } + return commandL10n.cmdRemoveBless; + } +} diff --git a/server/lib/core/commands/change_stat_commands/change_curse_command.dart b/server/lib/core/commands/change_stat_commands/change_curse_command.dart new file mode 100644 index 0000000..4505711 --- /dev/null +++ b/server/lib/core/commands/change_stat_commands/change_curse_command.dart @@ -0,0 +1,46 @@ +import '../../game_methods.dart'; +import '../../state/game_state.dart'; +import 'change_stat_command.dart'; +import '../command_l10n.dart'; + +class ChangeCurseCommand extends ChangeStatCommand { + ChangeCurseCommand( + super.change, + super.figureId, + super.ownerId, { + required super.gameState, + }); + ChangeCurseCommand.deck(this.deck, {required GameState gameState}) + : super(0, '', '', gameState: gameState); + + ModifierDeck? deck; + + @override + void execute() { + if (deck == null) { + deck = gameState.modifierDeck; + for (final item in gameState.currentList) { + if (item.id == ownerId) { + if (item is Monster && + item.isAlly && + (gameState.allyDeckInOGGloom || + !GameMethods.isOgGloomEdition())) { + deck = gameState.modifierDeckAllies; + } + if (item is Character) { + deck = item.characterState.modifierDeck; + } + } + } + } + deck?.addRemovableValue(stateAccess, "curse", change); + } + + @override + String describe() { + if (change > 0) { + return commandL10n.cmdAddCurse; + } + return commandL10n.cmdRemoveCurse; + } +} diff --git a/server/lib/core/commands/change_stat_commands/change_empower_command.dart b/server/lib/core/commands/change_stat_commands/change_empower_command.dart new file mode 100644 index 0000000..e4a8a52 --- /dev/null +++ b/server/lib/core/commands/change_stat_commands/change_empower_command.dart @@ -0,0 +1,47 @@ +import '../../game_methods.dart'; +import '../../state/game_state.dart'; +import 'change_stat_command.dart'; +import '../command_l10n.dart'; + +class ChangeEmpowerCommand extends ChangeStatCommand { + final String gfx; + ModifierDeck? deck; + ChangeEmpowerCommand( + super.change, + this.gfx, + super.figureId, + super.ownerId, { + required super.gameState, + }); + ChangeEmpowerCommand.deck(this.deck, this.gfx, {required GameState gameState}) + : super(0, '', '', gameState: gameState); + + @override + void execute() { + if (deck == null) { + deck = gameState.modifierDeck; + for (final item in gameState.currentList) { + if (item.id == ownerId) { + if (item is Monster && + item.isAlly && + (gameState.allyDeckInOGGloom || + !GameMethods.isOgGloomEdition())) { + deck = gameState.modifierDeckAllies; + } + if (item is Character) { + deck = item.characterState.modifierDeck; + } + } + } + } + deck?.addRemovableValue(stateAccess, gfx, change); + } + + @override + String describe() { + if (change > 0) { + return commandL10n.cmdAddEmpower; + } + return commandL10n.cmdRemoveEmpower; + } +} diff --git a/server/lib/core/commands/change_stat_commands/change_enfeeble_command.dart b/server/lib/core/commands/change_stat_commands/change_enfeeble_command.dart new file mode 100644 index 0000000..ecb9f64 --- /dev/null +++ b/server/lib/core/commands/change_stat_commands/change_enfeeble_command.dart @@ -0,0 +1,50 @@ +import '../../game_methods.dart'; +import '../../state/game_state.dart'; +import 'change_stat_command.dart'; +import '../command_l10n.dart'; + +class ChangeEnfeebleCommand extends ChangeStatCommand { + ModifierDeck? deck; + final String gfx; + ChangeEnfeebleCommand( + super.change, + this.gfx, + super.figureId, + super.ownerId, { + required super.gameState, + }); + ChangeEnfeebleCommand.deck( + this.deck, + this.gfx, { + required GameState gameState, + }) : super(0, '', '', gameState: gameState); + + @override + void execute() { + if (deck == null) { + deck = gameState.modifierDeck; + for (final item in gameState.currentList) { + if (item.id == ownerId) { + if (item is Monster && + item.isAlly && + (gameState.allyDeckInOGGloom || + !GameMethods.isOgGloomEdition())) { + deck = gameState.modifierDeckAllies; + } + if (item is Character) { + deck = item.characterState.modifierDeck; + } + } + } + } + deck?.addRemovableValue(stateAccess, gfx, change); + } + + @override + String describe() { + if (change > 0) { + return commandL10n.cmdAddEnfeeble; + } + return commandL10n.cmdRemoveEnfeeble; + } +} diff --git a/server/lib/core/commands/change_stat_commands/change_health_command.dart b/server/lib/core/commands/change_stat_commands/change_health_command.dart new file mode 100644 index 0000000..8d6b6f4 --- /dev/null +++ b/server/lib/core/commands/change_stat_commands/change_health_command.dart @@ -0,0 +1,54 @@ +import '../../game_event.dart'; +import '../../game_methods.dart'; +import '../../state/game_state.dart'; +import 'change_stat_command.dart'; +import '../command_l10n.dart'; + +class ChangeHealthCommand extends ChangeStatCommand { + ChangeHealthCommand( + super.change, + super.figureId, + super.ownerId, { + required super.gameState, + }); + + @override + void execute() { + FigureState? figure = GameMethods.getFigure(ownerId, figureId); + if (figure != null) { + final previousValue = figure.health; + if (previousValue + change < 0) { + //no negative values + figure.setHealth(stateAccess, 0); + } else { + figure.setHealth(stateAccess, figure.health + change); + } + final newValue = figure.health; + if (previousValue <= 0 && newValue > 0) { + //un death + gameState.notifyListeners(); + } + + if (newValue <= 0) { + handleDeath(); + } + } + } + + @override + GameEvent get event => HealthChangedEvent(figureId, ownerId ?? '', change); + + @override + String describe() { + if (change > 0) { + //TODO: looks bad + return commandL10n.cmdIncreaseHealth(figureId, change); + } + FigureState? figure = GameMethods.getFigure(ownerId, figureId); + if (figure == null || figure.health <= 0) { + return commandL10n.cmdKill(ownerId ?? ''); + } + //TODO: incorrect for character summons + return commandL10n.cmdDecreaseHealth(ownerId ?? '', -change); + } +} diff --git a/server/lib/core/commands/change_stat_commands/change_max_health_command.dart b/server/lib/core/commands/change_stat_commands/change_max_health_command.dart new file mode 100644 index 0000000..70b26d9 --- /dev/null +++ b/server/lib/core/commands/change_stat_commands/change_max_health_command.dart @@ -0,0 +1,44 @@ +import '../../game_methods.dart'; +import '../../state/game_state.dart'; +import 'change_stat_command.dart'; +import '../command_l10n.dart'; + +class ChangeMaxHealthCommand extends ChangeStatCommand { + ChangeMaxHealthCommand( + super.change, + super.figureId, + super.ownerId, { + required super.gameState, + }); + + @override + void execute() { + final FigureState? figure = GameMethods.getFigure(ownerId, figureId); + if (figure == null) return; + + int newValue = figure.maxHealth + change; + if (newValue <= 0) { + //can't lower maxvalue less than 1 + return; + } + + figure.setMaxHealth(stateAccess, newValue); + + //lower health if max health lowers + if (figure.maxHealth < figure.health) { + figure.setHealth(stateAccess, figure.maxHealth); + } + //if health same as max health, then let health follow? + if (figure.maxHealth - change == figure.health) { + figure.setHealth(stateAccess, figure.maxHealth); + } + } + + @override + String describe() { + if (change > 0) { + return commandL10n.cmdIncreaseMaxHealth(ownerId ?? ''); + } + return commandL10n.cmdDecreaseMaxHealth(ownerId ?? ''); + } +} diff --git a/server/lib/core/commands/change_stat_commands/change_stat_command.dart b/server/lib/core/commands/change_stat_commands/change_stat_command.dart new file mode 100644 index 0000000..3f94375 --- /dev/null +++ b/server/lib/core/commands/change_stat_commands/change_stat_command.dart @@ -0,0 +1,92 @@ +import '../../enums.dart'; +import '../../game_methods.dart'; +import '../../state/game_state.dart'; +import '../command_l10n.dart'; + +abstract class ChangeStatCommand extends Command { + final String? ownerId; + int change; + final String figureId; + // Public so subclasses in other files can access it + final GameState gameState; + + ChangeStatCommand( + this.change, + this.figureId, + this.ownerId, { + required this.gameState, + }); + + void setChange(int change) { + this.change = change; + } + + void handleDeath() { + for (final item in gameState.currentList) { + if (item is Monster) { + _handleMonsterDeath(item); + } else if (item is Character) { + _handleCharacterDeath(item); + } + } + } + + void _handleMonsterDeath(Monster monster) { + final instances = monster.monsterInstances; + final deadIndex = instances.indexWhere((i) => i.health == 0); + if (deadIndex == -1) return; + + final int deadStandeeNr = instances[deadIndex].standeeNr; + final newList = List<MonsterInstance>.from(instances)..removeAt(deadIndex); + monster.setMonsterInstances(stateAccess, newList); + // A note tied to this specific defeated standee is deleted with it. + RoundMethods.removeNoteRowsForStandee( + stateAccess, + monster.id, + deadStandeeNr, + gameState: gameState, + ); + + if (monster.monsterInstances.isEmpty) { + monster.setActive(stateAccess, false); + if (gameState.roundState == RoundState.chooseInitiative) { + RoundMethods.sortCharactersFirst(stateAccess); + } + _notifyUpdateList(); + } + } + + void _handleCharacterDeath(Character character) { + if (character.characterState.health <= 0) { + gameState.notifyListeners(); + } + _handleSummonDeath(character); + } + + void _handleSummonDeath(Character character) { + for (final instance in character.characterState.summonList) { + if (instance.health == 0 && + !GameMethods.summonDoesNotDie(character.id, instance.name)) { + character.characterState.removeSummon(stateAccess, instance); + if (character.characterState.summonList.isEmpty) { + _notifyUpdateList(); + } else { + gameState.notifyListeners(); + } + break; + } + } + } + + /// The reference app delayed this list update by 600 ms while a turn was in + /// play so the removal animation could finish; server-side the update is + /// immediate. + void _notifyUpdateList() { + gameState.notifyListeners(); + } + + @override + String describe() { + return commandL10n.cmdChangeStat; + } +} diff --git a/server/lib/core/commands/change_stat_commands/change_xp_command.dart b/server/lib/core/commands/change_stat_commands/change_xp_command.dart new file mode 100644 index 0000000..423b16d --- /dev/null +++ b/server/lib/core/commands/change_stat_commands/change_xp_command.dart @@ -0,0 +1,28 @@ +import '../../game_methods.dart'; +import '../../state/game_state.dart'; +import 'change_stat_command.dart'; +import '../command_l10n.dart'; + +class ChangeXPCommand extends ChangeStatCommand { + ChangeXPCommand( + super.change, + super.figureId, + super.ownerId, { + required super.gameState, + }); + + @override + void execute() { + final figure = GameMethods.getFigure(ownerId, figureId); + if (figure is! CharacterState) return; + figure.setXp(stateAccess, figure.xp + change); + } + + @override + String describe() { + if (change > 0) { + return commandL10n.cmdIncreaseXp(figureId, change); + } + return commandL10n.cmdDecreaseXp(figureId, change.abs()); + } +} diff --git a/server/lib/core/commands/clear_unlocked_classes_command.dart b/server/lib/core/commands/clear_unlocked_classes_command.dart new file mode 100644 index 0000000..78b17c6 --- /dev/null +++ b/server/lib/core/commands/clear_unlocked_classes_command.dart @@ -0,0 +1,16 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class ClearUnlockedClassesCommand extends Command { + ClearUnlockedClassesCommand(); + + @override + void execute() { + ScenarioMethods.clearUnlockedClasses(stateAccess); + } + + @override + String describe() { + return commandL10n.cmdClearUnlockedClasses; + } +} diff --git a/server/lib/core/commands/command_l10n.dart b/server/lib/core/commands/command_l10n.dart new file mode 100644 index 0000000..ee11e78 --- /dev/null +++ b/server/lib/core/commands/command_l10n.dart @@ -0,0 +1,20 @@ +import 'package:x_haven_server/core/l10n/app_localizations.dart'; +import 'package:x_haven_server/core/service_locator.dart'; + +import '../settings.dart'; + +Locale _parseLocale(String code) { + final parts = code.split('_'); + return parts.length == 2 ? Locale(parts[0], parts[1]) : Locale(parts[0]); +} + +/// The localized command-description strings, selected by the server locale +/// setting. Falls back to English on any error (as in the reference app). +AppLocalizations get commandL10n { + try { + final code = getIt<Settings>().locale; + return lookupAppLocalizations(_parseLocale(code)); + } catch (_) { + return lookupAppLocalizations(const Locale('en')); + } +} diff --git a/server/lib/core/commands/command_registry.dart b/server/lib/core/commands/command_registry.dart new file mode 100644 index 0000000..9a05b97 --- /dev/null +++ b/server/lib/core/commands/command_registry.dart @@ -0,0 +1,1109 @@ +/// Command registry: wire name → command construction. +/// +/// The Phase 2 network layer receives `{name, args}` messages from clients +/// and calls [buildCommand] to turn them into a [Command] for the +/// `ActionHandler`. [commandName] is the reverse lookup (runtime type → +/// wire name), used by describe/tests. +/// +/// Conventions (PORTING.md §9): +/// +/// * Wire names are the class name minus the `Command` suffix in +/// lower-camel case (acronym runs lower-cased in full): `DrawCommand` → +/// `draw`, `AddMonsterCommand` → `addMonster`, `ChangeHealthCommand` → +/// `changeHealth`, `AMDCassandraSpecialCommand` → `amdCassandraSpecial`. +/// The wire name comes from the class name, never the file name (the file +/// `remove__special_loot_card_command.dart` holds `RemoveSpecialLootCardCommand` +/// → `removeSpecialLootCard`). +/// * Args are a JSON `Map<String, dynamic>`. The wire keys are the +/// constructor parameter names — positional parameters in positional +/// order, leading underscores stripped — e.g. `AddPerkCommand(characterId, +/// index)` takes `{'characterId': ..., 'index': ...}`. +/// * Optional parameters may be omitted or given as JSON `null`. +/// * `GameState`, `Settings` and `GameData` are never wire args — they are +/// injected from the service locator (see [buildCommand]). +/// * Enums travel as name strings (`'chill'`, `'fire'`, `'elite'`, ...). +/// Complex object args are resolved against the live game state (see the +/// per-entry doc comments in [_registry]). +/// +/// Any failure — unknown command, missing required arg, wrong JSON type, +/// unknown enum value, unresolvable object reference — is reported as +/// [CommandRegistryError] with a human-readable message naming the command +/// and the arg. Failures thrown by a command's own constructor (e.g. +/// `AddCharacterCommand` for an unknown character id) are wrapped the same +/// way so the network layer only ever sees [CommandRegistryError]. +library; + +import 'package:x_haven_server/core/commands/activate_monster_type_command.dart'; +import 'package:x_haven_server/core/commands/add_character_command.dart'; +import 'package:x_haven_server/core/commands/add_condition_command.dart'; +import 'package:x_haven_server/core/commands/add_cs_party_card_command.dart'; +import 'package:x_haven_server/core/commands/add_faction_card_command.dart'; +import 'package:x_haven_server/core/commands/add_loot_card_command.dart'; +import 'package:x_haven_server/core/commands/add_monster_command.dart'; +import 'package:x_haven_server/core/commands/add_note_row_command.dart'; +import 'package:x_haven_server/core/commands/add_perk_command.dart'; +import 'package:x_haven_server/core/commands/add_special_loot_card_command.dart'; +import 'package:x_haven_server/core/commands/add_standee_command.dart'; +import 'package:x_haven_server/core/commands/amd_add_minus_one_command.dart'; +import 'package:x_haven_server/core/commands/amd_cassandra_special_command.dart'; +import 'package:x_haven_server/core/commands/amd_imbue1_command.dart'; +import 'package:x_haven_server/core/commands/amd_imbue2_command.dart'; +import 'package:x_haven_server/core/commands/amd_remove_imbue_command.dart'; +import 'package:x_haven_server/core/commands/amd_remove_minus_1_command.dart'; +import 'package:x_haven_server/core/commands/amd_remove_minus_2_command.dart'; +import 'package:x_haven_server/core/commands/amd_remove_plus_0_command.dart'; +import 'package:x_haven_server/core/commands/amd_reveal_command.dart'; +import 'package:x_haven_server/core/commands/bad_omen_command.dart'; +import 'package:x_haven_server/core/commands/change_name_command.dart'; +import 'package:x_haven_server/core/commands/change_stat_commands/change_bless_command.dart'; +import 'package:x_haven_server/core/commands/change_stat_commands/change_curse_command.dart'; +import 'package:x_haven_server/core/commands/change_stat_commands/change_empower_command.dart'; +import 'package:x_haven_server/core/commands/change_stat_commands/change_enfeeble_command.dart'; +import 'package:x_haven_server/core/commands/change_stat_commands/change_health_command.dart'; +import 'package:x_haven_server/core/commands/change_stat_commands/change_max_health_command.dart'; +import 'package:x_haven_server/core/commands/change_stat_commands/change_xp_command.dart'; +import 'package:x_haven_server/core/commands/clear_unlocked_classes_command.dart'; +import 'package:x_haven_server/core/commands/corrosive_spew_command.dart'; +import 'package:x_haven_server/core/commands/donate_cs_sanctuary_command.dart'; +import 'package:x_haven_server/core/commands/draw_ability_card_command.dart'; +import 'package:x_haven_server/core/commands/draw_command.dart'; +import 'package:x_haven_server/core/commands/draw_loot_card_command.dart'; +import 'package:x_haven_server/core/commands/draw_modifier_card_command.dart'; +import 'package:x_haven_server/core/commands/enhance_loot_card_command.dart'; +import 'package:x_haven_server/core/commands/hide_ally_deck_command.dart'; +import 'package:x_haven_server/core/commands/ice_wraith_change_form_command.dart'; +import 'package:x_haven_server/core/commands/imbue_element_command.dart'; +import 'package:x_haven_server/core/commands/load_character_save_command.dart'; +import 'package:x_haven_server/core/commands/load_save_command.dart'; +import 'package:x_haven_server/core/commands/next_round_command.dart'; +import 'package:x_haven_server/core/commands/remove__special_loot_card_command.dart'; +import 'package:x_haven_server/core/commands/remove_amd_card_command.dart'; +import 'package:x_haven_server/core/commands/remove_card_command.dart'; +import 'package:x_haven_server/core/commands/remove_character_command.dart'; +import 'package:x_haven_server/core/commands/remove_condition_command.dart'; +import 'package:x_haven_server/core/commands/remove_cs_party_card_command.dart'; +import 'package:x_haven_server/core/commands/remove_cs_sanctuary_donation_command.dart'; +import 'package:x_haven_server/core/commands/remove_monster_command.dart'; +import 'package:x_haven_server/core/commands/remove_note_row_command.dart'; +import 'package:x_haven_server/core/commands/reorder_ability_list_command.dart'; +import 'package:x_haven_server/core/commands/reorder_list_command.dart'; +import 'package:x_haven_server/core/commands/reorder_modifier_list_command.dart'; +import 'package:x_haven_server/core/commands/return_loot_card_command.dart'; +import 'package:x_haven_server/core/commands/return_modifier_card_command.dart'; +import 'package:x_haven_server/core/commands/return_removed_amd_card_command.dart'; +import 'package:x_haven_server/core/commands/set_ally_deck_in_og_gloom_command.dart'; +import 'package:x_haven_server/core/commands/set_as_summon_command.dart'; +import 'package:x_haven_server/core/commands/set_auto_level_adjust_command.dart'; +import 'package:x_haven_server/core/commands/set_campaign_command.dart'; +import 'package:x_haven_server/core/commands/set_character_level_command.dart'; +import 'package:x_haven_server/core/commands/set_difficulty_command.dart'; +import 'package:x_haven_server/core/commands/set_figure_note_command.dart'; +import 'package:x_haven_server/core/commands/set_init_command.dart'; +import 'package:x_haven_server/core/commands/set_level_command.dart'; +import 'package:x_haven_server/core/commands/set_loot_owner_command.dart'; +import 'package:x_haven_server/core/commands/set_note_row_color_command.dart'; +import 'package:x_haven_server/core/commands/set_note_row_link_command.dart'; +import 'package:x_haven_server/core/commands/set_note_row_text_command.dart'; +import 'package:x_haven_server/core/commands/set_scenario_command.dart'; +import 'package:x_haven_server/core/commands/set_solo_command.dart'; +import 'package:x_haven_server/core/commands/show_ally_deck_command.dart'; +import 'package:x_haven_server/core/commands/shuffle_ability_card_command.dart'; +import 'package:x_haven_server/core/commands/shuffle_amd_card_command.dart'; +import 'package:x_haven_server/core/commands/shuffle_drawn_ability_card_command.dart'; +import 'package:x_haven_server/core/commands/track_standees_command.dart'; +import 'package:x_haven_server/core/commands/turn_done_command.dart'; +import 'package:x_haven_server/core/commands/unlock_special_command.dart'; +import 'package:x_haven_server/core/commands/use_element_command.dart'; +import 'package:x_haven_server/core/commands/use_fh_perks_command.dart'; +import 'package:x_haven_server/core/enums.dart'; +import 'package:x_haven_server/core/game_data.dart'; +import 'package:x_haven_server/core/models/monster_ability.dart'; +import 'package:x_haven_server/core/service_locator.dart'; +import 'package:x_haven_server/core/settings.dart'; +import 'package:x_haven_server/core/state/game_state.dart'; + +/// One entry: wire name, arg parsing/validation, and command construction. +class CommandDescriptor { + const CommandDescriptor(this.name, this.construct); + final String name; // e.g. 'draw', 'addMonster', 'changeHealth' + final Command Function(GameState gameState, Map<String, dynamic> args) + construct; +} + +/// Thrown for unknown command names or invalid/missing args. +class CommandRegistryError implements Exception { + CommandRegistryError(this.message); + final String message; + @override + String toString() => 'CommandRegistryError: $message'; +} + +/// Builds a [Command] from a wire name + JSON arg map. +/// +/// Throws [CommandRegistryError] with a human-readable message on unknown +/// names, invalid/missing args, or command-construction failure. +Command buildCommand( + String name, + Map<String, dynamic> args, + GameState gameState, +) { + final descriptor = _registry[name]; + if (descriptor == null) { + throw CommandRegistryError( + 'Unknown command "$name". ' + 'Known commands: ${_registry.keys.join(', ')}', + ); + } + try { + return descriptor.construct(gameState, args); + } on StateError catch (error, stackTrace) { + Error.throwWithStackTrace( + CommandRegistryError('Command "$name": ${error.message}'), + stackTrace, + ); + } on ArgumentError catch (error, stackTrace) { + Error.throwWithStackTrace( + CommandRegistryError( + 'Command "$name": ${error.message ?? 'invalid arguments'}', + ), + stackTrace, + ); + } +} + +/// Reverse lookup (for describe/tests): wire name of [command]'s runtime +/// type. +/// +/// Throws [CommandRegistryError] if [command]'s type is not registered. +String commandName(Command command) { + final name = _nameByType[command.runtimeType]; + if (name == null) { + throw CommandRegistryError( + 'No wire name registered for ${command.runtimeType}', + ); + } + return name; +} + +/// All registered commands, wire name → [CommandDescriptor]. +final Map<String, CommandDescriptor> _registry = { + 'activateMonsterType': CommandDescriptor( + 'activateMonsterType', + (gs, args) => ActivateMonsterTypeCommand( + _str('activateMonsterType', 'name', args), + _bool('activateMonsterType', 'activate', args), + gameState: gs, + ), + ), + 'addCharacter': CommandDescriptor( + 'addCharacter', + (gs, args) => AddCharacterCommand( + _str('addCharacter', 'id', args), + _str('addCharacter', 'edition', args), + _strOr('addCharacter', 'display', args), + _int('addCharacter', 'level', args), + ), + ), + 'addCondition': CommandDescriptor( + 'addCondition', + (gs, args) => AddConditionCommand( + _condition('addCondition', 'condition', args), + _str('addCondition', 'figureId', args), + _strOr('addCondition', 'ownerId', args), + gameState: gs, + ), + ), + 'addCSPartyCard': CommandDescriptor( + 'addCSPartyCard', + (gs, args) => AddCSPartyCardCommand( + _str('addCSPartyCard', 'characterId', args), + _int('addCSPartyCard', 'type', args), + gameState: gs, + ), + ), + 'addFactionCard': CommandDescriptor( + 'addFactionCard', + (gs, args) => AddFactionCardCommand( + _str('addFactionCard', 'characterId', args), + _str('addFactionCard', 'cardId', args), + _bool('addFactionCard', 'add', args), + gameState: gs, + ), + ), + 'addLootCard': CommandDescriptor( + 'addLootCard', + (gs, args) => AddLootCardCommand( + _str('addLootCard', 'resourceType', args), + gameState: gs, + ), + ), + 'addMonster': CommandDescriptor( + 'addMonster', + (gs, args) => AddMonsterCommand( + _str('addMonster', 'name', args), + _intOr('addMonster', 'level', args), + _bool('addMonster', 'isAlly', args), + gameState: gs, + ), + ), + // `noteRow` is a JSON object `{id, text, color, linkedId, standeeNr}`; + // `id` is a client-generated unique string. + 'addNoteRow': CommandDescriptor( + 'addNoteRow', + (gs, args) => + AddNoteRowCommand(_noteRow('addNoteRow', args), gameState: gs), + ), + 'addPerk': CommandDescriptor( + 'addPerk', + (gs, args) => AddPerkCommand( + _str('addPerk', 'characterId', args), + _int('addPerk', 'index', args), + ), + ), + 'addSpecialLootCard': CommandDescriptor( + 'addSpecialLootCard', + (gs, args) => AddSpecialLootCardCommand( + _int('addSpecialLootCard', 'nr', args), + gameState: gs, + ), + ), + // `summon` is an optional JSON object + // `{standeeNr, name, health, move, attack, range, gfx}`; absent/null → null. + 'addStandee': CommandDescriptor( + 'addStandee', + (gs, args) => AddStandeeCommand( + _int('addStandee', 'nr', args), + _summonData('addStandee', args), + _str('addStandee', 'ownerId', args), + _monsterType('addStandee', 'type', args), + _bool('addStandee', 'addAsSummon', args), + gameState: gs, + ), + ), + 'amdAddMinusOne': CommandDescriptor( + 'amdAddMinusOne', + (gs, args) => AmdAddMinusOneCommand( + _str('amdAddMinusOne', 'name', args), + gameState: gs, + ), + ), + 'amdCassandraSpecial': CommandDescriptor( + 'amdCassandraSpecial', + (gs, args) => AMDCassandraSpecialCommand( + _str('amdCassandraSpecial', 'deckId', args), + _bool('amdCassandraSpecial', 'on', args), + gameState: gs, + ), + ), + 'amdImbue1': CommandDescriptor( + 'amdImbue1', + (gs, args) => AMDImbue1Command(gameState: gs), + ), + 'amdImbue2': CommandDescriptor( + 'amdImbue2', + (gs, args) => AMDImbue2Command(gameState: gs), + ), + 'amdRemoveImbue': CommandDescriptor( + 'amdRemoveImbue', + (gs, args) => AMDRemoveImbueCommand(gameState: gs), + ), + 'amdRemoveMinus1': CommandDescriptor( + 'amdRemoveMinus1', + (gs, args) => AMDRemoveMinus1Command( + _str('amdRemoveMinus1', 'name', args), + gameState: gs, + ), + ), + 'amdRemoveMinus2': CommandDescriptor( + 'amdRemoveMinus2', + (gs, args) => AMDRemoveMinus2Command( + _bool('amdRemoveMinus2', 'allies', args), + gameState: gs, + ), + ), + 'amdRemovePlus0': CommandDescriptor( + 'amdRemovePlus0', + (gs, args) => AmdRemovePlus0Command( + _str('amdRemovePlus0', 'name', args), + _bool('amdRemovePlus0', 'remove', args), + gameState: gs, + ), + ), + 'amdReveal': CommandDescriptor( + 'amdReveal', + (gs, args) => AMDRevealCommand( + amount: _int('amdReveal', 'amount', args), + name: _str('amdReveal', 'name', args), + gameState: gs, + ), + ), + 'badOmen': CommandDescriptor( + 'badOmen', + (gs, args) => + BadOmenCommand(_bool('badOmen', 'allies', args), gameState: gs), + ), + 'changeBless': CommandDescriptor( + 'changeBless', + (gs, args) => ChangeBlessCommand( + _int('changeBless', 'change', args), + _str('changeBless', 'figureId', args), + _strOr('changeBless', 'ownerId', args), + gameState: gs, + ), + ), + 'changeCurse': CommandDescriptor( + 'changeCurse', + (gs, args) => ChangeCurseCommand( + _int('changeCurse', 'change', args), + _str('changeCurse', 'figureId', args), + _strOr('changeCurse', 'ownerId', args), + gameState: gs, + ), + ), + 'changeEmpower': CommandDescriptor( + 'changeEmpower', + (gs, args) => ChangeEmpowerCommand( + _int('changeEmpower', 'change', args), + _str('changeEmpower', 'gfx', args), + _str('changeEmpower', 'figureId', args), + _strOr('changeEmpower', 'ownerId', args), + gameState: gs, + ), + ), + 'changeEnfeeble': CommandDescriptor( + 'changeEnfeeble', + (gs, args) => ChangeEnfeebleCommand( + _int('changeEnfeeble', 'change', args), + _str('changeEnfeeble', 'gfx', args), + _str('changeEnfeeble', 'figureId', args), + _strOr('changeEnfeeble', 'ownerId', args), + gameState: gs, + ), + ), + 'changeHealth': CommandDescriptor( + 'changeHealth', + (gs, args) => ChangeHealthCommand( + _int('changeHealth', 'change', args), + _str('changeHealth', 'figureId', args), + _strOr('changeHealth', 'ownerId', args), + gameState: gs, + ), + ), + 'changeMaxHealth': CommandDescriptor( + 'changeMaxHealth', + (gs, args) => ChangeMaxHealthCommand( + _int('changeMaxHealth', 'change', args), + _str('changeMaxHealth', 'figureId', args), + _strOr('changeMaxHealth', 'ownerId', args), + gameState: gs, + ), + ), + 'changeName': CommandDescriptor( + 'changeName', + (gs, args) => ChangeNameCommand( + _str('changeName', 'name', args), + _str('changeName', 'characterId', args), + gameState: gs, + ), + ), + 'changeXP': CommandDescriptor( + 'changeXP', + (gs, args) => ChangeXPCommand( + _int('changeXP', 'change', args), + _str('changeXP', 'figureId', args), + _strOr('changeXP', 'ownerId', args), + gameState: gs, + ), + ), + 'clearUnlockedClasses': CommandDescriptor( + 'clearUnlockedClasses', + (gs, args) => ClearUnlockedClassesCommand(), + ), + 'corrosiveSpew': CommandDescriptor( + 'corrosiveSpew', + (gs, args) => CorrosiveSpewCommand(gameState: gs), + ), + 'donateCSSanctuary': CommandDescriptor( + 'donateCSSanctuary', + (gs, args) => DonateCSSanctuaryCommand( + _str('donateCSSanctuary', 'characterId', args), + gameState: gs, + ), + ), + 'draw': CommandDescriptor('draw', (gs, args) => DrawCommand(gameState: gs)), + 'drawAbilityCard': CommandDescriptor( + 'drawAbilityCard', + (gs, args) => + DrawAbilityCardCommand(_str('drawAbilityCard', 'ownerId', args)), + ), + 'drawLootCard': CommandDescriptor( + 'drawLootCard', + (gs, args) => DrawLootCardCommand(gameState: gs), + ), + 'drawModifierCard': CommandDescriptor( + 'drawModifierCard', + (gs, args) => DrawModifierCardCommand( + _str('drawModifierCard', 'name', args), + gameState: gs, + ), + ), + 'enhanceLootCard': CommandDescriptor( + 'enhanceLootCard', + (gs, args) => EnhanceLootCardCommand( + _int('enhanceLootCard', 'id', args), + _int('enhanceLootCard', 'value', args), + _str('enhanceLootCard', 'resourceType', args), + gameState: gs, + ), + ), + 'hideAllyDeck': CommandDescriptor( + 'hideAllyDeck', + (gs, args) => HideAllyDeckCommand(), + ), + 'iceWraithChangeForm': CommandDescriptor( + 'iceWraithChangeForm', + (gs, args) => IceWraithChangeFormCommand( + _bool('iceWraithChangeForm', 'isElite', args), + _strOr('iceWraithChangeForm', 'ownerId', args), + _str('iceWraithChangeForm', 'figureId', args), + gameState: gs, + ), + ), + 'imbueElement': CommandDescriptor( + 'imbueElement', + (gs, args) => ImbueElementCommand( + _elements('imbueElement', 'element', args), + _bool('imbueElement', 'half', args), + gameState: gs, + ), + ), + 'loadCharacterSave': CommandDescriptor( + 'loadCharacterSave', + (gs, args) => LoadCharacterSaveCommand( + _str('loadCharacterSave', 'saveName', args), + _str('loadCharacterSave', 'saveData', args), + gameState: gs, + ), + ), + 'loadSave': CommandDescriptor( + 'loadSave', + (gs, args) => LoadSaveCommand( + _str('loadSave', 'saveName', args), + _str('loadSave', 'saveData', args), + gameState: gs, + ), + ), + // GameData and Settings are injected, never wire args. + 'nextRound': CommandDescriptor( + 'nextRound', + (gs, args) => NextRoundCommand( + gameState: gs, + gameData: getIt<GameData>(), + settings: getIt<Settings>(), + ), + ), + 'removeAMDCard': CommandDescriptor( + 'removeAMDCard', + (gs, args) => RemoveAMDCardCommand( + index: _int('removeAMDCard', 'index', args), + name: _str('removeAMDCard', 'name', args), + fromDrawPile: _boolOr('removeAMDCard', 'fromDrawPile', args, false), + gameState: gs, + ), + ), + // `deck` + `nr` resolve the live card model from the current ability decks + // (draw pile, then discard pile), mirroring the command's own execute(). + 'removeCard': CommandDescriptor( + 'removeCard', + (gs, args) => RemoveCardCommand( + _abilityCard( + gs, + 'removeCard', + _str('removeCard', 'deck', args), + _int('removeCard', 'nr', args), + ), + gameState: gs, + ), + ), + // The reference constructor takes `List<Character> names`; the wire takes + // `ids` (List<String>) and resolves the live Character objects by id. An + // empty result is not an error (the reference tolerates no-ops). + 'removeCharacter': CommandDescriptor( + 'removeCharacter', + (gs, args) => RemoveCharacterCommand( + _characters(gs, _strList('removeCharacter', 'ids', args)), + gameState: gs, + ), + ), + 'removeCondition': CommandDescriptor( + 'removeCondition', + (gs, args) => RemoveConditionCommand( + _condition('removeCondition', 'condition', args), + _str('removeCondition', 'figureId', args), + _strOr('removeCondition', 'ownerId', args), + gameState: gs, + ), + ), + 'removeCSPartyCard': CommandDescriptor( + 'removeCSPartyCard', + (gs, args) => RemoveCSPartyCardCommand( + _str('removeCSPartyCard', 'characterId', args), + gameState: gs, + ), + ), + 'removeCSSanctuaryDonation': CommandDescriptor( + 'removeCSSanctuaryDonation', + (gs, args) => RemoveCSSanctuaryDonationCommand( + _str('removeCSSanctuaryDonation', 'characterId', args), + gameState: gs, + ), + ), + // The reference constructor takes `List<Monster> names`; the wire takes + // `ids` (List<String>) and resolves the live Monster objects by id. An + // empty result is not an error (the reference tolerates no-ops). + 'removeMonster': CommandDescriptor( + 'removeMonster', + (gs, args) => RemoveMonsterCommand( + _monsters(gs, _strList('removeMonster', 'ids', args)), + gameState: gs, + ), + ), + 'removeNoteRow': CommandDescriptor( + 'removeNoteRow', + (gs, args) => RemoveNoteRowCommand( + _str('removeNoteRow', 'noteId', args), + gameState: gs, + ), + ), + 'removeSpecialLootCard': CommandDescriptor( + 'removeSpecialLootCard', + (gs, args) => RemoveSpecialLootCardCommand( + _int('removeSpecialLootCard', 'nr', args), + gameState: gs, + ), + ), + 'reorderAbilityList': CommandDescriptor( + 'reorderAbilityList', + (gs, args) => ReorderAbilityListCommand( + _str('reorderAbilityList', 'deck', args), + _int('reorderAbilityList', 'newIndex', args), + _int('reorderAbilityList', 'oldIndex', args), + gameState: gs, + ), + ), + 'reorderList': CommandDescriptor( + 'reorderList', + (gs, args) => ReorderListCommand( + _int('reorderList', 'newIndex', args), + _int('reorderList', 'oldIndex', args), + gameState: gs, + ), + ), + 'reorderModifierList': CommandDescriptor( + 'reorderModifierList', + (gs, args) => ReorderModifierListCommand( + _int('reorderModifierList', 'newIndex', args), + _int('reorderModifierList', 'oldIndex', args), + _str('reorderModifierList', 'name', args), + gameState: gs, + ), + ), + 'returnLootCard': CommandDescriptor( + 'returnLootCard', + (gs, args) => ReturnLootCardCommand( + _bool('returnLootCard', 'top', args), + gameState: gs, + ), + ), + 'returnModifierCard': CommandDescriptor( + 'returnModifierCard', + (gs, args) => + ReturnModifierCardCommand(_str('returnModifierCard', 'name', args)), + ), + 'returnRemovedAMDCard': CommandDescriptor( + 'returnRemovedAMDCard', + (gs, args) => ReturnRemovedAMDCardCommand( + index: _int('returnRemovedAMDCard', 'index', args), + name: _str('returnRemovedAMDCard', 'name', args), + toDrawPile: _boolOr('returnRemovedAMDCard', 'toDrawPile', args, false), + gameState: gs, + ), + ), + 'setAllyDeckInOgGloom': CommandDescriptor( + 'setAllyDeckInOgGloom', + (gs, args) => SetAllyDeckInOgGloomCommand( + _bool('setAllyDeckInOgGloom', 'set', args), + gameState: gs, + ), + ), + 'setAsSummon': CommandDescriptor( + 'setAsSummon', + (gs, args) => SetAsSummonCommand( + _bool('setAsSummon', 'summoned', args), + _str('setAsSummon', 'figureId', args), + _strOr('setAsSummon', 'ownerId', args), + gameState: gs, + ), + ), + 'setAutoLevelAdjust': CommandDescriptor( + 'setAutoLevelAdjust', + (gs, args) => SetAutoLevelAdjustCommand( + _bool('setAutoLevelAdjust', 'on', args), + gameState: gs, + ), + ), + 'setCampaign': CommandDescriptor( + 'setCampaign', + (gs, args) => SetCampaignCommand(_str('setCampaign', 'campaign', args)), + ), + 'setCharacterLevel': CommandDescriptor( + 'setCharacterLevel', + (gs, args) => SetCharacterLevelCommand( + _int('setCharacterLevel', 'level', args), + _str('setCharacterLevel', 'characterId', args), + ), + ), + 'setDifficulty': CommandDescriptor( + 'setDifficulty', + (gs, args) => SetDifficultyCommand( + _int('setDifficulty', 'difficulty', args), + gameState: gs, + ), + ), + 'setFigureNote': CommandDescriptor( + 'setFigureNote', + (gs, args) => SetFigureNoteCommand( + _str('setFigureNote', 'note', args), + _str('setFigureNote', 'figureId', args), + gameState: gs, + ), + ), + 'setInit': CommandDescriptor( + 'setInit', + (gs, args) => SetInitCommand( + _str('setInit', 'characterId', args), + _int('setInit', 'init', args), + gameState: gs, + ), + ), + 'setLevel': CommandDescriptor( + 'setLevel', + (gs, args) => SetLevelCommand( + _int('setLevel', 'level', args), + _strOr('setLevel', 'monsterId', args), + ), + ), + // `cardId` resolves the live [LootCard] from the loot deck (draw pile, + // discard pile, and the material/herb pools). + 'setLootOwner': CommandDescriptor( + 'setLootOwner', + (gs, args) => SetLootOwnerCommand( + _str('setLootOwner', 'ownerId', args), + _lootCard(gs, 'setLootOwner', _int('setLootOwner', 'cardId', args)), + ), + ), + 'setNoteRowColor': CommandDescriptor( + 'setNoteRowColor', + (gs, args) => SetNoteRowColorCommand( + _int('setNoteRowColor', 'color', args), + _str('setNoteRowColor', 'noteId', args), + gameState: gs, + ), + ), + 'setNoteRowLink': CommandDescriptor( + 'setNoteRowLink', + (gs, args) => SetNoteRowLinkCommand( + _str('setNoteRowLink', 'noteId', args), + _str('setNoteRowLink', 'linkedId', args), + _int('setNoteRowLink', 'standeeNr', args), + gameState: gs, + ), + ), + 'setNoteRowText': CommandDescriptor( + 'setNoteRowText', + (gs, args) => SetNoteRowTextCommand( + _str('setNoteRowText', 'text', args), + _str('setNoteRowText', 'noteId', args), + gameState: gs, + ), + ), + 'setScenario': CommandDescriptor( + 'setScenario', + (gs, args) => SetScenarioCommand( + _str('setScenario', 'scenario', args), + _bool('setScenario', 'section', args), + gameState: gs, + ), + ), + 'setSolo': CommandDescriptor( + 'setSolo', + (gs, args) => SetSoloCommand(_bool('setSolo', 'solo', args)), + ), + 'showAllyDeck': CommandDescriptor( + 'showAllyDeck', + (gs, args) => ShowAllyDeckCommand(), + ), + 'shuffleAbilityCard': CommandDescriptor( + 'shuffleAbilityCard', + (gs, args) => + ShuffleAbilityCardCommand(_str('shuffleAbilityCard', 'ownerId', args)), + ), + 'shuffleAMDCard': CommandDescriptor( + 'shuffleAMDCard', + (gs, args) => ShuffleAMDCardCommand( + _str('shuffleAMDCard', 'name', args), + gameState: gs, + ), + ), + 'shuffleDrawnAbilityCard': CommandDescriptor( + 'shuffleDrawnAbilityCard', + (gs, args) => ShuffleDrawnAbilityCardCommand( + _str('shuffleDrawnAbilityCard', 'deck', args), + ), + ), + // Settings is injected, never a wire arg. + 'trackStandees': CommandDescriptor( + 'trackStandees', + (gs, args) => TrackStandeesCommand( + _bool('trackStandees', 'track', args), + gameState: gs, + settings: getIt<Settings>(), + ), + ), + 'turnDone': CommandDescriptor( + 'turnDone', + (gs, args) => TurnDoneCommand(_str('turnDone', 'id', args), gameState: gs), + ), + 'unlockSpecial': CommandDescriptor( + 'unlockSpecial', + (gs, args) => + UnlockSpecialCommand(_str('unlockSpecial', 'id', args), gameState: gs), + ), + 'useElement': CommandDescriptor( + 'useElement', + (gs, args) => UseElementCommand( + _elements('useElement', 'element', args), + gameState: gs, + ), + ), + 'useFHPerks': CommandDescriptor( + 'useFHPerks', + (gs, args) => UseFHPerksCommand(_str('useFHPerks', 'characterId', args)), + ), +}; + +/// Wire name of each registered command's runtime type, for [commandName]. +final Map<Type, String> _nameByType = { + ActivateMonsterTypeCommand: 'activateMonsterType', + AddCharacterCommand: 'addCharacter', + AddConditionCommand: 'addCondition', + AddCSPartyCardCommand: 'addCSPartyCard', + AddFactionCardCommand: 'addFactionCard', + AddLootCardCommand: 'addLootCard', + AddMonsterCommand: 'addMonster', + AddNoteRowCommand: 'addNoteRow', + AddPerkCommand: 'addPerk', + AddSpecialLootCardCommand: 'addSpecialLootCard', + AddStandeeCommand: 'addStandee', + AmdAddMinusOneCommand: 'amdAddMinusOne', + AMDCassandraSpecialCommand: 'amdCassandraSpecial', + AMDImbue1Command: 'amdImbue1', + AMDImbue2Command: 'amdImbue2', + AMDRemoveImbueCommand: 'amdRemoveImbue', + AMDRemoveMinus1Command: 'amdRemoveMinus1', + AMDRemoveMinus2Command: 'amdRemoveMinus2', + AmdRemovePlus0Command: 'amdRemovePlus0', + AMDRevealCommand: 'amdReveal', + BadOmenCommand: 'badOmen', + ChangeBlessCommand: 'changeBless', + ChangeCurseCommand: 'changeCurse', + ChangeEmpowerCommand: 'changeEmpower', + ChangeEnfeebleCommand: 'changeEnfeeble', + ChangeHealthCommand: 'changeHealth', + ChangeMaxHealthCommand: 'changeMaxHealth', + ChangeNameCommand: 'changeName', + ChangeXPCommand: 'changeXP', + ClearUnlockedClassesCommand: 'clearUnlockedClasses', + CorrosiveSpewCommand: 'corrosiveSpew', + DonateCSSanctuaryCommand: 'donateCSSanctuary', + DrawAbilityCardCommand: 'drawAbilityCard', + DrawCommand: 'draw', + DrawLootCardCommand: 'drawLootCard', + DrawModifierCardCommand: 'drawModifierCard', + EnhanceLootCardCommand: 'enhanceLootCard', + HideAllyDeckCommand: 'hideAllyDeck', + IceWraithChangeFormCommand: 'iceWraithChangeForm', + ImbueElementCommand: 'imbueElement', + LoadCharacterSaveCommand: 'loadCharacterSave', + LoadSaveCommand: 'loadSave', + NextRoundCommand: 'nextRound', + RemoveAMDCardCommand: 'removeAMDCard', + RemoveCardCommand: 'removeCard', + RemoveCharacterCommand: 'removeCharacter', + RemoveConditionCommand: 'removeCondition', + RemoveCSPartyCardCommand: 'removeCSPartyCard', + RemoveCSSanctuaryDonationCommand: 'removeCSSanctuaryDonation', + RemoveMonsterCommand: 'removeMonster', + RemoveNoteRowCommand: 'removeNoteRow', + RemoveSpecialLootCardCommand: 'removeSpecialLootCard', + ReorderAbilityListCommand: 'reorderAbilityList', + ReorderListCommand: 'reorderList', + ReorderModifierListCommand: 'reorderModifierList', + ReturnLootCardCommand: 'returnLootCard', + ReturnModifierCardCommand: 'returnModifierCard', + ReturnRemovedAMDCardCommand: 'returnRemovedAMDCard', + SetAllyDeckInOgGloomCommand: 'setAllyDeckInOgGloom', + SetAsSummonCommand: 'setAsSummon', + SetAutoLevelAdjustCommand: 'setAutoLevelAdjust', + SetCampaignCommand: 'setCampaign', + SetCharacterLevelCommand: 'setCharacterLevel', + SetDifficultyCommand: 'setDifficulty', + SetFigureNoteCommand: 'setFigureNote', + SetInitCommand: 'setInit', + SetLevelCommand: 'setLevel', + SetLootOwnerCommand: 'setLootOwner', + SetNoteRowColorCommand: 'setNoteRowColor', + SetNoteRowLinkCommand: 'setNoteRowLink', + SetNoteRowTextCommand: 'setNoteRowText', + SetScenarioCommand: 'setScenario', + SetSoloCommand: 'setSolo', + ShowAllyDeckCommand: 'showAllyDeck', + ShuffleAbilityCardCommand: 'shuffleAbilityCard', + ShuffleAMDCardCommand: 'shuffleAMDCard', + ShuffleDrawnAbilityCardCommand: 'shuffleDrawnAbilityCard', + TrackStandeesCommand: 'trackStandees', + TurnDoneCommand: 'turnDone', + UnlockSpecialCommand: 'unlockSpecial', + UseElementCommand: 'useElement', + UseFHPerksCommand: 'useFHPerks', +}; + +// --- arg helpers ----------------------------------------------------------- +// +// Every helper throws [CommandRegistryError] with a message naming the +// command and the offending arg. An arg that is missing or JSON `null` is +// treated as "not provided" for optional parameters. + +Object _requiredArg(String command, String key, Map<String, dynamic> args) { + if (!args.containsKey(key)) { + throw CommandRegistryError( + 'Command "$command" is missing required argument "$key"', + ); + } + return args[key]!; +} + +Object? _optionalArg(String command, String key, Map<String, dynamic> args) { + if (!args.containsKey(key)) return null; + return args[key]; +} + +Never _typeError(String command, String key, String expected, Object actual) { + throw CommandRegistryError( + 'Command "$command" argument "$key" must be $expected, ' + 'got ${actual.runtimeType}', + ); +} + +String _str(String command, String key, Map<String, dynamic> args) { + final value = _requiredArg(command, key, args); + if (value is! String) _typeError(command, key, 'a String', value); + return value; +} + +String? _strOr(String command, String key, Map<String, dynamic> args) { + final value = _optionalArg(command, key, args); + if (value == null) return null; + if (value is! String) _typeError(command, key, 'a String', value); + return value; +} + +int _int(String command, String key, Map<String, dynamic> args) { + final value = _requiredArg(command, key, args); + if (value is! int) _typeError(command, key, 'an int', value); + return value; +} + +int? _intOr(String command, String key, Map<String, dynamic> args) { + final value = _optionalArg(command, key, args); + if (value == null) return null; + if (value is! int) _typeError(command, key, 'an int', value); + return value; +} + +bool _bool(String command, String key, Map<String, dynamic> args) { + final value = _requiredArg(command, key, args); + if (value is! bool) _typeError(command, key, 'a bool', value); + return value; +} + +bool _boolOr( + String command, + String key, + Map<String, dynamic> args, + bool defaultValue, +) { + final value = _optionalArg(command, key, args); + if (value == null) return defaultValue; + if (value is! bool) _typeError(command, key, 'a bool', value); + return value; +} + +List<String> _strList(String command, String key, Map<String, dynamic> args) { + final value = _requiredArg(command, key, args); + if (value is! List) _typeError(command, key, 'a List', value); + final result = <String>[]; + int i = 0; + for (final item in value) { + if (item is! String) _typeError(command, '$key[$i]', 'a String', item); + result.add(item); + i++; + } + return result; +} + +Map<String, dynamic> _map( + String command, + String key, + Map<String, dynamic> args, +) { + final value = _requiredArg(command, key, args); + if (value is! Map) _typeError(command, key, 'a JSON object', value); + return Map<String, dynamic>.from(value); +} + +Map<String, dynamic>? _mapOr( + String command, + String key, + Map<String, dynamic> args, +) { + final value = _optionalArg(command, key, args); + if (value == null) return null; + if (value is! Map) _typeError(command, key, 'a JSON object', value); + return Map<String, dynamic>.from(value); +} + +/// Resolves an enum wire arg (a name string) to a value of [values]. +T _enumValue<T extends Enum>( + String command, + String key, + Map<String, dynamic> args, + List<T> values, +) { + final name = _str(command, key, args); + for (final value in values) { + if (value.name == name) return value; + } + throw CommandRegistryError( + 'Command "$command" argument "$key" has invalid value "$name"; ' + 'expected one of: ${values.map((e) => e.name).join(', ')}', + ); +} + +Condition _condition(String command, String key, Map<String, dynamic> args) => + _enumValue(command, key, args, Condition.values); + +Elements _elements(String command, String key, Map<String, dynamic> args) => + _enumValue(command, key, args, Elements.values); + +MonsterType _monsterType( + String command, + String key, + Map<String, dynamic> args, +) => _enumValue(command, key, args, MonsterType.values); + +/// Resolves the optional `summon` arg into a [SummonData]. +SummonData? _summonData(String command, Map<String, dynamic> args) { + final value = _mapOr(command, 'summon', args); + if (value == null) return null; + return SummonData( + _int(command, 'summon.standeeNr', value), + _str(command, 'summon.name', value), + _int(command, 'summon.health', value), + _int(command, 'summon.move', value), + _int(command, 'summon.attack', value), + _int(command, 'summon.range', value), + _str(command, 'summon.gfx', value), + ); +} + +/// Resolves the `noteRow` arg into a [NoteRow]. All five keys +/// `{id, text, color, linkedId, standeeNr}` are required; `id` is a +/// client-generated unique string. +NoteRow _noteRow(String command, Map<String, dynamic> args) { + final value = _map(command, 'noteRow', args); + _str(command, 'noteRow.id', value); + _str(command, 'noteRow.text', value); + _int(command, 'noteRow.color', value); + _str(command, 'noteRow.linkedId', value); + _int(command, 'noteRow.standeeNr', value); + return NoteRow.fromJson(value); +} + +/// Finds the live [LootCard] with [cardId] in the loot deck: the draw pile, +/// the discard pile, and the material/herb pools (pool cards are the same +/// instances that enter the deck, so this covers every live card). +LootCard _lootCard(GameState gameState, String command, int cardId) { + final deck = gameState.lootDeck; + final all = <LootCard>[ + ...deck.drawPileContents, + ...deck.discardPileContents, + ...deck.coinPool, + ...deck.lumberPool, + ...deck.hidePool, + ...deck.metalPool, + ...deck.corpsecapPool, + ...deck.arrowvinePool, + ...deck.flamefruitPool, + ...deck.axenutPool, + ...deck.rockrootPool, + ...deck.snowthistlePool, + ]; + for (final card in all) { + if (card.id == cardId) return card; + } + throw CommandRegistryError( + 'Command "$command": no loot card with id $cardId in the loot deck', + ); +} + +/// Finds the live ability card with [nr] in the ability deck named +/// [deckName] (draw pile, then discard pile) — the same lookup the command's +/// own execute() does. +MonsterAbilityCardModel _abilityCard( + GameState gameState, + String command, + String deckName, + int nr, +) { + for (final deck in gameState.currentAbilityDecks) { + if (deck.name != deckName) continue; + for (final card in deck.drawPileContents) { + if (card.nr == nr) return card; + } + for (final card in deck.discardPileContents) { + if (card.nr == nr) return card; + } + } + throw CommandRegistryError( + 'Command "$command": no ability card with nr $nr in deck "$deckName"', + ); +} + +/// Resolves wire `ids` (character ids) to the live [Character] objects in the +/// current list. An empty result is not an error. +List<Character> _characters(GameState gameState, List<String> ids) { + return gameState.currentList + .where((item) => item is Character && ids.contains(item.id)) + .cast<Character>() + .toList(); +} + +/// Resolves wire `ids` (monster ids) to the live [Monster] objects in the +/// current list. An empty result is not an error. +List<Monster> _monsters(GameState gameState, List<String> ids) { + return gameState.currentList + .where((item) => item is Monster && ids.contains(item.id)) + .cast<Monster>() + .toList(); +} diff --git a/server/lib/core/commands/corrosive_spew_command.dart b/server/lib/core/commands/corrosive_spew_command.dart new file mode 100644 index 0000000..c7cae5e --- /dev/null +++ b/server/lib/core/commands/corrosive_spew_command.dart @@ -0,0 +1,22 @@ +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class CorrosiveSpewCommand extends Command { + final GameState _gameState; + + CorrosiveSpewCommand({required GameState gameState}) : _gameState = gameState; + + @override + void execute() { + GameMethods.getModifierDeck( + "Ruinmaw", + _gameState, + ).setCorrosiveSpew(stateAccess); + } + + @override + String describe() { + return commandL10n.corrosiveSpew; + } +} diff --git a/server/lib/core/commands/donate_cs_sanctuary_command.dart b/server/lib/core/commands/donate_cs_sanctuary_command.dart new file mode 100644 index 0000000..c1fdd0f --- /dev/null +++ b/server/lib/core/commands/donate_cs_sanctuary_command.dart @@ -0,0 +1,22 @@ +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class DonateCSSanctuaryCommand extends Command { + final String characterId; + final GameState _gameState; + + DonateCSSanctuaryCommand(this.characterId, {required GameState gameState}) + : _gameState = gameState; + + @override + void execute() { + ModifierDeck? deck = GameMethods.getModifierDeck(characterId, _gameState); + deck.addCSSanctuary(stateAccess); + } + + @override + String describe() { + return commandL10n.cmdDonateSanctuary(characterId); + } +} diff --git a/server/lib/core/commands/draw_ability_card_command.dart b/server/lib/core/commands/draw_ability_card_command.dart new file mode 100644 index 0000000..8c8aebb --- /dev/null +++ b/server/lib/core/commands/draw_ability_card_command.dart @@ -0,0 +1,28 @@ +import 'package:collection/collection.dart'; + +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class DrawAbilityCardCommand extends Command { + final String ownerId; + DrawAbilityCardCommand(this.ownerId); + + @override + void execute() { + final Monster? monster = GameMethods.getCurrentMonsters().firstWhereOrNull( + (element) => element.id == ownerId, + ); + if (monster == null) return; + final MonsterAbilityState? deck = GameMethods.getDeck(monster.type.deck); + if (deck == null) return; + if (deck.drawPileIsNotEmpty) { + deck.draw(stateAccess); + } + } + + @override + String describe() { + return commandL10n.cmdDrawExtraAbilityCard; + } +} diff --git a/server/lib/core/commands/draw_command.dart b/server/lib/core/commands/draw_command.dart new file mode 100644 index 0000000..fa1d38a --- /dev/null +++ b/server/lib/core/commands/draw_command.dart @@ -0,0 +1,27 @@ +import '../enums.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class DrawCommand extends Command { + final GameState _gameState; + + DrawCommand({required GameState gameState}) : _gameState = gameState; + + @override + void execute() { + DeckMethods.drawAbilityCards(stateAccess); + RoundMethods.sortByInitiative(stateAccess); + RoundMethods.setRoundState(stateAccess, RoundState.playTurns); + if (_gameState.currentList.isNotEmpty) { + _gameState.currentList.first.setTurnState( + stateAccess, + TurnsState.current, + ); + } + } + + @override + String describe() { + return commandL10n.cmdDraw; + } +} diff --git a/server/lib/core/commands/draw_loot_card_command.dart b/server/lib/core/commands/draw_loot_card_command.dart new file mode 100644 index 0000000..be2187f --- /dev/null +++ b/server/lib/core/commands/draw_loot_card_command.dart @@ -0,0 +1,24 @@ +import '../game_event.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class DrawLootCardCommand extends Command { + final GameState _gameState; + + DrawLootCardCommand({required GameState gameState}) : _gameState = gameState; + + @override + void execute() { + if (_gameState.lootDeck.drawPileIsNotEmpty) { + _gameState.lootDeck.draw(stateAccess); + } + } + + @override + String describe() { + return commandL10n.cmdDrawLootCard; + } + + @override + GameEvent get event => const LootCardDrawnEvent(); +} diff --git a/server/lib/core/commands/draw_modifier_card_command.dart b/server/lib/core/commands/draw_modifier_card_command.dart new file mode 100644 index 0000000..a9ca8e4 --- /dev/null +++ b/server/lib/core/commands/draw_modifier_card_command.dart @@ -0,0 +1,29 @@ +import '../game_event.dart'; +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class DrawModifierCardCommand extends Command { + final String name; + final GameState _gameState; + + DrawModifierCardCommand(this.name, {required GameState gameState}) + : _gameState = gameState; + + @override + void execute() { + final deck = GameMethods.getModifierDeck(name, _gameState); + deck.draw(stateAccess); + } + + @override + String describe() { + if (name.isNotEmpty) { + return commandL10n.cmdDrawModifierCard(name); + } + return commandL10n.cmdDrawMonsterModifierCard; + } + + @override + GameEvent get event => ModifierCardDrawnEvent(name); +} diff --git a/server/lib/core/commands/enhance_loot_card_command.dart b/server/lib/core/commands/enhance_loot_card_command.dart new file mode 100644 index 0000000..e7ed730 --- /dev/null +++ b/server/lib/core/commands/enhance_loot_card_command.dart @@ -0,0 +1,28 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class EnhanceLootCardCommand extends Command { + EnhanceLootCardCommand( + this.id, + this.value, + this.resourceType, { + required GameState gameState, + }) : _gameState = gameState; + final int value; + final int id; + final String resourceType; + final GameState _gameState; + + @override + void execute() { + _gameState.lootDeck.addEnhancement(stateAccess, id, value); + } + + @override + String describe() { + if (value <= 0) { + return commandL10n.cmdRemoveLootEnhancement; + } + return commandL10n.cmdAddLootEnhancement; + } +} diff --git a/server/lib/core/commands/hide_ally_deck_command.dart b/server/lib/core/commands/hide_ally_deck_command.dart new file mode 100644 index 0000000..a773517 --- /dev/null +++ b/server/lib/core/commands/hide_ally_deck_command.dart @@ -0,0 +1,16 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class HideAllyDeckCommand extends Command { + HideAllyDeckCommand(); + + @override + void execute() { + MonsterMethods.hideAllyDeck(stateAccess); + } + + @override + String describe() { + return commandL10n.cmdHideAllyDeck; + } +} diff --git a/server/lib/core/commands/ice_wraith_change_form_command.dart b/server/lib/core/commands/ice_wraith_change_form_command.dart new file mode 100644 index 0000000..1a4db55 --- /dev/null +++ b/server/lib/core/commands/ice_wraith_change_form_command.dart @@ -0,0 +1,37 @@ +import '../enums.dart'; +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class IceWraithChangeFormCommand extends Command { + IceWraithChangeFormCommand( + this.isElite, + this.ownerId, + this.figureId, { + required GameState gameState, + }) : _gameState = gameState; + final bool isElite; + final String? ownerId; + final String figureId; + final GameState _gameState; + + @override + void execute() { + final figure = GameMethods.getFigure(ownerId, figureId); + if (figure is! MonsterInstance) return; + if (isElite) { + figure.setType(stateAccess, MonsterType.normal); + } else { + figure.setType(stateAccess, MonsterType.elite); + } + _gameState.notifyListeners(); + } + + @override + String describe() { + if (!isElite) { + return commandL10n.cmdIceWraithTurnNormal; + } + return commandL10n.cmdIceWraithTurnElite; + } +} diff --git a/server/lib/core/commands/imbue_element_command.dart b/server/lib/core/commands/imbue_element_command.dart new file mode 100644 index 0000000..2f039d7 --- /dev/null +++ b/server/lib/core/commands/imbue_element_command.dart @@ -0,0 +1,27 @@ +import '../enums.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class ImbueElementCommand extends Command { + final Elements element; + final bool half; + final GameState? _gameState; + + ImbueElementCommand(this.element, this.half, {GameState? gameState}) + : _gameState = gameState; + + @override + void execute() { + ElementMethods.imbueElement( + stateAccess, + element, + half, + gameState: _gameState, + ); + } + + @override + String describe() { + return commandL10n.cmdImbueElement(element.name); + } +} diff --git a/server/lib/core/commands/load_character_save_command.dart b/server/lib/core/commands/load_character_save_command.dart new file mode 100644 index 0000000..6014c47 --- /dev/null +++ b/server/lib/core/commands/load_character_save_command.dart @@ -0,0 +1,42 @@ +import 'dart:convert'; + +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class LoadCharacterSaveCommand extends Command { + String saveName; + String saveData; + final GameState _gameState; + + LoadCharacterSaveCommand( + this.saveName, + this.saveData, { + required GameState gameState, + }) : _gameState = gameState; + + @override + void execute() { + final data = json.decode(saveData) as Map<String, dynamic>; + Character character = Character.fromSave(data); + + //add new character on top of list, if not present. + final Character? currentCharacter = GameMethods.getCharacterByName( + character.id, + ); + if (currentCharacter != null) { + CharacterMethods.removeCharacters(stateAccess, [currentCharacter]); + } + + CharacterMethods.resetCharacter(stateAccess, character); + RoundMethods.addToMainList(stateAccess, 0, character); + ScenarioMethods.applyDifficulty(stateAccess); + _gameState.notifyListeners(); + ScenarioMethods.unlockClass(stateAccess, character.characterClass.id); + } + + @override + String describe() { + return commandL10n.cmdLoadCharacter(saveName); + } +} diff --git a/server/lib/core/commands/load_save_command.dart b/server/lib/core/commands/load_save_command.dart new file mode 100644 index 0000000..56bd22e --- /dev/null +++ b/server/lib/core/commands/load_save_command.dart @@ -0,0 +1,22 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class LoadSaveCommand extends Command { + String saveName; + String saveData; + final GameState _gameState; + + LoadSaveCommand(this.saveName, this.saveData, {required GameState gameState}) + : _gameState = gameState; + + @override + void execute() { + _gameState.loadFromData(saveData); + _gameState.save(); + } + + @override + String describe() { + return commandL10n.cmdLoadGame(saveName); + } +} diff --git a/server/lib/core/commands/next_round_command.dart b/server/lib/core/commands/next_round_command.dart new file mode 100644 index 0000000..22385fa --- /dev/null +++ b/server/lib/core/commands/next_round_command.dart @@ -0,0 +1,134 @@ +import 'package:collection/collection.dart'; +import 'package:x_haven_server/core/models/scenario.dart'; + +import '../enums.dart'; +import '../game_data.dart'; +import '../game_methods.dart'; +import '../settings.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class NextRoundCommand extends Command { + final GameState _gameState; + final GameData _gameData; + final Settings _settings; + + NextRoundCommand({ + required GameState gameState, + required GameData gameData, + required Settings settings, + }) : _gameState = gameState, + _gameData = gameData, + _settings = settings; + + @override + void execute() { + //todo: move code to GameMethods? + for (final item in _gameState.currentList) { + if (item is Character) { + item.nextRound(stateAccess); + } + if (item is Monster) { + //only really needed for ice wraiths + item.sortMonsterInstances(stateAccess); + } + } + DeckMethods.shuffleDecksIfNeeded(stateAccess); + ElementMethods.updateElements(stateAccess); + RoundMethods.setRoundState(stateAccess, RoundState.chooseInitiative); + if (_gameState.currentList.isNotEmpty && + _gameState.currentList.last.turnState != TurnsState.done) { + RoundMethods.setTurnDone(stateAccess, _gameState.currentList.length - 1); + } + if (_gameState.currentList.isNotEmpty && + _gameState.currentList.last.turnState != TurnsState.done) { + RoundMethods.setTurnDone(stateAccess, _gameState.currentList.length - 1); + } + RoundMethods.clearTurnState(stateAccess, false); + RoundMethods.sortCharactersFirst(stateAccess); + + GameUtilMethods.setToastMessage(""); + + for (final rule in _gameState.scenarioSpecialRules) { + if (rule.type == "Timer" && !rule.startOfRound) { + for (int round in rule.list.cast<int>()) { + //minus 1 means always + if (round == _gameState.round || round == -1) { + if (_settings.showReminders) { + GameUtilMethods.setToastMessage(rule.note); + } + + _handleTimedSpawns(rule); + } + } + } + } + + //start of next round is now + for (final rule in _gameState.scenarioSpecialRules) { + if (rule.type == "Timer" && rule.startOfRound) { + for (int round in rule.list.cast<int>()) { + //minus 1 means always + final toastMessage = _gameState.toastMessage; + if (round - 1 == _gameState.round || round == -1) { + if (toastMessage.isNotEmpty) { + GameUtilMethods.setToastMessage("$toastMessage\n\n${rule.note}"); + } else { + if (_settings.showReminders) { + GameUtilMethods.setToastMessage("$toastMessage${rule.note}"); + } + } + _handleTimedSpawns(rule); + } + } + } + } + + RoundMethods.setRound(stateAccess, _gameState.round + 1); + + if (_gameState.modifierDeck.needsShuffle) { + _gameState.modifierDeck.shuffle(stateAccess); + } + if (_gameState.modifierDeckAllies.needsShuffle) { + _gameState.modifierDeckAllies.shuffle(stateAccess); + } + final characters = GameMethods.getCurrentCharacters(); + for (final character in characters) { + final modifierDeck = character.characterState.modifierDeck; + if (modifierDeck.needsShuffle) { + modifierDeck.shuffle(stateAccess); + } + } + } + + @override + String describe() { + return commandL10n.cmdNextRound; + } + + void _handleTimedSpawns(SpecialRule rule) { + if (_settings.autoAddSpawns) { + if (rule.name.isNotEmpty) { + //get room data and deal with spawns + ScenarioModel? scenario = _gameData + .modelData[_gameState.currentCampaign] + ?.scenarios[_gameState.scenario]; + if (scenario != null) { + ScenarioModel? spawnSection = scenario.sections.firstWhereOrNull( + (element) => element.name.substring(1) == rule.name, + ); + if (spawnSection != null) { + final monsterStandees = spawnSection.monsterStandees; + if (monsterStandees != null) { + MonsterMethods.autoAddStandees( + stateAccess, + monsterStandees, + rule.note, + ); + } + } + } + } + } + } +} diff --git a/server/lib/core/commands/remove__special_loot_card_command.dart b/server/lib/core/commands/remove__special_loot_card_command.dart new file mode 100644 index 0000000..2ef9b57 --- /dev/null +++ b/server/lib/core/commands/remove__special_loot_card_command.dart @@ -0,0 +1,28 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class RemoveSpecialLootCardCommand extends Command { + static const int _kCard1418 = 1418; + static const int _kCard1419 = 1419; + + int nr; + final GameState _gameState; + + RemoveSpecialLootCardCommand(this.nr, {required GameState gameState}) + : _gameState = gameState; + + @override + void execute() { + if (nr == _kCard1418) { + _gameState.lootDeck.removeSpecial1418(stateAccess); + } + if (nr == _kCard1419) { + _gameState.lootDeck.removeSpecial1419(stateAccess); + } + } + + @override + String describe() { + return commandL10n.cmdRemoveSpecialLootCard(nr); + } +} diff --git a/server/lib/core/commands/remove_amd_card_command.dart b/server/lib/core/commands/remove_amd_card_command.dart new file mode 100644 index 0000000..2700660 --- /dev/null +++ b/server/lib/core/commands/remove_amd_card_command.dart @@ -0,0 +1,33 @@ +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class RemoveAMDCardCommand extends Command { + final int index; + final String name; + final GameState _gameState; + final bool fromDrawPile; + + RemoveAMDCardCommand({ + required this.index, + required this.name, + required GameState gameState, + this.fromDrawPile = false, + }) : _gameState = gameState; + @override + void execute() { + final deck = GameMethods.getModifierDeck(name, _gameState); + if (fromDrawPile) { + if (index >= deck.drawPileSize) return; + deck.removeCardFromDrawPile(stateAccess, index); + } else { + if (index >= deck.discardPileSize) return; + deck.removeCardFromDiscard(stateAccess, index); + } + } + + @override + String describe() { + return commandL10n.cmdRemoveAmdCard; + } +} diff --git a/server/lib/core/commands/remove_card_command.dart b/server/lib/core/commands/remove_card_command.dart new file mode 100644 index 0000000..438f66e --- /dev/null +++ b/server/lib/core/commands/remove_card_command.dart @@ -0,0 +1,38 @@ +import 'package:x_haven_server/core/models/monster_ability.dart'; + +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class RemoveCardCommand extends Command { + final MonsterAbilityCardModel card; + final GameState _gameState; + + RemoveCardCommand(this.card, {required GameState gameState}) + : _gameState = gameState; + @override + void execute() { + for (final deck in _gameState.currentAbilityDecks) { + if (deck.name == card.deck) { + for (final drawPileCard in deck.drawPileContents) { + if (drawPileCard.nr == card.nr) { + deck.removeFromDrawPile(stateAccess, card); + break; + } + } + for (final discardPileCard in deck.discardPileContents) { + if (discardPileCard.nr == card.nr) { + deck.removeFromDiscardPile(stateAccess, card); + break; + } + } + deck.shuffle(stateAccess); + break; + } + } + } + + @override + String describe() { + return commandL10n.cmdRemoveCard(card.deck, card.nr); + } +} diff --git a/server/lib/core/commands/remove_character_command.dart b/server/lib/core/commands/remove_character_command.dart new file mode 100644 index 0000000..ea1d982 --- /dev/null +++ b/server/lib/core/commands/remove_character_command.dart @@ -0,0 +1,30 @@ +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class RemoveCharacterCommand extends Command { + final List<Character> names; + + RemoveCharacterCommand(this.names, {required GameState gameState}); + + @override + void execute() { + CharacterMethods.removeCharacters(stateAccess, names); + + if (names.length != 1 || + !GameMethods.isObjectiveOrEscort(names.first.characterClass)) { + ScenarioMethods.applyDifficulty(stateAccess); + } + } + + @override + String describe() { + if (names.length > 1) { + return commandL10n.cmdRemoveAllCharacters; + } + if (names.isNotEmpty) { + return commandL10n.cmdRemoveCharacter(names.first.id); + } + return commandL10n.cmdRemoveNoCharacters; + } +} diff --git a/server/lib/core/commands/remove_condition_command.dart b/server/lib/core/commands/remove_condition_command.dart new file mode 100644 index 0000000..04cdd40 --- /dev/null +++ b/server/lib/core/commands/remove_condition_command.dart @@ -0,0 +1,47 @@ +import '../enums.dart'; +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class RemoveConditionCommand extends Command { + final Condition condition; + final String figureId; + final String? ownerId; + final GameState _gameState; + + RemoveConditionCommand( + this.condition, + this.figureId, + this.ownerId, { + required GameState gameState, + }) : _gameState = gameState; + + @override + void execute() { + FigureState? figure = GameMethods.getFigure(ownerId, figureId); + if (figure != null) { + List<Condition> newList = []; + newList.addAll(figure.conditions); + newList.remove(condition); + figure.setConditions(stateAccess, newList); + if (condition != Condition.chill || + !figure.conditions.contains(Condition.chill)) { + figure.removeFromConditionsThisTurn(stateAccess, condition); + } + if (condition == Condition.chill) { + figure.setChill(stateAccess, figure.chill - 1); + } + if (condition == Condition.plague) { + figure.setPlague(stateAccess, figure.plague - 1); + } + + figure.removeFromConditionsPreviousTurn(stateAccess, condition); + _gameState.notifyListeners(); + } + } + + @override + String describe() { + return commandL10n.cmdRemoveCondition(condition.getName()); + } +} diff --git a/server/lib/core/commands/remove_cs_party_card_command.dart b/server/lib/core/commands/remove_cs_party_card_command.dart new file mode 100644 index 0000000..64f03bf --- /dev/null +++ b/server/lib/core/commands/remove_cs_party_card_command.dart @@ -0,0 +1,22 @@ +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class RemoveCSPartyCardCommand extends Command { + final String characterId; + final GameState _gameState; + + RemoveCSPartyCardCommand(this.characterId, {required GameState gameState}) + : _gameState = gameState; + + @override + void execute() { + ModifierDeck? deck = GameMethods.getModifierDeck(characterId, _gameState); + deck.removeCSPartyCard(stateAccess); + } + + @override + String describe() { + return commandL10n.cmdRemovePartyCard(characterId); + } +} diff --git a/server/lib/core/commands/remove_cs_sanctuary_donation_command.dart b/server/lib/core/commands/remove_cs_sanctuary_donation_command.dart new file mode 100644 index 0000000..3751097 --- /dev/null +++ b/server/lib/core/commands/remove_cs_sanctuary_donation_command.dart @@ -0,0 +1,24 @@ +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class RemoveCSSanctuaryDonationCommand extends Command { + final String characterId; + final GameState _gameState; + + RemoveCSSanctuaryDonationCommand( + this.characterId, { + required GameState gameState, + }) : _gameState = gameState; + + @override + void execute() { + ModifierDeck? deck = GameMethods.getModifierDeck(characterId, _gameState); + deck.removeCSSanctuary(stateAccess); + } + + @override + String describe() { + return commandL10n.cmdRemoveSanctuaryDonation(characterId); + } +} diff --git a/server/lib/core/commands/remove_monster_command.dart b/server/lib/core/commands/remove_monster_command.dart new file mode 100644 index 0000000..b64f1e6 --- /dev/null +++ b/server/lib/core/commands/remove_monster_command.dart @@ -0,0 +1,24 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class RemoveMonsterCommand extends Command { + final List<Monster> names; + + RemoveMonsterCommand(this.names, {required GameState gameState}); + + @override + void execute() { + MonsterMethods.removeMonsters(stateAccess, names); + } + + @override + String describe() { + if (names.length > 1) { + return commandL10n.cmdRemoveAllMonsters; + } + if (names.isNotEmpty) { + return commandL10n.cmdRemoveMonster(names.first.type.display); + } + return commandL10n.cmdRemoveNoMonsters; + } +} diff --git a/server/lib/core/commands/remove_note_row_command.dart b/server/lib/core/commands/remove_note_row_command.dart new file mode 100644 index 0000000..b574208 --- /dev/null +++ b/server/lib/core/commands/remove_note_row_command.dart @@ -0,0 +1,19 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class RemoveNoteRowCommand extends Command { + RemoveNoteRowCommand(this.noteId, {required GameState gameState}) + : _gameState = gameState; + final String noteId; + final GameState _gameState; + + @override + void execute() { + RoundMethods.removeFromMainList(stateAccess, noteId, gameState: _gameState); + } + + @override + String describe() { + return commandL10n.cmdRemoveNoteRow; + } +} diff --git a/server/lib/core/commands/reorder_ability_list_command.dart b/server/lib/core/commands/reorder_ability_list_command.dart new file mode 100644 index 0000000..f7e5781 --- /dev/null +++ b/server/lib/core/commands/reorder_ability_list_command.dart @@ -0,0 +1,31 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class ReorderAbilityListCommand extends Command { + final int newIndex; + final int oldIndex; + final String deck; + final GameState _gameState; + + ReorderAbilityListCommand( + this.deck, + this.newIndex, + this.oldIndex, { + required GameState gameState, + }) : _gameState = gameState; + + @override + void execute() { + for (final item in _gameState.currentAbilityDecks) { + if (item.name == deck) { + item.reorderDrawPile(stateAccess, oldIndex, newIndex); + break; + } + } + } + + @override + String describe() { + return commandL10n.cmdReorderAbilityCards; + } +} diff --git a/server/lib/core/commands/reorder_list_command.dart b/server/lib/core/commands/reorder_list_command.dart new file mode 100644 index 0000000..d20f0d8 --- /dev/null +++ b/server/lib/core/commands/reorder_list_command.dart @@ -0,0 +1,23 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class ReorderListCommand extends Command { + final int newIndex; + final int oldIndex; + + ReorderListCommand( + this.newIndex, + this.oldIndex, { + required GameState gameState, + }); + + @override + void execute() { + RoundMethods.reorderMainList(stateAccess, newIndex, oldIndex); + } + + @override + String describe() { + return commandL10n.cmdReorderList; + } +} diff --git a/server/lib/core/commands/reorder_modifier_list_command.dart b/server/lib/core/commands/reorder_modifier_list_command.dart new file mode 100644 index 0000000..60f0bb4 --- /dev/null +++ b/server/lib/core/commands/reorder_modifier_list_command.dart @@ -0,0 +1,28 @@ +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class ReorderModifierListCommand extends Command { + final int newIndex; + final int oldIndex; + final String name; + final GameState _gameState; + + ReorderModifierListCommand( + this.newIndex, + this.oldIndex, + this.name, { + required GameState gameState, + }) : _gameState = gameState; + + @override + void execute() { + final deck = GameMethods.getModifierDeck(name, _gameState); + deck.reorderCards(stateAccess, newIndex, oldIndex); + } + + @override + String describe() { + return commandL10n.cmdReorderModifierCards; + } +} diff --git a/server/lib/core/commands/return_loot_card_command.dart b/server/lib/core/commands/return_loot_card_command.dart new file mode 100644 index 0000000..91a95d5 --- /dev/null +++ b/server/lib/core/commands/return_loot_card_command.dart @@ -0,0 +1,20 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class ReturnLootCardCommand extends Command { + final bool top; + final GameState _gameState; + + ReturnLootCardCommand(this.top, {required GameState gameState}) + : _gameState = gameState; + + @override + void execute() { + _gameState.lootDeck.returnLootCard(stateAccess, top); + } + + @override + String describe() { + return commandL10n.cmdReturnLootCard; + } +} diff --git a/server/lib/core/commands/return_modifier_card_command.dart b/server/lib/core/commands/return_modifier_card_command.dart new file mode 100644 index 0000000..1f2f5ce --- /dev/null +++ b/server/lib/core/commands/return_modifier_card_command.dart @@ -0,0 +1,18 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class ReturnModifierCardCommand extends Command { + final String name; + + ReturnModifierCardCommand(this.name); + + @override + void execute() { + DeckMethods.returnModifierCard(stateAccess, name); + } + + @override + String describe() { + return commandL10n.cmdReturnModifierCard; + } +} diff --git a/server/lib/core/commands/return_removed_amd_card_command.dart b/server/lib/core/commands/return_removed_amd_card_command.dart new file mode 100644 index 0000000..dda3feb --- /dev/null +++ b/server/lib/core/commands/return_removed_amd_card_command.dart @@ -0,0 +1,31 @@ +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class ReturnRemovedAMDCardCommand extends Command { + final int index; + final String name; + final bool toDrawPile; + final GameState _gameState; + + ReturnRemovedAMDCardCommand({ + required this.index, + required this.name, + this.toDrawPile = false, + required GameState gameState, + }) : _gameState = gameState; + @override + void execute() { + final deck = GameMethods.getModifierDeck(name, _gameState); + if (toDrawPile) { + deck.returnCardToDrawPileFromRemoved(stateAccess, index); + } else { + deck.returnCardToDiscard(stateAccess, index); + } + } + + @override + String describe() { + return commandL10n.cmdReturnRemovedAmdCard; + } +} diff --git a/server/lib/core/commands/set_ally_deck_in_og_gloom_command.dart b/server/lib/core/commands/set_ally_deck_in_og_gloom_command.dart new file mode 100644 index 0000000..fbff5d9 --- /dev/null +++ b/server/lib/core/commands/set_ally_deck_in_og_gloom_command.dart @@ -0,0 +1,23 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class SetAllyDeckInOgGloomCommand extends Command { + final GameState _gameState; + final bool set; + + SetAllyDeckInOgGloomCommand(this.set, {required GameState gameState}) + : _gameState = gameState; + + @override + void execute() { + _gameState.setAllyDeckInOGGloom(stateAccess, set); + } + + @override + String describe() { + if (!set) { + return commandL10n.cmdNoAllyDeckInOgGloom; + } + return commandL10n.cmdUseAllyDeckInOgGloom; + } +} diff --git a/server/lib/core/commands/set_as_summon_command.dart b/server/lib/core/commands/set_as_summon_command.dart new file mode 100644 index 0000000..0337001 --- /dev/null +++ b/server/lib/core/commands/set_as_summon_command.dart @@ -0,0 +1,37 @@ +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class SetAsSummonCommand extends Command { + final bool summoned; + final String? ownerId; + final String figureId; + final GameState _gameState; + + SetAsSummonCommand( + this.summoned, + this.figureId, + this.ownerId, { + required GameState gameState, + }) : _gameState = gameState; + + @override + void execute() { + final figure = GameMethods.getFigure(ownerId, figureId); + if (figure is! MonsterInstance) return; + if (summoned) { + figure.setRoundSummoned(stateAccess, _gameState.round); + } else { + figure.setRoundSummoned(stateAccess, -1); + } + _gameState.notifyListeners(); + } + + @override + String describe() { + if (summoned) { + return commandL10n.cmdMarkAsSummon(ownerId ?? ''); + } + return commandL10n.cmdRemoveSummonMark(ownerId ?? ''); + } +} diff --git a/server/lib/core/commands/set_auto_level_adjust_command.dart b/server/lib/core/commands/set_auto_level_adjust_command.dart new file mode 100644 index 0000000..9be49ec --- /dev/null +++ b/server/lib/core/commands/set_auto_level_adjust_command.dart @@ -0,0 +1,21 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class SetAutoLevelAdjustCommand extends Command { + SetAutoLevelAdjustCommand(this.on, {required GameState gameState}) + : _gameState = gameState; + + bool on; + final GameState _gameState; + + @override + void execute() { + _gameState.setAutoScenarioLevel(stateAccess, on); + ScenarioMethods.applyDifficulty(stateAccess); + } + + @override + String describe() { + return on ? commandL10n.cmdAutoLevelOn : commandL10n.cmdAutoLevelOff; + } +} diff --git a/server/lib/core/commands/set_campaign_command.dart b/server/lib/core/commands/set_campaign_command.dart new file mode 100644 index 0000000..da5c312 --- /dev/null +++ b/server/lib/core/commands/set_campaign_command.dart @@ -0,0 +1,18 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class SetCampaignCommand extends Command { + SetCampaignCommand(this.campaign); + + String campaign; + + @override + void execute() { + ScenarioMethods.setCampaign(stateAccess, campaign); + } + + @override + String describe() { + return commandL10n.cmdSetCampaign(campaign); + } +} diff --git a/server/lib/core/commands/set_character_level_command.dart b/server/lib/core/commands/set_character_level_command.dart new file mode 100644 index 0000000..66c28de --- /dev/null +++ b/server/lib/core/commands/set_character_level_command.dart @@ -0,0 +1,19 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class SetCharacterLevelCommand extends Command { + final int level; + final String characterId; + + SetCharacterLevelCommand(this.level, this.characterId); + + @override + void execute() { + CharacterMethods.setCharacterLevel(stateAccess, level, characterId); + } + + @override + String describe() { + return commandL10n.cmdSetCharacterLevel(characterId); + } +} diff --git a/server/lib/core/commands/set_difficulty_command.dart b/server/lib/core/commands/set_difficulty_command.dart new file mode 100644 index 0000000..a7ce147 --- /dev/null +++ b/server/lib/core/commands/set_difficulty_command.dart @@ -0,0 +1,21 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class SetDifficultyCommand extends Command { + SetDifficultyCommand(this.difficulty, {required GameState gameState}) + : _gameState = gameState; + + int difficulty; + final GameState _gameState; + + @override + void execute() { + _gameState.setDifficulty(stateAccess, difficulty); + ScenarioMethods.applyDifficulty(stateAccess); + } + + @override + String describe() { + return commandL10n.cmdSetDifficulty(difficulty.toString()); + } +} diff --git a/server/lib/core/commands/set_figure_note_command.dart b/server/lib/core/commands/set_figure_note_command.dart new file mode 100644 index 0000000..1bd2f8f --- /dev/null +++ b/server/lib/core/commands/set_figure_note_command.dart @@ -0,0 +1,30 @@ +import 'package:collection/collection.dart'; + +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +/// Sets the free-form inline note shown on a figure's row (character or +/// monster). Undo is handled by the snapshot-based history in [ActionHandler], +/// so no [onUndo] is needed. +class SetFigureNoteCommand extends Command { + SetFigureNoteCommand(this.note, this.figureId, {required GameState gameState}) + : _gameState = gameState; + final String note; + final String figureId; + final GameState _gameState; + + @override + void execute() { + final match = _gameState.currentList.firstWhereOrNull( + (element) => element.id == figureId, + ); + if (match != null) { + match.setNote(stateAccess, note); + } + } + + @override + String describe() { + return commandL10n.cmdSetCharacterNote(figureId); + } +} diff --git a/server/lib/core/commands/set_init_command.dart b/server/lib/core/commands/set_init_command.dart new file mode 100644 index 0000000..9ffb279 --- /dev/null +++ b/server/lib/core/commands/set_init_command.dart @@ -0,0 +1,26 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class SetInitCommand extends Command { + final GameState _gameState; + final String _characterId; + final int _init; + + SetInitCommand(this._characterId, this._init, {required GameState gameState}) + : _gameState = gameState; + + @override + void execute() { + //add new character on top of list + for (final item in _gameState.currentList) { + if (item.id == _characterId && item is Character) { + item.characterState.setInitiative(stateAccess, _init); + } + } + } + + @override + String describe() { + return commandL10n.cmdSetInitiative(_characterId); + } +} diff --git a/server/lib/core/commands/set_level_command.dart b/server/lib/core/commands/set_level_command.dart new file mode 100644 index 0000000..84efcd2 --- /dev/null +++ b/server/lib/core/commands/set_level_command.dart @@ -0,0 +1,22 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class SetLevelCommand extends Command { + final int level; + final String? monsterId; + + SetLevelCommand(this.level, this.monsterId); + + @override + void execute() { + ScenarioMethods.setLevel(stateAccess, level, monsterId); + } + + @override + String describe() { + if (monsterId != null) { + return commandL10n.cmdSetMonsterLevel(monsterId!); + } + return commandL10n.cmdSetLevel; + } +} diff --git a/server/lib/core/commands/set_loot_owner_command.dart b/server/lib/core/commands/set_loot_owner_command.dart new file mode 100644 index 0000000..f82531f --- /dev/null +++ b/server/lib/core/commands/set_loot_owner_command.dart @@ -0,0 +1,19 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class SetLootOwnerCommand extends Command { + final String ownerId; + final LootCard card; + + SetLootOwnerCommand(this.ownerId, this.card); + + @override + void execute() { + card.owner = ownerId; + } + + @override + String describe() { + return commandL10n.cmdSetLootOwner; + } +} diff --git a/server/lib/core/commands/set_note_row_color_command.dart b/server/lib/core/commands/set_note_row_color_command.dart new file mode 100644 index 0000000..ff9c91a --- /dev/null +++ b/server/lib/core/commands/set_note_row_color_command.dart @@ -0,0 +1,30 @@ +import 'package:collection/collection.dart'; + +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class SetNoteRowColorCommand extends Command { + SetNoteRowColorCommand( + this.color, + this.noteId, { + required GameState gameState, + }) : _gameState = gameState; + final int color; + final String noteId; + final GameState _gameState; + + @override + void execute() { + final match = _gameState.currentList.firstWhereOrNull( + (element) => element.id == noteId, + ); + if (match is NoteRow) { + match.setColor(stateAccess, color); + } + } + + @override + String describe() { + return commandL10n.cmdSetNoteRowColor; + } +} diff --git a/server/lib/core/commands/set_note_row_link_command.dart b/server/lib/core/commands/set_note_row_link_command.dart new file mode 100644 index 0000000..2e47bba --- /dev/null +++ b/server/lib/core/commands/set_note_row_link_command.dart @@ -0,0 +1,35 @@ +import 'package:collection/collection.dart'; + +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +/// Attaches a note to a figure (character or monster) by [linkedId], optionally +/// pinned to [standeeNr] for a monster standee, or detaches it when [linkedId] +/// is empty. The list's reflow step repositions the note accordingly. +class SetNoteRowLinkCommand extends Command { + SetNoteRowLinkCommand( + this.noteId, + this.linkedId, + this.standeeNr, { + required GameState gameState, + }) : _gameState = gameState; + final String noteId; + final String linkedId; + final int standeeNr; + final GameState _gameState; + + @override + void execute() { + final match = _gameState.currentList.firstWhereOrNull( + (element) => element.id == noteId, + ); + if (match is NoteRow) { + match.setLink(stateAccess, linkedId, standeeNr); + } + } + + @override + String describe() { + return commandL10n.cmdLinkNoteRow; + } +} diff --git a/server/lib/core/commands/set_note_row_text_command.dart b/server/lib/core/commands/set_note_row_text_command.dart new file mode 100644 index 0000000..2b53cb9 --- /dev/null +++ b/server/lib/core/commands/set_note_row_text_command.dart @@ -0,0 +1,27 @@ +import 'package:collection/collection.dart'; + +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class SetNoteRowTextCommand extends Command { + SetNoteRowTextCommand(this.text, this.noteId, {required GameState gameState}) + : _gameState = gameState; + final String text; + final String noteId; + final GameState _gameState; + + @override + void execute() { + final match = _gameState.currentList.firstWhereOrNull( + (element) => element.id == noteId, + ); + if (match is NoteRow) { + match.setText(stateAccess, text); + } + } + + @override + String describe() { + return commandL10n.cmdSetNoteRowText; + } +} diff --git a/server/lib/core/commands/set_scenario_command.dart b/server/lib/core/commands/set_scenario_command.dart new file mode 100644 index 0000000..56485eb --- /dev/null +++ b/server/lib/core/commands/set_scenario_command.dart @@ -0,0 +1,26 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class SetScenarioCommand extends Command { + final String _scenario; + final bool _section; + + SetScenarioCommand( + this._scenario, + this._section, { + required GameState gameState, + }); + + @override + void execute() { + ScenarioMethods.setScenario(stateAccess, _scenario, _section); + } + + @override + String describe() { + if (!_section) { + return commandL10n.cmdSetScenario; + } + return commandL10n.cmdAddSection; + } +} diff --git a/server/lib/core/commands/set_solo_command.dart b/server/lib/core/commands/set_solo_command.dart new file mode 100644 index 0000000..c2714b8 --- /dev/null +++ b/server/lib/core/commands/set_solo_command.dart @@ -0,0 +1,22 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class SetSoloCommand extends Command { + SetSoloCommand(this.solo); + + bool solo; + + @override + void execute() { + ScenarioMethods.setSolo(stateAccess, solo); + ScenarioMethods.applyDifficulty(stateAccess); + } + + @override + String describe() { + if (solo) { + return commandL10n.cmdSetSoloOn; + } + return commandL10n.cmdSetSoloOff; + } +} diff --git a/server/lib/core/commands/show_ally_deck_command.dart b/server/lib/core/commands/show_ally_deck_command.dart new file mode 100644 index 0000000..074d640 --- /dev/null +++ b/server/lib/core/commands/show_ally_deck_command.dart @@ -0,0 +1,16 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class ShowAllyDeckCommand extends Command { + ShowAllyDeckCommand(); + + @override + void execute() { + MonsterMethods.showAllyDeck(stateAccess); + } + + @override + String describe() { + return commandL10n.cmdShowAllyDeck; + } +} diff --git a/server/lib/core/commands/shuffle_ability_card_command.dart b/server/lib/core/commands/shuffle_ability_card_command.dart new file mode 100644 index 0000000..8acd082 --- /dev/null +++ b/server/lib/core/commands/shuffle_ability_card_command.dart @@ -0,0 +1,26 @@ +import 'package:collection/collection.dart'; + +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class ShuffleAbilityCardCommand extends Command { + final String ownerId; + ShuffleAbilityCardCommand(this.ownerId); + + @override + void execute() { + final Monster? monster = GameMethods.getCurrentMonsters().firstWhereOrNull( + (element) => element.id == ownerId, + ); + if (monster == null) return; + final MonsterAbilityState? deck = GameMethods.getDeck(monster.type.deck); + if (deck == null) return; + deck.shuffle(stateAccess); + } + + @override + String describe() { + return commandL10n.cmdExtraAbilityShuffle; + } +} diff --git a/server/lib/core/commands/shuffle_amd_card_command.dart b/server/lib/core/commands/shuffle_amd_card_command.dart new file mode 100644 index 0000000..5eabd3c --- /dev/null +++ b/server/lib/core/commands/shuffle_amd_card_command.dart @@ -0,0 +1,22 @@ +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class ShuffleAMDCardCommand extends Command { + final String name; + final GameState _gameState; + + ShuffleAMDCardCommand(this.name, {required GameState gameState}) + : _gameState = gameState; + + @override + void execute() { + final deck = GameMethods.getModifierDeck(name, _gameState); + deck.shuffleUnDrawn(stateAccess); + } + + @override + String describe() { + return commandL10n.cmdExtraAmdShuffle; + } +} diff --git a/server/lib/core/commands/shuffle_drawn_ability_card_command.dart b/server/lib/core/commands/shuffle_drawn_ability_card_command.dart new file mode 100644 index 0000000..795b9b4 --- /dev/null +++ b/server/lib/core/commands/shuffle_drawn_ability_card_command.dart @@ -0,0 +1,26 @@ +import 'package:collection/collection.dart'; + +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class ShuffleDrawnAbilityCardCommand extends Command { + final String deck; + ShuffleDrawnAbilityCardCommand(this.deck); + + @override + void execute() { + Monster? monster = GameMethods.getCurrentMonsters().firstWhereOrNull( + (element) => element.type.deck == deck, + ); + if (monster != null) { + MonsterAbilityState? deck = GameMethods.getDeck(monster.type.deck); + deck?.shuffleUnDrawn(stateAccess); + } + } + + @override + String describe() { + return commandL10n.cmdDrawnAbilityShuffle; + } +} diff --git a/server/lib/core/commands/track_standees_command.dart b/server/lib/core/commands/track_standees_command.dart new file mode 100644 index 0000000..6ca8211 --- /dev/null +++ b/server/lib/core/commands/track_standees_command.dart @@ -0,0 +1,48 @@ +import '../settings.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class TrackStandeesCommand extends Command { + final GameState _gameState; + final Settings _settings; + final bool track; + + TrackStandeesCommand( + this.track, { + required GameState gameState, + required Settings settings, + }) : _gameState = gameState, + _settings = settings; + + @override + void execute() { + _settings.noStandees = !track; + _handleNoStandeesSettingChange(); + } + + @override + String describe() { + if (!track) { + return commandL10n.cmdDontTrackStandees; + } + return commandL10n.cmdTrackStandees; + } + + void _handleNoStandeesSettingChange() { + if (_settings.noStandees) { + for (final item in _gameState.currentList) { + if (item is Monster) { + item.clearMonsterInstances(stateAccess); + item.notifyMonsterInstances(stateAccess); + } + } + } else { + for (final item in _gameState.currentList) { + if (item is Monster && item.isActive) { + item.setActive(stateAccess, false); + } + } + } + _gameState.notifyListeners(); + } +} diff --git a/server/lib/core/commands/turn_done_command.dart b/server/lib/core/commands/turn_done_command.dart new file mode 100644 index 0000000..d9c756a --- /dev/null +++ b/server/lib/core/commands/turn_done_command.dart @@ -0,0 +1,34 @@ +import '../game_event.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class TurnDoneCommand extends Command { + int index = 0; + final String id; + final GameState _gameState; + + TurnDoneCommand(this.id, {required GameState gameState}) + : _gameState = gameState { + index = 0; + for (int i = 0; i < _gameState.currentList.length; i++) { + if (id == _gameState.currentList[i].id) { + index = i; + break; + } + } + } + + @override + void execute() { + RoundMethods.setTurnDone(stateAccess, index); + _gameState.notifyListeners(); + } + + @override + GameEvent get event => TurnDoneEvent(id); + + @override + String describe() { + return commandL10n.cmdTurnDone(id); + } +} diff --git a/server/lib/core/commands/unlock_special_command.dart b/server/lib/core/commands/unlock_special_command.dart new file mode 100644 index 0000000..546b7ff --- /dev/null +++ b/server/lib/core/commands/unlock_special_command.dart @@ -0,0 +1,32 @@ +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class UnlockSpecialCommand extends Command { + final GameState _gameState; + final String _id; + bool _unlock = true; + + UnlockSpecialCommand(this._id, {required GameState gameState}) + : _gameState = gameState; + + @override + void execute() { + if (_gameState.unlockedClasses.contains(_id)) { + _unlock = false; + ScenarioMethods.clearUnlockedClass(stateAccess, _id); + } else { + ScenarioMethods.unlockClass(stateAccess, _id); + } + } + + @override + void onUndo(); + + @override + String describe() { + if (_unlock) { + return commandL10n.cmdUnlock(_id); + } + return commandL10n.cmdLock(_id); + } +} diff --git a/server/lib/core/commands/use_element_command.dart b/server/lib/core/commands/use_element_command.dart new file mode 100644 index 0000000..5183106 --- /dev/null +++ b/server/lib/core/commands/use_element_command.dart @@ -0,0 +1,21 @@ +import '../enums.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class UseElementCommand extends Command { + final Elements element; + final GameState? _gameState; + + UseElementCommand(this.element, {GameState? gameState}) + : _gameState = gameState; + + @override + void execute() { + ElementMethods.useElement(stateAccess, element, gameState: _gameState); + } + + @override + String describe() { + return commandL10n.cmdUseElement(element.name); + } +} diff --git a/server/lib/core/commands/use_fh_perks_command.dart b/server/lib/core/commands/use_fh_perks_command.dart new file mode 100644 index 0000000..8200ae7 --- /dev/null +++ b/server/lib/core/commands/use_fh_perks_command.dart @@ -0,0 +1,28 @@ +import '../game_methods.dart'; +import '../state/game_state.dart'; +import 'command_l10n.dart'; + +class UseFHPerksCommand extends Command { + final String characterId; + + UseFHPerksCommand(this.characterId); + + @override + void execute() { + Character? character = GameMethods.getCharacterByName(characterId); + if (character != null) { + character.flipUseFHPerks(stateAccess); + } + } + + @override + String describe() { + Character? character = GameMethods.getCharacterByName(characterId); + final charId = character?.id ?? characterId; + final use = character?.characterState.useFHPerks ?? false; + if (use) { + return commandL10n.cmdUseFhPerks(charId); + } + return commandL10n.cmdDontUseFhPerks(charId); + } +} diff --git a/server/lib/core/enums.dart b/server/lib/core/enums.dart new file mode 100644 index 0000000..590f825 --- /dev/null +++ b/server/lib/core/enums.dart @@ -0,0 +1,120 @@ +import 'package:collection/collection.dart'; +import 'package:x_haven_server/core/state/game_state.dart'; + +import 'game_methods.dart'; + +enum Style { + frosthaven, + gloomhaven, + original, +} // ignore: prefer-match-file-name, file contains multiple shared enums + +enum Condition { + stun, + immobilize, + disarm, + wound, + wound2, + muddle, + poison, + poison2, + poison3, + poison4, + bane, + brittle, + chill, + infect, + impair, + rupture, + plague, + strengthen, + invisible, + regenerate, + ward, + dodge, + safeguard, + + shield, + retaliate, + + character1, + character2, + character3, + character4; + + static const int _kChar1Index = 0; + static const int _kChar2Index = 1; + static const int _kChar3Index = 2; + static const int _kChar4Index = 3; + + String _getCharacterName(int index) { + List<Character> characters = GameMethods.getCurrentCharacters(); + characters.sortBy((element) => element.characterClass.name); + if (characters.length > index) { + return characters[index].characterClass.name; + } + + return "Escort"; //some basic + } + + String getName() { + //get current characters, sort by name and add to this + if (this == Condition.character1) { + return _getCharacterName(_kChar1Index); + } else if (this == Condition.character2) { + return _getCharacterName(_kChar2Index); + } else if (this == Condition.character3) { + return _getCharacterName(_kChar3Index); + } else if (this == Condition.character4) { + return _getCharacterName(_kChar4Index); + } + + return name; + } + + @override + String toString() { + return index.toString(); + } +} + +enum ElementState { full, half, inert } + +enum Elements { fire, ice, air, earth, light, dark } + +enum RoundState { chooseInitiative, playTurns } + +enum ListItemState { + chooseInitiative, //gray + waitingTurn, //hopeful + myTurn, //conditions reminder (above in list is gray) + doneTurn, //gray, expire conditions +} + +enum MonsterType { normal, elite, boss, summon } + +enum TurnsState { + notDone, //if got condition while in this state or from earlier round: remove at end of current + current, //mark conditions added here to not be removed yet + done, //mark conditions added here to not be removed yet +} + +enum NetworkMessage { init, action, undo, redo } + +/// Escalating tiers of display power saving. Each tier is a superset of the +/// previous one in how much battery it saves and how much it gets in the way. +enum PowerMode { + /// Screen held awake at full brightness for as long as the app is open. + normal, + + /// Screen still held awake — the app never locks and you never lose your + /// place — but after a period with no input the app dims itself. Sits + /// between [normal] and [reducePower]: saves real power on OLED without + /// handing the display over to the system Auto-Lock timer. + dimWhenIdle, + + /// Releases the wakelock so the system dims and sleeps the display on its + /// own schedule, and lowers the cost of shadows, image filtering and + /// looping text animations. + reducePower, +} diff --git a/server/lib/core/game_actions.dart b/server/lib/core/game_actions.dart new file mode 100644 index 0000000..25bbf0f --- /dev/null +++ b/server/lib/core/game_actions.dart @@ -0,0 +1,55 @@ +import 'package:x_haven_server/core/commands/draw_command.dart'; +import 'package:x_haven_server/core/commands/next_round_command.dart'; +import 'package:x_haven_server/core/enums.dart'; +import 'package:x_haven_server/core/game_data.dart'; +import 'package:x_haven_server/core/game_methods.dart'; +import 'package:x_haven_server/core/settings.dart'; +import 'package:x_haven_server/core/state/game_state.dart'; +import 'package:x_haven_server/core/service_locator.dart'; + +class DrawOrNextRoundResult { + // ignore: prefer-match-file-name, file contains multiple game action types + const DrawOrNextRoundResult._({this.blockedMessage}); + + final String? blockedMessage; + + bool get isBlocked => blockedMessage != null; + + static const success = DrawOrNextRoundResult._(); + + static DrawOrNextRoundResult blocked(String message) { + return DrawOrNextRoundResult._(blockedMessage: message); + } +} + +DrawOrNextRoundResult runDrawOrNextRoundAction( + GameState gameState, { + GameData? gameData, + Settings? settings, +}) { + if (gameState.roundState == RoundState.chooseInitiative) { + if (GameMethods.canDraw()) { + gameState.action(DrawCommand(gameState: gameState)); + return DrawOrNextRoundResult.success; + } + + if (gameState.currentList.isEmpty) { + return DrawOrNextRoundResult.blocked( + 'Add characters first from the side menu (tap the hamburger icon to open)', + ); + } + + return DrawOrNextRoundResult.blocked( + 'Player initiative numbers must be set (tap the character icon or under the initiative marker to the right of it)', + ); + } + + gameState.action( + NextRoundCommand( + gameState: gameState, + gameData: gameData ?? getIt<GameData>(), + settings: settings ?? getIt<Settings>(), + ), + ); + return DrawOrNextRoundResult.success; +} diff --git a/server/lib/core/game_data.dart b/server/lib/core/game_data.dart new file mode 100644 index 0000000..65b4c59 --- /dev/null +++ b/server/lib/core/game_data.dart @@ -0,0 +1,85 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:logging/logging.dart'; +import 'package:path/path.dart' as p; + +import 'models/campaign.dart'; +import 'models/room.dart'; +import 'models/summon_model.dart'; + +final _log = Logger('GameData'); + +/// Loads and caches the campaign/monster/ability/scenario data. +/// +/// Port of the reference app's `GameData`: same structure, but data is read +/// from disk ([root] is a directory path, e.g. `assets/data/` or +/// `assets/testData/`) instead of Flutter's asset bundle. +class GameData { + late List<String> editions; + Map<String, CampaignModel> modelData = {}; //todo: make map immutable + List<SummonModel> itemSummonData = []; + + Future<void> loadData(String root) async { + //load loose summons + final String response = File( + p.join(root, 'summons.json'), + ).readAsStringSync(); + final data = await json.decode(response); + + if (data.containsKey('summons')) { + final summons = data['summons'] as Map<dynamic, dynamic>; + List<SummonModel> summonModels = []; + for (String key in summons.keys) { + summonModels.add(SummonModel.fromJson(summons[key], key)); + } + itemSummonData = summonModels; + } + + Map<String, CampaignModel> map = {}; + + final String editionsJson = File( + p.join(root, 'editions', 'editions.json'), + ).readAsStringSync(); + final Map<String, dynamic> editionData = await json.decode(editionsJson); + List<String> editionList = []; + for (String item in editionData["editions"]) { + editionList.add(item); + + List<RoomsModel> roomData = []; + final roomDataResult = await fetchRoomData(item, root); + if (roomDataResult != null) roomData.addAll(roomDataResult.roomData); + + await fetchCampaignData(item, root, map, roomData); + } + this.editions = editionList; + + modelData = map; + } + + Future<EditionRoomsModel?> fetchRoomData(String campaign, String root) async { + try { + final String response = File( + p.join(root, 'rooms', '$campaign.json'), + ).readAsStringSync(); + final data = await json.decode(response); + return EditionRoomsModel.fromJson(data); + } catch (error) { + _log.warning('fetchRoomData($campaign) failed: $error'); + return null; + } + } + + Future<void> fetchCampaignData( + String campaign, + String root, + Map<String, CampaignModel> map, + List<RoomsModel> roomsData, + ) async { + final String response = File( + p.join(root, 'editions', '$campaign.json'), + ).readAsStringSync(); + final data = await json.decode(response); + map[campaign] = CampaignModel.fromJson(data, roomsData); + } +} diff --git a/server/lib/core/game_event.dart b/server/lib/core/game_event.dart new file mode 100644 index 0000000..a3c9a79 --- /dev/null +++ b/server/lib/core/game_event.dart @@ -0,0 +1,99 @@ +import 'dart:convert'; + +/// A typed, machine-readable signal describing what transition just occurred. +/// +/// Produced by [Command.event], stored in [ActionHandler.lastEvent], and +/// transmitted alongside every game-state snapshot so that both local and +/// network clients can trigger animations from the same code path. +sealed class GameEvent { + const GameEvent(); + + Map<String, dynamic> toJson(); + + String toJsonString() => json.encode(toJson()); + + static GameEvent fromJson(Map<String, dynamic> data) { + switch (data['type'] as String? ?? '') { + case 'lootCardDrawn': + return const LootCardDrawnEvent(); + case 'modifierCardDrawn': + return ModifierCardDrawnEvent(data['deck'] as String? ?? ''); + case 'healthChanged': + return HealthChangedEvent( + data['figureId'] as String? ?? '', + data['ownerId'] as String? ?? '', + data['change'] as int? ?? 0, + ); + case 'turnDone': + return TurnDoneEvent(data['id'] as String? ?? ''); + default: + return const NoEvent(); + } + } + + static GameEvent fromJsonString(String jsonString) { + try { + return fromJson(json.decode(jsonString) as Map<String, dynamic>); + } catch (_) { + return const NoEvent(); + } + } +} + +/// Default: no UI transition to signal. +class NoEvent extends GameEvent { + const NoEvent(); + + @override + Map<String, dynamic> toJson() => {'type': 'none'}; +} + +/// A loot card was drawn from the draw pile to the discard pile. +class LootCardDrawnEvent extends GameEvent { + const LootCardDrawnEvent(); + + @override + Map<String, dynamic> toJson() => {'type': 'lootCardDrawn'}; +} + +/// A modifier card was drawn for the named deck. +/// [deckName] is empty for the monster modifier deck. +class ModifierCardDrawnEvent extends GameEvent { + const ModifierCardDrawnEvent(this.deckName); + + final String deckName; + + @override + Map<String, dynamic> toJson() => { + 'type': 'modifierCardDrawn', + 'deck': deckName, + }; +} + +/// A figure's health changed. [change] is positive for healing, negative for damage. +/// [ownerId] is empty when [figureId] directly identifies the list item (character case). +class HealthChangedEvent extends GameEvent { + const HealthChangedEvent(this.figureId, this.ownerId, this.change); + + final String figureId; + final String ownerId; + final int change; + + @override + Map<String, dynamic> toJson() => { + 'type': 'healthChanged', + 'figureId': figureId, + 'ownerId': ownerId, + 'change': change, + }; +} + +/// A figure's turn was marked as done. +class TurnDoneEvent extends GameEvent { + const TurnDoneEvent(this.id); + + final String id; + + @override + Map<String, dynamic> toJson() => {'type': 'turnDone', 'id': id}; +} diff --git a/server/lib/core/game_methods.dart b/server/lib/core/game_methods.dart new file mode 100644 index 0000000..cf43ab7 --- /dev/null +++ b/server/lib/core/game_methods.dart @@ -0,0 +1,687 @@ +import 'dart:math'; + +import 'package:collection/collection.dart'; +import 'package:x_haven_server/core/models/character_class.dart'; +import 'package:x_haven_server/core/models/monster.dart'; +import 'package:x_haven_server/core/service_locator.dart'; +import 'package:x_haven_server/core/settings.dart'; +import 'package:x_haven_server/core/state/game_state.dart'; + +import 'enums.dart'; + +class GameMethods { + static const int _kTrapBase = 2; + static const int _kHazardHalveDivisor = 2; + static const double _kHazardLevelDivisor = 3.0; + static const int _kXPBase = 4; + static const int _kXPMultiplier = 2; + static const int _kCoinMaxLevel = 7; + static const int _kCoinMaxValue = 6; + static const int _kCoinBase = 2; + static const double _kCoinLevelDivisor = 2.0; + static const double _kLevelDivisor = 2.0; + static const int _kInactiveInitiative = 99; + static const int _kPerkPairCount = 2; + static const int _kPolarBearStandees = 4; + static const int _kMaxOGSoloScenario = 100; + + static int getTrapValue({GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + return _kTrapBase + gs.level; + } + + static int getHazardValue({GameState? gameState, Settings? settings}) { + final gs = gameState ?? getIt<GameState>(); + final s = settings ?? getIt<Settings>(); + if (isOgGloomEdition(gameState: gs) && !s.fhHazTerrainCalcInOGGloom) { + return (getTrapValue(gameState: gs) / _kHazardHalveDivisor).floor(); + } + + return 1 + (gs.level / _kHazardLevelDivisor).ceil(); + } + + static int getXPValue({GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + return _kXPBase + _kXPMultiplier * gs.level; + } + + static int getCoinValue({GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + int level = gs.level; + if (level == _kCoinMaxLevel) { + return _kCoinMaxValue; + } + + return _kCoinBase + (level / _kCoinLevelDivisor).floor(); + } + + static int getRecommendedLevel({GameState? gameState}) { + double totalLevels = 0; + double nrOfCharacters = 0; + final gs = gameState ?? getIt<GameState>(); + for (final item in gs.currentList) { + if (item is Character && + !GameMethods.isObjectiveOrEscort(item.characterClass)) { + totalLevels += item.characterState.level; + nrOfCharacters++; + } + } + if (nrOfCharacters == 0) { + return 1; + } + if (gs.solo) { + //Take the average level of all characters in the + // scenario, then add 1 before dividing by 2 and rounding + // up. + return ((totalLevels / nrOfCharacters + 1.0) / _kLevelDivisor).ceil(); + } + //scenario level is equal to + //the average level of the characters divided by 2 + //(rounded up) + + return (totalLevels / nrOfCharacters / _kLevelDivisor).ceil(); + } + + static bool canDraw({GameState? gameState, Settings? settings}) { + final gs = gameState ?? getIt<GameState>(); + if (gs.currentList.isEmpty) { + return false; + } + if ((settings ?? getIt<Settings>()).noInit) { + return true; + } + for (final item in gs.currentList) { + if (item is Character) { + if (item.characterState.initiative == 0) { + if (item.characterState.health > 0) { + return false; + } + } + } + } + + return true; + } + + static bool isInactiveForRule(String monsterId, {GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + final rule = gs.scenarioSpecialRules.firstWhereOrNull( + (rule) => rule.type == "InactiveMonster" && rule.name == monsterId, + ); + if (rule != null && rule.list.contains(gs.round)) { + return true; + } + return false; + } + + static MonsterAbilityState? getDeck(String name, {GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + for (MonsterAbilityState deck in gs.currentAbilityDecks) { + if (deck.name == name) { + return deck; + } + } + + return null; + } + + static int getInitiative(ListItemData item, {GameState? gameState}) { + if (item is Character) { + return item.characterState.initiative; + } else if (item is Monster) { + if (!item.isActive) { + return _kInactiveInitiative; //sorted last + } + final gs = gameState ?? getIt<GameState>(); + for (final deck in gs.currentAbilityDecks) { + if (deck.name == item.type.deck) { + if (deck.discardPileIsNotEmpty) { + return deck.discardPileTop.initiative; + } + } + } + } + return 0; + } + + static Character? getCharacterByName(String name, {GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + for (ListItemData data in gs.currentList) { + if (data is Character) { + if (data.id == name) { + return data; + } + } + } + return null; + } + + static List<Character> getCurrentCharacters({GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + return getCurrentCharactersForState(gs); + } + + static List<Character> getCurrentCharactersForState(GameState state) { + List<Character> characters = []; + for (ListItemData data in state.currentList) { + if (data is Character && + !GameMethods.isObjectiveOrEscort(data.characterClass)) { + characters.add(data); + } + } + + return characters; + } + + static Character? getCurrentCharacter({GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + for (final item in gs.currentList) { + if (item.turnState == TurnsState.current) { + if (item is Character) { + if (!GameMethods.isObjectiveOrEscort(item.characterClass)) { + return item; + } + } + } + } + return null; + } + + static ModifierDeck getModifierDeck(final String id, GameState state) { + if (id == "allies") { + return state.modifierDeckAllies; + } + if (id.isNotEmpty) { + final characters = GameMethods.getCurrentCharactersForState(state); + for (final character in characters) { + if (character.id == id) { + return character.characterState.modifierDeck; + } + } + } + + return state.modifierDeck; + } + + static bool canAddPerk(Character character, int index) { + final deck = character.characterState.modifierDeck; + final perksFH = character.characterClass.perksFH; + final useFHPerks = + character.characterState.useFHPerks && perksFH.isNotEmpty; + final perks = useFHPerks ? perksFH : character.characterClass.perks; + final perk = perks[index]; + for (final item in perk.remove) { + if (!deck.hasCard(item)) { + //check for perk cards in the deck with same id + + int otherPerkCardAdded = 0; + //find missing card from perk list + for (int i = 0; i < perks.length; i++) { + //check if other perk added the card previously + if (character.characterState.perkList[i]) { + for (final card in perks[i].add) { + if (card == item) { + otherPerkCardAdded++; + } + } + //this only for specific perk cards + if (item.startsWith("perks/")) { + for (final card in perks[i].remove) { + if (card == item) { + otherPerkCardAdded--; + } + } + } + } + } + return otherPerkCardAdded > 0; + } + } + return true; + } + + static bool canRemovePerk(Character character, int index) { + final deck = character.characterState.modifierDeck; + final perksFH = character.characterClass.perksFH; + final useFHPerks = + character.characterState.useFHPerks && perksFH.isNotEmpty; + final perks = useFHPerks ? perksFH : character.characterClass.perks; + final perk = perks[index]; + + for (final item in perk.add) { + if (item.startsWith("perks/")) { + String id = "P$index"; + if (perk.add.length >= _kPerkPairCount && item == perk.add.last) { + id += "-2"; + } + if (deck.hasCard(id)) { + return true; + } + } + if (!deck.hasCard(item)) { + return false; + } + } + return true; + } + + static String perkGfxIdToCardId(String gfx, PerkModel perk, int index) { + if (gfx.startsWith("perks/")) { + String id = "P$index"; + if (perk.add.length >= _kPerkPairCount && gfx == perk.add.last) { + id += "-2"; + } + return id; + } + return gfx; + } + + static int getCurrentCharacterAmount({GameState? gameState}) { + int res = 0; + final gs = gameState ?? getIt<GameState>(); + for (ListItemData data in gs.currentList) { + if (data is Character) { + if (!GameMethods.isObjectiveOrEscort(data.characterClass)) { + res++; + } + } + } + + return res; + } + + static List<Monster> getCurrentMonsters({GameState? gameState}) { + List<Monster> monsters = []; + final gs = gameState ?? getIt<GameState>(); + for (ListItemData data in gs.currentList) { + if (data is Monster) { + monsters.add(data); + } + } + + return monsters; + } + + static int getNextAvailableBnBStandee(Monster data, {GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + int nrOfStandees = data.type.count; + for (int i = 0; i < nrOfStandees; i++) { + bool isAvailable = true; + for (final item in data.monsterInstances) { + if (item.standeeNr == i + 1) { + isAvailable = false; + break; + } + } + + if (isAvailable) { + //check for other monsters with same standees + for (final item in gs.currentList) { + if (item is Monster) { + if (item.id != data.id) { + for (final standee in item.monsterInstances) { + if (standee.standeeNr == i + 1) { + isAvailable = false; + break; + } + } + } + } + if (!isAvailable) { + break; + } + } + } + if (isAvailable) { + return i + 1; + } + } + return 0; + } + + static int getRandomStandee(Monster data, {GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + int nrOfStandees = data.type.count; + if (data.type.name == "Polar Bear") { + nrOfStandees = + _kPolarBearStandees; //for the special case where there are only 4 standees in first printing + } + List<int> available = []; + for (int i = 0; i < nrOfStandees; i++) { + bool isAvailable = true; + for (final item in data.monsterInstances) { + if (item.standeeNr == i + 1) { + isAvailable = false; + break; + } + } + if (isAvailable) { + //check for special monsters with same standees + for (final item in gs.currentList) { + if (item is Monster) { + if (item.id != data.id) { + if (item.type.gfx == data.type.gfx) { + for (final standee in item.monsterInstances) { + if (standee.standeeNr == i + 1) { + isAvailable = false; + break; + } + } + } + } + } + if (!isAvailable) { + break; + } + } + } + if (isAvailable) { + available.add(i + 1); + } + } + + //in case we run out of standees... + if (available.isEmpty) { + return 0; + } + return available[Random().nextInt(available.length)]; + } + + static FigureState? getFigure( + String? ownerId, + String figureId, { + GameState? gameState, + }) { + final gs = gameState ?? getIt<GameState>(); + for (final item in gs.currentList) { + if (item.id == figureId) { + return (item as Character).characterState; + } + if (item.id == ownerId) { + if (item is Monster) { + for (final instance in item.monsterInstances) { + String id = + instance.name + instance.gfx + instance.standeeNr.toString(); + if (id == figureId) { + return instance; + } + } + } else if (item is Character) { + for (final instance in item.characterState.summonList) { + String id = + instance.name + instance.gfx + instance.standeeNr.toString(); + if (id == figureId) { + return instance; + } + } + } + } + } + return null; + } + + static String getFigureIdFromNr( + String ownerId, + int nr, { + GameState? gameState, + }) { + final gs = gameState ?? getIt<GameState>(); + for (final item in gs.currentList) { + if (item.id == ownerId) { + if (item is Monster) { + for (final instance in item.monsterInstances) { + if (instance.standeeNr == nr) { + return instance.name + + instance.gfx + + instance.standeeNr.toString(); + } + } + } + } + } + return ""; + } + + static bool isObjectiveOrEscort(CharacterClass character) { + return character.id == "Escort" || character.id == "Objective"; + } + + static bool shouldShowAlliesDeck({GameState? gameState, Settings? settings}) { + final gs = gameState ?? getIt<GameState>(); + if (!(settings ?? getIt<Settings>()).showAmdDeck) { + return false; + } + if (gs.showAllyDeck) { + return true; + } + if (!gs.allyDeckInOGGloom && isOgGloomEdition(gameState: gs)) { + return false; + } + for (final item in gs.currentList) { + if (item is Monster) { + if (item.isAlly) { + return true; + } + } + } + return false; + } + + static bool canExpire(Condition condition) { + if ( + //don't remove bane because user need to remember to remove 10hp as well + condition == Condition.strengthen || + condition == Condition.stun || + condition == Condition.immobilize || + condition == Condition.muddle || + condition == Condition.invisible || + condition == Condition.disarm || + condition == Condition.chill || + condition == Condition.impair) { + return true; + } + return false; + } + + static bool isFrosthavenStyledEdition( + String edition, { + GameState? gameState, + }) { + final gs = gameState ?? getIt<GameState>(); + String scenario = gs.scenario; + if (edition == "Solo") { + if (scenario.contains("${"#19"} ")) { + return false; //this is forgotten circles + } + //#100+ are og solo scenarios + for (int i = 1; i <= _kMaxOGSoloScenario; i++) { + if (scenario.contains("${"#$i"} ")) { + return true; + } + } + return false; + } + return edition == "Frosthaven" || + edition == "Buttons and Bugs" || + edition == "Gloomhaven 2nd Edition" || + edition == "Skulls in the Snow" || + edition == "Mercenary Packs"; + } + + static bool summonDoesNotDie(String? ownerId, String id) { + //exempt special summons that should not be removed at 0 + if (ownerId == "Glacial Torrent" && id == "Glacier") { + return true; + } else if (ownerId == "D.O.M.E." && id == "Barrier") { + return true; + } + return false; + } + + static bool isFrosthavenStyle( + MonsterModel? monster, { + GameState? gameState, + Settings? settings, + }) { + final gs = gameState ?? getIt<GameState>(); + //frosthaven monster + final monsterFrostHavenStyledEdition = + monster != null && + isFrosthavenStyledEdition(monster.edition, gameState: gs); + if (monsterFrostHavenStyledEdition) { + return true; + } + final style = (settings ?? getIt<Settings>()).style; + //frosthaven monsters in other campaigns + if (monster != null) { + if (style != Style.frosthaven && !monsterFrostHavenStyledEdition) { + return false; + } + } + //frosthaven style settings + return style == Style.frosthaven || + style == Style.original && + isFrosthavenStyledEdition(gs.currentCampaign, gameState: gs); + } + + static bool isCustomCampaign(String campaign) { + if (campaign == "Crimson Scales") { + return true; + } + if (campaign == "Trail of Ashes") { + return true; + } + if (campaign == "CCUG") { + return true; + } + return false; + } + + static int? findNrFromScenarioName(String scenario) { + String nr = scenario.substring(1); + for (int i = 0; i < nr.length; i++) { + if (nr[i] == ' ' || nr[i] == ".") { + nr = nr.substring(0, i); + return int.tryParse(nr); + } + } + + return null; + } + + static bool isOgGloomEdition({GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + return !isFrosthavenStyledEdition(gs.currentCampaign, gameState: gs); + } + + static bool hasLootDeck({GameState? gameState, Settings? settings}) { + final gs = gameState ?? getIt<GameState>(); + bool hasLootDeck = !(settings ?? getIt<Settings>()).hideLootDeck; + if (gs.lootDeck.discardPileIsEmpty && gs.lootDeck.drawPileIsEmpty) { + hasLootDeck = false; + } + return hasLootDeck; + } + + static List<ModifierCard> getFactionCards(String faction) { + List<ModifierCard> retVal = []; + if (faction == "Demons") { + retVal.add(ModifierCard(CardType.add, "Demons-perks/plus1any")); + retVal.add( + ModifierCard(CardType.add, "Demons-perks/plus1retaliate1flip"), + ); + retVal.add(ModifierCard(CardType.add, "Demons-perks/plus0wardallyflip")); + retVal.add(ModifierCard(CardType.add, "Demons-perks/unique/fuck3")); + } else if (faction == "Merchant-Guild") { + retVal.add(ModifierCard(CardType.add, "Merchant-Guild-perks/plus1curse")); + retVal.add(ModifierCard(CardType.add, "Merchant-Guild-perks/plus1wound")); + retVal.add( + ModifierCard(CardType.add, "Merchant-Guild-perks/plus0heal2flip"), + ); + retVal.add( + ModifierCard(CardType.add, "Merchant-Guild-perks/unique/fuck2"), + ); + } else if (faction == "Military") { + retVal.add( + ModifierCard(CardType.add, "Military-perks/plus1strengthenally"), + ); + retVal.add(ModifierCard(CardType.add, "Military-perks/plus1shield1flip")); + retVal.add(ModifierCard(CardType.add, "Military-perks/plus1push2flip")); + retVal.add(ModifierCard(CardType.add, "Military-perks/unique/fuck1")); + } + return retVal; + } + + static bool isCardInAnyCharacterDeck(String gfx, {GameState? gameState}) { + final characters = getCurrentCharacters(gameState: gameState); + for (final item in characters) { + if (item.characterState.modifierDeck.hasCard(gfx)) { + return true; + } + } + return false; + } + + static bool hasRetaliate( + Monster monster, + MonsterInstance figure, { + GameState? gameState, + }) { + return _monsterHasConditionOnCards( + monster, + figure, + "%retaliate%", + gameState: gameState, + ); + } + + static bool hasShield( + Monster monster, + MonsterInstance figure, { + GameState? gameState, + }) { + return _monsterHasConditionOnCards( + monster, + figure, + "%shield%", + gameState: gameState, + ); + } + + static bool _monsterHasConditionOnCards( + Monster monster, + MonsterInstance figure, + String condition, { + GameState? gameState, + }) { + bool hasCondition = false; + //check innate value + + final level = monster.type.levels[monster.level]; + if (figure.type == MonsterType.normal) { + hasCondition = + level.normal?.attributes.indexWhere((i) => i.contains(condition)) != + -1; + } else if (figure.type == MonsterType.elite) { + hasCondition = + level.elite?.attributes.indexWhere((i) => i.contains(condition)) != + -1; + } else if (figure.type == MonsterType.boss) { + hasCondition = + level.boss?.attributes.indexWhere((i) => i.contains(condition)) != -1; + } + //check ability card + final deck = GameMethods.getDeck(monster.type.deck, gameState: gameState); + if (deck != null && + deck.discardPileIsNotEmpty && + monster.turnState != TurnsState.notDone) { + if (deck.discardPileTop.lines.firstWhereOrNull( + (item) => item.contains(condition), + ) != + null) { + return true; + } + } + return hasCondition; + } +} diff --git a/server/lib/core/l10n/app_localizations.dart b/server/lib/core/l10n/app_localizations.dart new file mode 100644 index 0000000..dbf62a4 --- /dev/null +++ b/server/lib/core/l10n/app_localizations.dart @@ -0,0 +1,2049 @@ +import 'package:intl/intl.dart' as intl; + +import 'app_localizations_de.dart'; +import 'app_localizations_en.dart'; +import 'app_localizations_es.dart'; +import 'app_localizations_fr.dart'; +import 'app_localizations_ko.dart'; +import 'app_localizations_pl.dart'; +import 'app_localizations_ru.dart'; +import 'app_localizations_th.dart'; +import 'app_localizations_zh.dart'; + +// ignore_for_file: type=lint + +/// Minimal pure-Dart replacement for `dart:ui`'s `Locale` +/// (see PORTING.md, section 5). +class Locale { + const Locale(this.languageCode, [this.countryCode]); + + final String languageCode; + final String? countryCode; + + @override + String toString() => + countryCode == null ? languageCode : '$languageCode-$countryCode'; +} + +/// Localized app strings, ported from the reference app's generated +/// `app_localizations.dart`. +/// +/// Look up the strings for a locale with [lookupAppLocalizations]. +abstract class AppLocalizations { + AppLocalizations(String locale) + : localeName = intl.Intl.canonicalizedLocale(locale.toString()); + + final String localeName; + + /// A list of supported locales. + static const List<Locale> supportedLocales = <Locale>[ + Locale('de'), + Locale('en'), + Locale('es'), + Locale('fr'), + Locale('ko'), + Locale('pl'), + Locale('ru'), + Locale('th'), + Locale('zh'), + ]; + + /// No description provided for @menuSetScenario. + /// + /// In en, this message translates to: + /// **'Set Scenario'** + String get menuSetScenario; + + /// No description provided for @menuAddCharacter. + /// + /// In en, this message translates to: + /// **'Add Character'** + String get menuAddCharacter; + + /// No description provided for @menuRemoveCharacters. + /// + /// In en, this message translates to: + /// **'Remove Characters'** + String get menuRemoveCharacters; + + /// No description provided for @menuSetLevel. + /// + /// In en, this message translates to: + /// **'Set Level'** + String get menuSetLevel; + + /// No description provided for @menuLootDeck. + /// + /// In en, this message translates to: + /// **'Loot Deck Menu'** + String get menuLootDeck; + + /// No description provided for @menuAddMonsters. + /// + /// In en, this message translates to: + /// **'Add Monsters'** + String get menuAddMonsters; + + /// No description provided for @menuRemoveMonsters. + /// + /// In en, this message translates to: + /// **'Remove Monsters'** + String get menuRemoveMonsters; + + /// No description provided for @menuShowAllyDeck. + /// + /// In en, this message translates to: + /// **'Show Ally Attack Modifier Deck'** + String get menuShowAllyDeck; + + /// No description provided for @menuHideAllyDeck. + /// + /// In en, this message translates to: + /// **'Hide Ally Attack Modifier Deck'** + String get menuHideAllyDeck; + + /// No description provided for @menuSettings. + /// + /// In en, this message translates to: + /// **'Settings'** + String get menuSettings; + + /// No description provided for @menuDocumentation. + /// + /// In en, this message translates to: + /// **'Documentation'** + String get menuDocumentation; + + /// No description provided for @menuDonate. + /// + /// In en, this message translates to: + /// **'Donate'** + String get menuDonate; + + /// No description provided for @menuExit. + /// + /// In en, this message translates to: + /// **'Exit'** + String get menuExit; + + /// No description provided for @menuAddSection. + /// + /// In en, this message translates to: + /// **'Add Section'** + String get menuAddSection; + + /// No description provided for @menuAddRandomDungeonCard. + /// + /// In en, this message translates to: + /// **'Add Random Dungeon Card'** + String get menuAddRandomDungeonCard; + + /// No description provided for @menuActionLog. + /// + /// In en, this message translates to: + /// **'View Action Log'** + String get menuActionLog; + + /// No description provided for @actionLogTitle. + /// + /// In en, this message translates to: + /// **'Last 20 Actions'** + String get actionLogTitle; + + /// No description provided for @actionLogEmpty. + /// + /// In en, this message translates to: + /// **'No actions yet'** + String get actionLogEmpty; + + /// No description provided for @actionLogRollbackHint. + /// + /// In en, this message translates to: + /// **'Tap an action to roll back to it'** + String get actionLogRollbackHint; + + /// No description provided for @actionLogRollbackTitle. + /// + /// In en, this message translates to: + /// **'Roll back?'** + String get actionLogRollbackTitle; + + /// No description provided for @actionLogRollbackBody. + /// + /// In en, this message translates to: + /// **'Undo back to \"{action}\"? This reverses {count} later action(s). You can redo them until you make a change.'** + String actionLogRollbackBody(String action, int count); + + /// No description provided for @actionLogRollbackConfirm. + /// + /// In en, this message translates to: + /// **'Roll back'** + String get actionLogRollbackConfirm; + + /// No description provided for @menuAddNoteRow. + /// + /// In en, this message translates to: + /// **'Add Note Row'** + String get menuAddNoteRow; + + /// No description provided for @noteRowTitle. + /// + /// In en, this message translates to: + /// **'Note'** + String get noteRowTitle; + + /// No description provided for @noteRowHint. + /// + /// In en, this message translates to: + /// **'Note text…'** + String get noteRowHint; + + /// No description provided for @noteRowColourLabel. + /// + /// In en, this message translates to: + /// **'Colour'** + String get noteRowColourLabel; + + /// No description provided for @noteRowConnectLabel. + /// + /// In en, this message translates to: + /// **'Connect to:'** + String get noteRowConnectLabel; + + /// No description provided for @noteRowConnectNone. + /// + /// In en, this message translates to: + /// **'Nothing (free note)'** + String get noteRowConnectNone; + + /// No description provided for @noteRowConnectPlayer. + /// + /// In en, this message translates to: + /// **'Player'** + String get noteRowConnectPlayer; + + /// No description provided for @noteRowConnectMonster. + /// + /// In en, this message translates to: + /// **'Monster'** + String get noteRowConnectMonster; + + /// No description provided for @noteRowWholeGroup. + /// + /// In en, this message translates to: + /// **'Whole group'** + String get noteRowWholeGroup; + + /// No description provided for @noteRowAll. + /// + /// In en, this message translates to: + /// **'All'** + String get noteRowAll; + + /// No description provided for @noteRowStandeeNr. + /// + /// In en, this message translates to: + /// **'Standee {nr}'** + String noteRowStandeeNr(int nr); + + /// No description provided for @noteRowAddFromMenu. + /// + /// In en, this message translates to: + /// **'Add note'** + String get noteRowAddFromMenu; + + /// No description provided for @noteRowDelete. + /// + /// In en, this message translates to: + /// **'Delete note'** + String get noteRowDelete; + + /// No description provided for @undo. + /// + /// In en, this message translates to: + /// **'Undo'** + String get undo; + + /// No description provided for @undoWithDescription. + /// + /// In en, this message translates to: + /// **'Undo: {description}'** + String undoWithDescription(String description); + + /// No description provided for @redo. + /// + /// In en, this message translates to: + /// **'Redo'** + String get redo; + + /// No description provided for @redoWithDescription. + /// + /// In en, this message translates to: + /// **'Redo: {description}'** + String redoWithDescription(String description); + + /// No description provided for @versionLabel. + /// + /// In en, this message translates to: + /// **'Version {version}'** + String versionLabel(String version); + + /// No description provided for @connectedAsClient. + /// + /// In en, this message translates to: + /// **'Connected as Client'** + String get connectedAsClient; + + /// No description provided for @connecting. + /// + /// In en, this message translates to: + /// **'Connecting...'** + String get connecting; + + /// No description provided for @cancelConnect. + /// + /// In en, this message translates to: + /// **'Cancel'** + String get cancelConnect; + + /// No description provided for @connectionCancelled. + /// + /// In en, this message translates to: + /// **'Connection cancelled'** + String get connectionCancelled; + + /// No description provided for @connectAsClientWithIp. + /// + /// In en, this message translates to: + /// **'Connect as Client ({ip})'** + String connectAsClientWithIp(String ip); + + /// No description provided for @connectAsClientLabel. + /// + /// In en, this message translates to: + /// **'Connect as Client'** + String get connectAsClientLabel; + + /// No description provided for @stopServerWithIp. + /// + /// In en, this message translates to: + /// **'Stop Server {ip}'** + String stopServerWithIp(String ip); + + /// No description provided for @startHostServerWithIp. + /// + /// In en, this message translates to: + /// **'Start Host Server {ip}'** + String startHostServerWithIp(String ip); + + /// No description provided for @stopServerButton. + /// + /// In en, this message translates to: + /// **'Stop Server'** + String get stopServerButton; + + /// No description provided for @startHostServerButton. + /// + /// In en, this message translates to: + /// **'Start Host Server'** + String get startHostServerButton; + + /// No description provided for @networkConnectLocal. + /// + /// In en, this message translates to: + /// **'Connect devices on local wifi:'** + String get networkConnectLocal; + + /// No description provided for @networkServerIpHint. + /// + /// In en, this message translates to: + /// **'server ip address'** + String get networkServerIpHint; + + /// No description provided for @networkPortHint. + /// + /// In en, this message translates to: + /// **'port'** + String get networkPortHint; + + /// No description provided for @settingsLanguage. + /// + /// In en, this message translates to: + /// **'Language:'** + String get settingsLanguage; + + /// No description provided for @settingsDarkMode. + /// + /// In en, this message translates to: + /// **'Dark mode'** + String get settingsDarkMode; + + /// No description provided for @settingsSoftNumpad. + /// + /// In en, this message translates to: + /// **'Soft numpad for input'** + String get settingsSoftNumpad; + + /// No description provided for @settingsNoInit. + /// + /// In en, this message translates to: + /// **'Don\'t ask for initiative'** + String get settingsNoInit; + + /// No description provided for @settingsExpireConditions. + /// + /// In en, this message translates to: + /// **'Expire Conditions'** + String get settingsExpireConditions; + + /// No description provided for @settingsNoStandees. + /// + /// In en, this message translates to: + /// **'Don\'t track Standees'** + String get settingsNoStandees; + + /// No description provided for @settingsAutoAddStandees. + /// + /// In en, this message translates to: + /// **'Auto Add Standees'** + String get settingsAutoAddStandees; + + /// No description provided for @settingsAutoAddSpawns. + /// + /// In en, this message translates to: + /// **'Auto Add Timed Spawns'** + String get settingsAutoAddSpawns; + + /// No description provided for @settingsRandomStandees. + /// + /// In en, this message translates to: + /// **'Random Standees'** + String get settingsRandomStandees; + + /// No description provided for @settingsNoCalculations. + /// + /// In en, this message translates to: + /// **'No Calculations'** + String get settingsNoCalculations; + + /// No description provided for @settingsHideLootDeck. + /// + /// In en, this message translates to: + /// **'Hide Loot Deck'** + String get settingsHideLootDeck; + + /// No description provided for @settingsShimmer. + /// + /// In en, this message translates to: + /// **'Stat card text shimmers'** + String get settingsShimmer; + + /// No description provided for @settingsPowerModeLabel. + /// + /// In en, this message translates to: + /// **'Power saving'** + String get settingsPowerModeLabel; + + /// No description provided for @powerModeNormal. + /// + /// In en, this message translates to: + /// **'Normal'** + String get powerModeNormal; + + /// No description provided for @powerModeDimWhenIdle. + /// + /// In en, this message translates to: + /// **'Dim when idle'** + String get powerModeDimWhenIdle; + + /// No description provided for @settingsPowerModeInfoTitle. + /// + /// In en, this message translates to: + /// **'Power saving'** + String get settingsPowerModeInfoTitle; + + /// No description provided for @settingsPowerModeInfo. + /// + /// In en, this message translates to: + /// **'Three levels of battery saving, from none to most.\n\nNormal — the screen is held awake at full brightness for as long as the app is open. Nothing is dimmed and nothing sleeps. Best while you are actively playing.\n\nDim when idle — the screen is still held awake and the app never locks, but after 30 seconds without input the board dims. The board stays readable from across the table, and a single tap brings it straight back with nothing lost. Good for a game in progress that you glance at between turns.\n\nReduce power use — hands the screen back to your device, so it dims and turns off on its own schedule and you unlock to return. Also lowers drawing quality to save more: card and monster box shadows become hard-edged instead of softly blurred, icons are filtered more cheaply, and shimmering text effects are turned off. Best for infrequent use and low battery capacity devices.\n\nNothing about how the game works changes at any level — no tracking, syncing or rules behaviour is affected.'** + String get settingsPowerModeInfo; + + /// No description provided for @settingsReducePower. + /// + /// In en, this message translates to: + /// **'Reduce power use'** + String get settingsReducePower; + + /// No description provided for @settingsReducePowerInfoTitle. + /// + /// In en, this message translates to: + /// **'Reduce power use'** + String get settingsReducePowerInfoTitle; + + /// No description provided for @settingsReducePowerInfo. + /// + /// In en, this message translates to: + /// **'Saves battery by doing less drawing work, at the cost of some visual polish.\n\nWhat changes:\n\n• The screen is allowed to dim and turn off on its own. Normally this app keeps it awake the whole time it is open, which is by far the biggest drain on a phone or tablet.\n\n• Card and monster box shadows become hard-edged instead of softly blurred.\n\n• Icons are filtered more cheaply. You may notice slightly rougher edges on small images.\n\n• Shimmering text effects are turned off.\n\nNothing about how the game works changes — no tracking, syncing or rules behaviour is affected. You can turn this off again at any time.'** + String get settingsReducePowerInfo; + + /// No description provided for @settingsFhHazTerrainCalc. + /// + /// In en, this message translates to: + /// **'Use Frosthaven Hazardous Terrain Calculation in OG Gloomhaven'** + String get settingsFhHazTerrainCalc; + + /// No description provided for @settingsAllyDeckOGGloom. + /// + /// In en, this message translates to: + /// **'Use Ally Attack Modifier Deck in OG Gloomhaven'** + String get settingsAllyDeckOGGloom; + + /// No description provided for @settingsShowScenarioNames. + /// + /// In en, this message translates to: + /// **'Show Scenario names in list'** + String get settingsShowScenarioNames; + + /// No description provided for @settingsShowBattleGoalReminder. + /// + /// In en, this message translates to: + /// **'Show Battle Goal Reminder'** + String get settingsShowBattleGoalReminder; + + /// No description provided for @settingsShowCustomContent. + /// + /// In en, this message translates to: + /// **'Show Custom Content'** + String get settingsShowCustomContent; + + /// No description provided for @settingsShowSections. + /// + /// In en, this message translates to: + /// **'Show Sections in Main Screen'** + String get settingsShowSections; + + /// No description provided for @settingsShowReminders. + /// + /// In en, this message translates to: + /// **'Show Round Special Rule Reminders'** + String get settingsShowReminders; + + /// No description provided for @settingsShowAmdDeck. + /// + /// In en, this message translates to: + /// **'Show Attack Modifier Decks'** + String get settingsShowAmdDeck; + + /// No description provided for @settingsShowCharacterAmd. + /// + /// In en, this message translates to: + /// **'Show character Attack Modifier Decks'** + String get settingsShowCharacterAmd; + + /// No description provided for @settingsHealthWheel. + /// + /// In en, this message translates to: + /// **'Enable heath wheel: drag left-right to change health'** + String get settingsHealthWheel; + + /// No description provided for @settingsFullscreen. + /// + /// In en, this message translates to: + /// **'Fullscreen'** + String get settingsFullscreen; + + /// No description provided for @settingsMainListScaling. + /// + /// In en, this message translates to: + /// **'Main List Scaling:'** + String get settingsMainListScaling; + + /// No description provided for @settingsAppBarScaling. + /// + /// In en, this message translates to: + /// **'App Bar Scaling:'** + String get settingsAppBarScaling; + + /// No description provided for @settingsStyleLabel. + /// + /// In en, this message translates to: + /// **'Style:'** + String get settingsStyleLabel; + + /// No description provided for @styleFrosthaven. + /// + /// In en, this message translates to: + /// **'Frosthaven'** + String get styleFrosthaven; + + /// No description provided for @styleOriginal. + /// + /// In en, this message translates to: + /// **'Original'** + String get styleOriginal; + + /// No description provided for @settingsClearUnlocked. + /// + /// In en, this message translates to: + /// **'Clear unlocked characters and stuff'** + String get settingsClearUnlocked; + + /// No description provided for @settingsUnlockSpecials. + /// + /// In en, this message translates to: + /// **'Unlock specials'** + String get settingsUnlockSpecials; + + /// No description provided for @settingsLoadSaveState. + /// + /// In en, this message translates to: + /// **'Load/Save State'** + String get settingsLoadSaveState; + + /// No description provided for @noResultsFound. + /// + /// In en, this message translates to: + /// **'No results found'** + String get noResultsFound; + + /// No description provided for @close. + /// + /// In en, this message translates to: + /// **'Close'** + String get close; + + /// No description provided for @retry. + /// + /// In en, this message translates to: + /// **'RETRY'** + String get retry; + + /// No description provided for @specialUnlocks. + /// + /// In en, this message translates to: + /// **'Special Unlocks'** + String get specialUnlocks; + + /// No description provided for @loadSaveDeleteCharacters. + /// + /// In en, this message translates to: + /// **'Load, Save or Delete Characters.'** + String get loadSaveDeleteCharacters; + + /// No description provided for @loadAddDeleteSaves. + /// + /// In en, this message translates to: + /// **'Load, Add or Delete save states.'** + String get loadAddDeleteSaves; + + /// No description provided for @addNewSave. + /// + /// In en, this message translates to: + /// **'Add new Save'** + String get addNewSave; + + /// No description provided for @addNewSaveLabel. + /// + /// In en, this message translates to: + /// **'Add new Save:'** + String get addNewSaveLabel; + + /// No description provided for @loadButton. + /// + /// In en, this message translates to: + /// **'Load'** + String get loadButton; + + /// No description provided for @saveButton. + /// + /// In en, this message translates to: + /// **'Save'** + String get saveButton; + + /// No description provided for @deleteButton. + /// + /// In en, this message translates to: + /// **'Delete'** + String get deleteButton; + + /// No description provided for @setSaveName. + /// + /// In en, this message translates to: + /// **'Set save name:'** + String get setSaveName; + + /// No description provided for @loadOrSaveCharacters. + /// + /// In en, this message translates to: + /// **'Load or Save Characters'** + String get loadOrSaveCharacters; + + /// No description provided for @loadCharacter. + /// + /// In en, this message translates to: + /// **'Load Character:'** + String get loadCharacter; + + /// No description provided for @removeAll. + /// + /// In en, this message translates to: + /// **'Remove All'** + String get removeAll; + + /// No description provided for @removeCardQuestion. + /// + /// In en, this message translates to: + /// **'Remove card?'** + String get removeCardQuestion; + + /// No description provided for @sendToBottom. + /// + /// In en, this message translates to: + /// **'Send to Bottom'** + String get sendToBottom; + + /// No description provided for @shuffleUndrawnCards. + /// + /// In en, this message translates to: + /// **'Shuffle un-drawn Cards'** + String get shuffleUndrawnCards; + + /// No description provided for @returnToDiscardPile. + /// + /// In en, this message translates to: + /// **'Return card to discard pile'** + String get returnToDiscardPile; + + /// No description provided for @returnToDrawPile. + /// + /// In en, this message translates to: + /// **'Return card to draw pile'** + String get returnToDrawPile; + + /// No description provided for @addExtraLootCard. + /// + /// In en, this message translates to: + /// **'Add Extra Loot Card'** + String get addExtraLootCard; + + /// No description provided for @addStandeeNr. + /// + /// In en, this message translates to: + /// **'Add Standee Nr'** + String get addStandeeNr; + + /// No description provided for @summonedLabel. + /// + /// In en, this message translates to: + /// **'Summoned:'** + String get summonedLabel; + + /// No description provided for @characterDecks. + /// + /// In en, this message translates to: + /// **'Character Decks'** + String get characterDecks; + + /// No description provided for @shuffleAndDraw. + /// + /// In en, this message translates to: + /// **'Shuffle\n& Draw'** + String get shuffleAndDraw; + + /// No description provided for @draw. + /// + /// In en, this message translates to: + /// **'Draw'** + String get draw; + + /// No description provided for @nextRound. + /// + /// In en, this message translates to: + /// **' Next\nRound'** + String get nextRound; + + /// No description provided for @returnTopCard. + /// + /// In en, this message translates to: + /// **'Return top card'** + String get returnTopCard; + + /// No description provided for @removeCardWithDetails. + /// + /// In en, this message translates to: + /// **'Remove {title}\n(card nr: {nr})'** + String removeCardWithDetails(String title, int nr); + + /// No description provided for @tapCardToAddToDeck. + /// + /// In en, this message translates to: + /// **'Tap Card to add to your deck'** + String get tapCardToAddToDeck; + + /// No description provided for @removeCardFromDeckQuestion. + /// + /// In en, this message translates to: + /// **'Remove card from your deck?'** + String get removeCardFromDeckQuestion; + + /// No description provided for @changeName. + /// + /// In en, this message translates to: + /// **'Change name:'** + String get changeName; + + /// No description provided for @showBosses. + /// + /// In en, this message translates to: + /// **'Show Bosses'** + String get showBosses; + + /// No description provided for @showScenarioSpecialMonsters. + /// + /// In en, this message translates to: + /// **'Show Scenario Special Monsters'** + String get showScenarioSpecialMonsters; + + /// No description provided for @addAsAlly. + /// + /// In en, this message translates to: + /// **'Add as Ally'** + String get addAsAlly; + + /// No description provided for @addMonsterLabel. + /// + /// In en, this message translates to: + /// **'Add Monster'** + String get addMonsterLabel; + + /// No description provided for @allCampaigns. + /// + /// In en, this message translates to: + /// **'All Campaigns'** + String get allCampaigns; + + /// No description provided for @showMonstersFrom. + /// + /// In en, this message translates to: + /// **' Show monsters from: '** + String get showMonstersFrom; + + /// No description provided for @setMonsterLevel. + /// + /// In en, this message translates to: + /// **'Set {name}\'s level'** + String setMonsterLevel(String name); + + /// No description provided for @setSummonHealth. + /// + /// In en, this message translates to: + /// **'Set {name}\'s max health'** + String setSummonHealth(String name); + + /// No description provided for @setScenarioLevel. + /// + /// In en, this message translates to: + /// **'Set Scenario Level'** + String get setScenarioLevel; + + /// No description provided for @enhancedLevel. + /// + /// In en, this message translates to: + /// **'Enhanced: {level}'** + String enhancedLevel(String level); + + /// No description provided for @soloLabel. + /// + /// In en, this message translates to: + /// **'Solo:'** + String get soloLabel; + + /// No description provided for @automaticScenarioLevel. + /// + /// In en, this message translates to: + /// **'Automatic Scenario Level:'** + String get automaticScenarioLevel; + + /// No description provided for @difficultyLabel. + /// + /// In en, this message translates to: + /// **'Difficulty:'** + String get difficultyLabel; + + /// No description provided for @lootCardEnhancements. + /// + /// In en, this message translates to: + /// **'Loot Card Enhancements'** + String get lootCardEnhancements; + + /// No description provided for @addPerks. + /// + /// In en, this message translates to: + /// **'Add Perks'** + String get addPerks; + + /// No description provided for @useFrosthavenPerks. + /// + /// In en, this message translates to: + /// **'Use Frosthaven Perks'** + String get useFrosthavenPerks; + + /// No description provided for @currentCampaign. + /// + /// In en, this message translates to: + /// **'Current Campaign: {campaign}'** + String currentCampaign(String campaign); + + /// No description provided for @addCharacterHint. + /// + /// In en, this message translates to: + /// **'Add Character (type name for hidden character classes)'** + String get addCharacterHint; + + /// No description provided for @trapDamage. + /// + /// In en, this message translates to: + /// **'trap damage'** + String get trapDamage; + + /// No description provided for @hazardousTerrainDamage. + /// + /// In en, this message translates to: + /// **'hazardous terrain damage'** + String get hazardousTerrainDamage; + + /// No description provided for @experienceAdded. + /// + /// In en, this message translates to: + /// **'experience added'** + String get experienceAdded; + + /// No description provided for @goldCoinValue. + /// + /// In en, this message translates to: + /// **'gold coin value'** + String get goldCoinValue; + + /// No description provided for @levelLegendLabel. + /// + /// In en, this message translates to: + /// **'level'** + String get levelLegendLabel; + + /// No description provided for @saveStateNote. + /// + /// In en, this message translates to: + /// **'Please note that the app automatically saves your progress after every action. These are for backups or multiple campaigns.'** + String get saveStateNote; + + /// No description provided for @clientConnectedTo. + /// + /// In en, this message translates to: + /// **'Client Connected to: {address}'** + String clientConnectedTo(String address); + + /// No description provided for @clientError. + /// + /// In en, this message translates to: + /// **'Client error: {error}'** + String clientError(String error); + + /// No description provided for @clientListenError. + /// + /// In en, this message translates to: + /// **'Client listen error: {error}'** + String clientListenError(String error); + + /// No description provided for @lostConnectionToServer. + /// + /// In en, this message translates to: + /// **'Lost connection to server'** + String get lostConnectionToServer; + + /// No description provided for @stateMismatch. + /// + /// In en, this message translates to: + /// **'Your state was not up to date, try again.'** + String get stateMismatch; + + /// No description provided for @serverUnresponsive. + /// + /// In en, this message translates to: + /// **'Server unresponsive. Client disconnected.'** + String get serverUnresponsive; + + /// No description provided for @clientDisconnected. + /// + /// In en, this message translates to: + /// **'client disconnected'** + String get clientDisconnected; + + /// No description provided for @serverOffline. + /// + /// In en, this message translates to: + /// **'Server Offline'** + String get serverOffline; + + /// No description provided for @clientLeft. + /// + /// In en, this message translates to: + /// **'Client left.'** + String get clientLeft; + + /// No description provided for @clientTooOld. + /// + /// In en, this message translates to: + /// **'Old client attempted to connect. Please update the app.'** + String get clientTooOld; + + /// No description provided for @networkConnection. + /// + /// In en, this message translates to: + /// **'Network connection: {status}'** + String networkConnection(String status); + + /// No description provided for @failedToGetWifiIp. + /// + /// In en, this message translates to: + /// **'Failed to get IP address'** + String get failedToGetWifiIp; + + /// No description provided for @badOmen. + /// + /// In en, this message translates to: + /// **'Bad Omen'** + String get badOmen; + + /// No description provided for @badOmensLeft. + /// + /// In en, this message translates to: + /// **'Bad Omens Left: {count}'** + String badOmensLeft(int count); + + /// No description provided for @corrosiveSpew. + /// + /// In en, this message translates to: + /// **'Corrosive Spew'** + String get corrosiveSpew; + + /// No description provided for @empowersOnTop. + /// + /// In en, this message translates to: + /// **'Empowers on top'** + String get empowersOnTop; + + /// No description provided for @addMinusOneCard. + /// + /// In en, this message translates to: + /// **'{direction, select, added{Add -1 card (added: {count})} removed{Add -1 card (removed: {count})} other{Add -1 card ({count})}}'** + String addMinusOneCard(String direction, int count); + + /// No description provided for @removeMinusOneCard. + /// + /// In en, this message translates to: + /// **'Remove -1 card'** + String get removeMinusOneCard; + + /// No description provided for @removeMinusTwoCard. + /// + /// In en, this message translates to: + /// **'Remove -2 card'** + String get removeMinusTwoCard; + + /// No description provided for @minusTwoCardRemoved. + /// + /// In en, this message translates to: + /// **'-2 card removed'** + String get minusTwoCardRemoved; + + /// No description provided for @removePlusZeroCard. + /// + /// In en, this message translates to: + /// **'Remove +0 card'** + String get removePlusZeroCard; + + /// No description provided for @plusZeroCardRemoved. + /// + /// In en, this message translates to: + /// **'+0 card removed'** + String get plusZeroCardRemoved; + + /// No description provided for @removeImbue. + /// + /// In en, this message translates to: + /// **'Remove Imbue'** + String get removeImbue; + + /// No description provided for @imbue. + /// + /// In en, this message translates to: + /// **'Imbue'** + String get imbue; + + /// No description provided for @advancedImbue. + /// + /// In en, this message translates to: + /// **'Advanced Imbue'** + String get advancedImbue; + + /// No description provided for @removeHailPerk. + /// + /// In en, this message translates to: + /// **'Remove Hail Perk'** + String get removeHailPerk; + + /// No description provided for @addHailPerk. + /// + /// In en, this message translates to: + /// **'Add Hail Perk'** + String get addHailPerk; + + /// No description provided for @removeCassandraPerk. + /// + /// In en, this message translates to: + /// **'Remove\nCassandra Perk'** + String get removeCassandraPerk; + + /// No description provided for @addCassandraPerk. + /// + /// In en, this message translates to: + /// **'Add\nCassandra Perk'** + String get addCassandraPerk; + + /// No description provided for @dontSaveRevealedCards. + /// + /// In en, this message translates to: + /// **'Don\'t Save\nRevealed Cards'** + String get dontSaveRevealedCards; + + /// No description provided for @saveRevealedCards. + /// + /// In en, this message translates to: + /// **'Save\nRevealed Cards'** + String get saveRevealedCards; + + /// No description provided for @removedCountLabel. + /// + /// In en, this message translates to: + /// **'Removed: {count}'** + String removedCountLabel(int count); + + /// No description provided for @removeDonation. + /// + /// In en, this message translates to: + /// **'Remove\nDonation'** + String get removeDonation; + + /// No description provided for @donateSanctuary. + /// + /// In en, this message translates to: + /// **'Donate to\nSanctuary'** + String get donateSanctuary; + + /// No description provided for @removePartyCard. + /// + /// In en, this message translates to: + /// **'Remove\nParty Card:'** + String get removePartyCard; + + /// No description provided for @addPartyCard. + /// + /// In en, this message translates to: + /// **'Add Party\nCard:'** + String get addPartyCard; + + /// No description provided for @perks. + /// + /// In en, this message translates to: + /// **'Perks'** + String get perks; + + /// No description provided for @revealCards. + /// + /// In en, this message translates to: + /// **'Reveal\ncards:'** + String get revealCards; + + /// No description provided for @revealAll. + /// + /// In en, this message translates to: + /// **'All'** + String get revealAll; + + /// No description provided for @drawExtraCard. + /// + /// In en, this message translates to: + /// **'Draw extra card'** + String get drawExtraCard; + + /// No description provided for @extraShuffle. + /// + /// In en, this message translates to: + /// **'Extra Shuffle'** + String get extraShuffle; + + /// No description provided for @inactivateMonster. + /// + /// In en, this message translates to: + /// **'Inactivate\nMonster'** + String get inactivateMonster; + + /// No description provided for @activateMonster. + /// + /// In en, this message translates to: + /// **'Activate\nMonster'** + String get activateMonster; + + /// No description provided for @addEliteStandees. + /// + /// In en, this message translates to: + /// **'Add {count} Elite {name}'** + String addEliteStandees(int count, String name); + + /// No description provided for @addNormalStandees. + /// + /// In en, this message translates to: + /// **'Add {count} Normal {name}'** + String addNormalStandees(int count, String name); + + /// No description provided for @characterLoot. + /// + /// In en, this message translates to: + /// **'Character loot'** + String get characterLoot; + + /// No description provided for @addSpecialCard. + /// + /// In en, this message translates to: + /// **'Add card {nr}'** + String addSpecialCard(int nr); + + /// No description provided for @removeSpecialCard. + /// + /// In en, this message translates to: + /// **'Remove card {nr}'** + String removeSpecialCard(int nr); + + /// No description provided for @enhanceCards. + /// + /// In en, this message translates to: + /// **'Enhance cards'** + String get enhanceCards; + + /// No description provided for @addLootCard. + /// + /// In en, this message translates to: + /// **'Add Card'** + String get addLootCard; + + /// No description provided for @returnToTop. + /// + /// In en, this message translates to: + /// **'Return to Top'** + String get returnToTop; + + /// No description provided for @returnToBottom. + /// + /// In en, this message translates to: + /// **'Return to Bottom'** + String get returnToBottom; + + /// No description provided for @characterLootTitle. + /// + /// In en, this message translates to: + /// **'{name}\'s loot:'** + String characterLootTitle(String name); + + /// No description provided for @setLootOwner. + /// + /// In en, this message translates to: + /// **'Set Loot Owner:'** + String get setLootOwner; + + /// No description provided for @lootNameCoin. + /// + /// In en, this message translates to: + /// **'coin'** + String get lootNameCoin; + + /// No description provided for @lootNameHide. + /// + /// In en, this message translates to: + /// **'hide'** + String get lootNameHide; + + /// No description provided for @lootNameLumber. + /// + /// In en, this message translates to: + /// **'lumber'** + String get lootNameLumber; + + /// No description provided for @lootNameMetal. + /// + /// In en, this message translates to: + /// **'metal'** + String get lootNameMetal; + + /// No description provided for @lootNameArrowvine. + /// + /// In en, this message translates to: + /// **'arrowvine'** + String get lootNameArrowvine; + + /// No description provided for @lootNameAxenut. + /// + /// In en, this message translates to: + /// **'axenut'** + String get lootNameAxenut; + + /// No description provided for @lootNameCorpsecap. + /// + /// In en, this message translates to: + /// **'corpsecap'** + String get lootNameCorpsecap; + + /// No description provided for @lootNameFlamefruit. + /// + /// In en, this message translates to: + /// **'flamefruit'** + String get lootNameFlamefruit; + + /// No description provided for @lootNameRockroot. + /// + /// In en, this message translates to: + /// **'rockroot'** + String get lootNameRockroot; + + /// No description provided for @lootNameSnowthistle. + /// + /// In en, this message translates to: + /// **'snowthistle'** + String get lootNameSnowthistle; + + /// No description provided for @lootAmount2For2. + /// + /// In en, this message translates to: + /// **'2 for 2 characters'** + String get lootAmount2For2; + + /// No description provided for @lootAmount2For23. + /// + /// In en, this message translates to: + /// **'2 for 2-3 characters'** + String get lootAmount2For23; + + /// No description provided for @cmdActivateMonster. + /// + /// In en, this message translates to: + /// **'Activate {name}'** + String cmdActivateMonster(String name); + + /// No description provided for @cmdDeactivateMonster. + /// + /// In en, this message translates to: + /// **'Deactivate {name}'** + String cmdDeactivateMonster(String name); + + /// No description provided for @cmdAddCharacter. + /// + /// In en, this message translates to: + /// **'Add {id}'** + String cmdAddCharacter(String id); + + /// No description provided for @cmdAddCondition. + /// + /// In en, this message translates to: + /// **'Add condition: {condition}'** + String cmdAddCondition(String condition); + + /// No description provided for @cmdRemoveCondition. + /// + /// In en, this message translates to: + /// **'Remove condition: {condition}'** + String cmdRemoveCondition(String condition); + + /// No description provided for @cmdAddPartyCard. + /// + /// In en, this message translates to: + /// **'{character} add party card {type}'** + String cmdAddPartyCard(String character, String type); + + /// No description provided for @cmdRemovePartyCard. + /// + /// In en, this message translates to: + /// **'{character} remove party card'** + String cmdRemovePartyCard(String character); + + /// No description provided for @cmdAddFactionCard. + /// + /// In en, this message translates to: + /// **'{character} add faction card'** + String cmdAddFactionCard(String character); + + /// No description provided for @cmdRemoveFactionCard. + /// + /// In en, this message translates to: + /// **'{character} remove faction card'** + String cmdRemoveFactionCard(String character); + + /// No description provided for @cmdAddLootCard. + /// + /// In en, this message translates to: + /// **'Add {type} Loot Card'** + String cmdAddLootCard(String type); + + /// No description provided for @cmdAddMonster. + /// + /// In en, this message translates to: + /// **'Add {name}'** + String cmdAddMonster(String name); + + /// No description provided for @cmdAddSpecialLootCard. + /// + /// In en, this message translates to: + /// **'Add Special loot card {nr}'** + String cmdAddSpecialLootCard(int nr); + + /// No description provided for @cmdRemoveSpecialLootCard. + /// + /// In en, this message translates to: + /// **'Remove Special loot card {nr}'** + String cmdRemoveSpecialLootCard(int nr); + + /// No description provided for @cmdAddMinusOne. + /// + /// In en, this message translates to: + /// **'Add minus one'** + String get cmdAddMinusOne; + + /// No description provided for @cmdRemoveMinusOne. + /// + /// In en, this message translates to: + /// **'Remove minus one'** + String get cmdRemoveMinusOne; + + /// No description provided for @cmdRemoveMinusTwo. + /// + /// In en, this message translates to: + /// **'Remove minus two'** + String get cmdRemoveMinusTwo; + + /// No description provided for @cmdAddBackMinusTwo. + /// + /// In en, this message translates to: + /// **'Add back minus two'** + String get cmdAddBackMinusTwo; + + /// No description provided for @cmdRemovePlusZero. + /// + /// In en, this message translates to: + /// **'Remove plus zero'** + String get cmdRemovePlusZero; + + /// No description provided for @cmdAddBackPlusZero. + /// + /// In en, this message translates to: + /// **'Add back plus zero'** + String get cmdAddBackPlusZero; + + /// No description provided for @cmdRevealModifierCards. + /// + /// In en, this message translates to: + /// **'Reveal {count} modifier cards'** + String cmdRevealModifierCards(int count); + + /// No description provided for @cmdCassandraLeaveRevealed. + /// + /// In en, this message translates to: + /// **'Leave revealed cards on top of {deck} deck'** + String cmdCassandraLeaveRevealed(String deck); + + /// No description provided for @cmdCassandraSpecialOff. + /// + /// In en, this message translates to: + /// **'Cassandra Special turned off for {deck} deck'** + String cmdCassandraSpecialOff(String deck); + + /// No description provided for @cmdImbueMonsterDeck. + /// + /// In en, this message translates to: + /// **'Imbue Monster Deck'** + String get cmdImbueMonsterDeck; + + /// No description provided for @cmdAdvancedImbueMonsterDeck. + /// + /// In en, this message translates to: + /// **'Advanced Imbue Monster Deck'** + String get cmdAdvancedImbueMonsterDeck; + + /// No description provided for @cmdRemoveImbueMonsterDeck. + /// + /// In en, this message translates to: + /// **'Remove Imbuement'** + String get cmdRemoveImbueMonsterDeck; + + /// No description provided for @cmdChangeName. + /// + /// In en, this message translates to: + /// **'Change character name'** + String get cmdChangeName; + + /// No description provided for @cmdAddNoteRow. + /// + /// In en, this message translates to: + /// **'Add note row'** + String get cmdAddNoteRow; + + /// No description provided for @cmdSetNoteRowText. + /// + /// In en, this message translates to: + /// **'Edit note'** + String get cmdSetNoteRowText; + + /// No description provided for @cmdSetNoteRowColor. + /// + /// In en, this message translates to: + /// **'Change note colour'** + String get cmdSetNoteRowColor; + + /// No description provided for @cmdLinkNoteRow. + /// + /// In en, this message translates to: + /// **'Link note row'** + String get cmdLinkNoteRow; + + /// No description provided for @cmdRemoveNoteRow. + /// + /// In en, this message translates to: + /// **'Remove note row'** + String get cmdRemoveNoteRow; + + /// No description provided for @cmdAddBless. + /// + /// In en, this message translates to: + /// **'Add a Bless'** + String get cmdAddBless; + + /// No description provided for @cmdRemoveBless. + /// + /// In en, this message translates to: + /// **'Remove a Bless'** + String get cmdRemoveBless; + + /// No description provided for @cmdAddCurse. + /// + /// In en, this message translates to: + /// **'Add a Curse'** + String get cmdAddCurse; + + /// No description provided for @cmdRemoveCurse. + /// + /// In en, this message translates to: + /// **'Remove a Curse'** + String get cmdRemoveCurse; + + /// No description provided for @cmdAddEmpower. + /// + /// In en, this message translates to: + /// **'Add Empower'** + String get cmdAddEmpower; + + /// No description provided for @cmdRemoveEmpower. + /// + /// In en, this message translates to: + /// **'Remove Empower'** + String get cmdRemoveEmpower; + + /// No description provided for @cmdAddEnfeeble. + /// + /// In en, this message translates to: + /// **'Add Enfeeble'** + String get cmdAddEnfeeble; + + /// No description provided for @cmdRemoveEnfeeble. + /// + /// In en, this message translates to: + /// **'Remove Enfeeble'** + String get cmdRemoveEnfeeble; + + /// No description provided for @cmdIncreaseMaxHealth. + /// + /// In en, this message translates to: + /// **'Increase {owner}\'s max health'** + String cmdIncreaseMaxHealth(String owner); + + /// No description provided for @cmdDecreaseMaxHealth. + /// + /// In en, this message translates to: + /// **'Decrease {owner}\'s max health'** + String cmdDecreaseMaxHealth(String owner); + + /// No description provided for @cmdChangeStat. + /// + /// In en, this message translates to: + /// **'Change stat'** + String get cmdChangeStat; + + /// No description provided for @cmdIncreaseXp. + /// + /// In en, this message translates to: + /// **'Increase {figure}\'s xp by {amount}'** + String cmdIncreaseXp(String figure, int amount); + + /// No description provided for @cmdDecreaseXp. + /// + /// In en, this message translates to: + /// **'Decrease {figure}\'s xp by {amount}'** + String cmdDecreaseXp(String figure, int amount); + + /// No description provided for @cmdClearUnlockedClasses. + /// + /// In en, this message translates to: + /// **'Clear unlocked classes'** + String get cmdClearUnlockedClasses; + + /// No description provided for @cmdDonateSanctuary. + /// + /// In en, this message translates to: + /// **'{character} donate to sanctuary'** + String cmdDonateSanctuary(String character); + + /// No description provided for @cmdRemoveSanctuaryDonation. + /// + /// In en, this message translates to: + /// **'Remove {character}\'s donation'** + String cmdRemoveSanctuaryDonation(String character); + + /// No description provided for @cmdDrawExtraAbilityCard. + /// + /// In en, this message translates to: + /// **'Draw extra ability card'** + String get cmdDrawExtraAbilityCard; + + /// No description provided for @cmdDraw. + /// + /// In en, this message translates to: + /// **'Draw'** + String get cmdDraw; + + /// No description provided for @cmdDrawLootCard. + /// + /// In en, this message translates to: + /// **'Draw loot card'** + String get cmdDrawLootCard; + + /// No description provided for @cmdDrawModifierCard. + /// + /// In en, this message translates to: + /// **'Draw {name} modifier card'** + String cmdDrawModifierCard(String name); + + /// No description provided for @cmdRemoveLootEnhancement. + /// + /// In en, this message translates to: + /// **'Remove Loot Enhancement'** + String get cmdRemoveLootEnhancement; + + /// No description provided for @cmdAddLootEnhancement. + /// + /// In en, this message translates to: + /// **'Add Loot Enhancement'** + String get cmdAddLootEnhancement; + + /// No description provided for @cmdHideAllyDeck. + /// + /// In en, this message translates to: + /// **'Hide Ally Deck'** + String get cmdHideAllyDeck; + + /// No description provided for @cmdShowAllyDeck. + /// + /// In en, this message translates to: + /// **'Show Ally Deck'** + String get cmdShowAllyDeck; + + /// No description provided for @cmdIceWraithTurnNormal. + /// + /// In en, this message translates to: + /// **'Ice Wraith turn normal'** + String get cmdIceWraithTurnNormal; + + /// No description provided for @cmdIceWraithTurnElite. + /// + /// In en, this message translates to: + /// **'Ice Wraith turn elite'** + String get cmdIceWraithTurnElite; + + /// No description provided for @cmdImbueElement. + /// + /// In en, this message translates to: + /// **'Imbue element {element}'** + String cmdImbueElement(String element); + + /// No description provided for @cmdUseElement. + /// + /// In en, this message translates to: + /// **'Use Element {element}'** + String cmdUseElement(String element); + + /// No description provided for @cmdLoadCharacter. + /// + /// In en, this message translates to: + /// **'Load saved character: {name}'** + String cmdLoadCharacter(String name); + + /// No description provided for @cmdLoadGame. + /// + /// In en, this message translates to: + /// **'Load saved game: {name}'** + String cmdLoadGame(String name); + + /// No description provided for @cmdNextRound. + /// + /// In en, this message translates to: + /// **'Next Round'** + String get cmdNextRound; + + /// No description provided for @cmdRemoveAmdCard. + /// + /// In en, this message translates to: + /// **'Remove AMD card'** + String get cmdRemoveAmdCard; + + /// No description provided for @cmdRemoveCard. + /// + /// In en, this message translates to: + /// **'Remove {deck} card nr {nr}'** + String cmdRemoveCard(String deck, int nr); + + /// No description provided for @cmdRemoveAllCharacters. + /// + /// In en, this message translates to: + /// **'Remove all characters'** + String get cmdRemoveAllCharacters; + + /// No description provided for @cmdRemoveCharacter. + /// + /// In en, this message translates to: + /// **'Remove {id}'** + String cmdRemoveCharacter(String id); + + /// No description provided for @cmdRemoveAllMonsters. + /// + /// In en, this message translates to: + /// **'Remove all monsters'** + String get cmdRemoveAllMonsters; + + /// No description provided for @cmdRemoveMonster. + /// + /// In en, this message translates to: + /// **'Remove {name}'** + String cmdRemoveMonster(String name); + + /// No description provided for @cmdReorderAbilityCards. + /// + /// In en, this message translates to: + /// **'Reorder Ability Cards'** + String get cmdReorderAbilityCards; + + /// No description provided for @cmdReorderList. + /// + /// In en, this message translates to: + /// **'Reorder List'** + String get cmdReorderList; + + /// No description provided for @cmdReorderModifierCards. + /// + /// In en, this message translates to: + /// **'Reorder Modifier Cards'** + String get cmdReorderModifierCards; + + /// No description provided for @cmdReturnLootCard. + /// + /// In en, this message translates to: + /// **'Return loot card'** + String get cmdReturnLootCard; + + /// No description provided for @cmdReturnModifierCard. + /// + /// In en, this message translates to: + /// **'Return modifier card to top'** + String get cmdReturnModifierCard; + + /// No description provided for @cmdReturnRemovedAmdCard. + /// + /// In en, this message translates to: + /// **'Return removed AMD card'** + String get cmdReturnRemovedAmdCard; + + /// No description provided for @cmdNoAllyDeckInOgGloom. + /// + /// In en, this message translates to: + /// **'No ally deck in 1st edition Gloomhaven campaigns'** + String get cmdNoAllyDeckInOgGloom; + + /// No description provided for @cmdUseAllyDeckInOgGloom. + /// + /// In en, this message translates to: + /// **'Use Ally Deck in 1st edition Gloomhaven Campaigns'** + String get cmdUseAllyDeckInOgGloom; + + /// No description provided for @cmdMarkAsSummon. + /// + /// In en, this message translates to: + /// **'Mark {owner} as summon'** + String cmdMarkAsSummon(String owner); + + /// No description provided for @cmdRemoveSummonMark. + /// + /// In en, this message translates to: + /// **'Remove {owner}\'s summon mark'** + String cmdRemoveSummonMark(String owner); + + /// No description provided for @cmdAutoLevelOn. + /// + /// In en, this message translates to: + /// **'Turn automatic level update on'** + String get cmdAutoLevelOn; + + /// No description provided for @cmdAutoLevelOff. + /// + /// In en, this message translates to: + /// **'Turn automatic level update off'** + String get cmdAutoLevelOff; + + /// No description provided for @cmdSetCampaign. + /// + /// In en, this message translates to: + /// **'Set {campaign} campaign'** + String cmdSetCampaign(String campaign); + + /// No description provided for @cmdSetCharacterLevel. + /// + /// In en, this message translates to: + /// **'Set {character}\'s Level'** + String cmdSetCharacterLevel(String character); + + /// No description provided for @cmdSetDifficulty. + /// + /// In en, this message translates to: + /// **'Set difficulty level to {difficulty}'** + String cmdSetDifficulty(String difficulty); + + /// No description provided for @cmdSetInitiative. + /// + /// In en, this message translates to: + /// **'Set initiative of {character}'** + String cmdSetInitiative(String character); + + /// No description provided for @cmdSetCharacterNote. + /// + /// In en, this message translates to: + /// **'Set note for {character}'** + String cmdSetCharacterNote(String character); + + /// No description provided for @characterNoteTitle. + /// + /// In en, this message translates to: + /// **'Note'** + String get characterNoteTitle; + + /// No description provided for @characterNoteHint. + /// + /// In en, this message translates to: + /// **'Add a note…'** + String get characterNoteHint; + + /// No description provided for @characterNoteQuickAdd. + /// + /// In en, this message translates to: + /// **'Quick note'** + String get characterNoteQuickAdd; + + /// No description provided for @cmdSetMonsterLevel. + /// + /// In en, this message translates to: + /// **'Set {monster}\'s level'** + String cmdSetMonsterLevel(String monster); + + /// No description provided for @cmdSetLootOwner. + /// + /// In en, this message translates to: + /// **'Set loot card owner'** + String get cmdSetLootOwner; + + /// No description provided for @cmdSetScenario. + /// + /// In en, this message translates to: + /// **'Set Scenario'** + String get cmdSetScenario; + + /// No description provided for @cmdSetSoloOn. + /// + /// In en, this message translates to: + /// **'Set solo level recommendation on'** + String get cmdSetSoloOn; + + /// No description provided for @cmdSetSoloOff. + /// + /// In en, this message translates to: + /// **'Set solo level recommendation off'** + String get cmdSetSoloOff; + + /// No description provided for @cmdExtraAbilityShuffle. + /// + /// In en, this message translates to: + /// **'Extra ability deck shuffle'** + String get cmdExtraAbilityShuffle; + + /// No description provided for @cmdExtraAmdShuffle. + /// + /// In en, this message translates to: + /// **'Extra AMD deck shuffle'** + String get cmdExtraAmdShuffle; + + /// No description provided for @cmdDrawnAbilityShuffle. + /// + /// In en, this message translates to: + /// **'Drawn ability deck shuffle'** + String get cmdDrawnAbilityShuffle; + + /// No description provided for @cmdDontTrackStandees. + /// + /// In en, this message translates to: + /// **'Don\'t track standees'** + String get cmdDontTrackStandees; + + /// No description provided for @cmdTrackStandees. + /// + /// In en, this message translates to: + /// **'Track standees'** + String get cmdTrackStandees; + + /// No description provided for @cmdTurnDone. + /// + /// In en, this message translates to: + /// **'{id}\'s turn done'** + String cmdTurnDone(String id); + + /// No description provided for @cmdAddPerk. + /// + /// In en, this message translates to: + /// **'Add \'{character}\' Perk {index}'** + String cmdAddPerk(String character, int index); + + /// No description provided for @cmdRemovePerk. + /// + /// In en, this message translates to: + /// **'Remove \'{character}\' Perk {index}'** + String cmdRemovePerk(String character, int index); + + /// No description provided for @cmdUnlock. + /// + /// In en, this message translates to: + /// **'Unlock {id}'** + String cmdUnlock(String id); + + /// No description provided for @cmdLock. + /// + /// In en, this message translates to: + /// **'Lock {id}'** + String cmdLock(String id); + + /// No description provided for @cmdSetLevel. + /// + /// In en, this message translates to: + /// **'Set Level'** + String get cmdSetLevel; + + /// No description provided for @cmdAddSection. + /// + /// In en, this message translates to: + /// **'Add Section'** + String get cmdAddSection; + + /// No description provided for @cmdAddStandee. + /// + /// In en, this message translates to: + /// **'Add {name} {nr}'** + String cmdAddStandee(String name, int nr); + + /// No description provided for @cmdDrawMonsterModifierCard. + /// + /// In en, this message translates to: + /// **'Draw monster modifier card'** + String get cmdDrawMonsterModifierCard; + + /// No description provided for @cmdIncreaseHealth. + /// + /// In en, this message translates to: + /// **'Increase {figure}\'s health by {amount}'** + String cmdIncreaseHealth(String figure, int amount); + + /// No description provided for @cmdKill. + /// + /// In en, this message translates to: + /// **'Kill {owner}'** + String cmdKill(String owner); + + /// No description provided for @cmdDecreaseHealth. + /// + /// In en, this message translates to: + /// **'Decrease {owner}\'s health by {amount}'** + String cmdDecreaseHealth(String owner, int amount); + + /// No description provided for @cmdUseFhPerks. + /// + /// In en, this message translates to: + /// **'{character} use Frosthaven Perks'** + String cmdUseFhPerks(String character); + + /// No description provided for @cmdDontUseFhPerks. + /// + /// In en, this message translates to: + /// **'{character} don\'t use Frosthaven Perks'** + String cmdDontUseFhPerks(String character); + + /// No description provided for @cmdRemoveNoCharacters. + /// + /// In en, this message translates to: + /// **'Remove no characters'** + String get cmdRemoveNoCharacters; + + /// No description provided for @cmdRemoveNoMonsters. + /// + /// In en, this message translates to: + /// **'Remove no monsters'** + String get cmdRemoveNoMonsters; +} + +AppLocalizations lookupAppLocalizations(Locale locale) { + // Lookup logic when only language code is specified. + switch (locale.languageCode) { + case 'de': + return AppLocalizationsDe(); + case 'en': + return AppLocalizationsEn(); + case 'es': + return AppLocalizationsEs(); + case 'fr': + return AppLocalizationsFr(); + case 'ko': + return AppLocalizationsKo(); + case 'pl': + return AppLocalizationsPl(); + case 'ru': + return AppLocalizationsRu(); + case 'th': + return AppLocalizationsTh(); + case 'zh': + return AppLocalizationsZh(); + } + + throw UnsupportedError( + 'lookupAppLocalizations failed to load unsupported locale "$locale". This ' + 'is likely an issue with the localizations generation tool. Please file an ' + 'issue on GitHub with a reproducible sample app and the gen-l10n ' + 'configuration that was used.', + ); +} diff --git a/server/lib/core/l10n/app_localizations_de.dart b/server/lib/core/l10n/app_localizations_de.dart new file mode 100644 index 0000000..c864c5d --- /dev/null +++ b/server/lib/core/l10n/app_localizations_de.dart @@ -0,0 +1,1170 @@ +// ignore: unused_import +import 'package:intl/intl.dart' as intl; +import 'app_localizations.dart'; + +// ignore_for_file: type=lint + +/// The translations for German (`de`). +class AppLocalizationsDe extends AppLocalizations { + AppLocalizationsDe([String locale = 'de']) : super(locale); + + @override + String get menuSetScenario => 'Szenario festlegen'; + + @override + String get menuAddCharacter => 'Charakter hinzufügen'; + + @override + String get menuRemoveCharacters => 'Charaktere entfernen'; + + @override + String get menuSetLevel => 'Stufe festlegen'; + + @override + String get menuLootDeck => 'Plünderungsstapel'; + + @override + String get menuAddMonsters => 'Monster hinzufügen'; + + @override + String get menuRemoveMonsters => 'Monster entfernen'; + + @override + String get menuShowAllyDeck => + 'Verbündeten-Angriffsmodifikationsstapel anzeigen'; + + @override + String get menuHideAllyDeck => + 'Verbündeten-Angriffsmodifikationsstapel ausblenden'; + + @override + String get menuSettings => 'Einstellungen'; + + @override + String get menuDocumentation => 'Dokumentation'; + + @override + String get menuDonate => 'Spenden'; + + @override + String get menuExit => 'Beenden'; + + @override + String get menuAddSection => 'Abschnitt hinzufügen'; + + @override + String get menuAddRandomDungeonCard => 'Zufällige Verließkarte hinzufügen'; + + @override + String get menuActionLog => 'Aktionsprotokoll anzeigen'; + + @override + String get actionLogTitle => 'Letzte 20 Aktionen'; + + @override + String get actionLogEmpty => 'Noch keine Aktionen'; + + @override + String get actionLogRollbackHint => + 'Tippe auf eine Aktion, um dorthin zurückzukehren'; + + @override + String get actionLogRollbackTitle => 'Zurücksetzen?'; + + @override + String actionLogRollbackBody(String action, int count) { + return 'Zurück zu \"$action\"? Dies macht $count spätere Aktion(en) rückgängig. Du kannst sie wiederherstellen, bis du etwas änderst.'; + } + + @override + String get actionLogRollbackConfirm => 'Zurücksetzen'; + + @override + String get menuAddNoteRow => 'Notizzeile hinzufügen'; + + @override + String get noteRowTitle => 'Notiz'; + + @override + String get noteRowHint => 'Notiztext…'; + + @override + String get noteRowColourLabel => 'Farbe'; + + @override + String get noteRowConnectLabel => 'Verbinden mit:'; + + @override + String get noteRowConnectNone => 'Nichts (freie Notiz)'; + + @override + String get noteRowConnectPlayer => 'Spieler'; + + @override + String get noteRowConnectMonster => 'Monster'; + + @override + String get noteRowWholeGroup => 'Ganze Gruppe'; + + @override + String get noteRowAll => 'Alle'; + + @override + String noteRowStandeeNr(int nr) { + return 'Aufsteller $nr'; + } + + @override + String get noteRowAddFromMenu => 'Notiz hinzufügen'; + + @override + String get noteRowDelete => 'Notiz löschen'; + + @override + String get undo => 'Rückgängig'; + + @override + String undoWithDescription(String description) { + return 'Rückgängig: $description'; + } + + @override + String get redo => 'Wiederholen'; + + @override + String redoWithDescription(String description) { + return 'Wiederholen: $description'; + } + + @override + String versionLabel(String version) { + return 'Version $version'; + } + + @override + String get connectedAsClient => 'Als Client verbunden'; + + @override + String get connecting => 'Verbinde...'; + + @override + String get cancelConnect => 'Cancel'; + + @override + String get connectionCancelled => 'Connection cancelled'; + + @override + String connectAsClientWithIp(String ip) { + return 'Als Client verbinden ($ip)'; + } + + @override + String get connectAsClientLabel => 'Als Client verbinden'; + + @override + String stopServerWithIp(String ip) { + return 'Server stoppen $ip'; + } + + @override + String startHostServerWithIp(String ip) { + return 'Host-Server starten $ip'; + } + + @override + String get stopServerButton => 'Server stoppen'; + + @override + String get startHostServerButton => 'Host-Server starten'; + + @override + String get networkConnectLocal => 'Geräte im lokalen WLAN verbinden:'; + + @override + String get networkServerIpHint => 'Server-IP-Adresse'; + + @override + String get networkPortHint => 'Port'; + + @override + String get settingsLanguage => 'Sprache:'; + + @override + String get settingsDarkMode => 'Dunkelmodus'; + + @override + String get settingsSoftNumpad => 'Soft-Nummernblock für Eingabe'; + + @override + String get settingsNoInit => 'Nicht nach Initiative fragen'; + + @override + String get settingsExpireConditions => 'Zustände ablaufen lassen'; + + @override + String get settingsNoStandees => 'Figuren nicht verfolgen'; + + @override + String get settingsAutoAddStandees => 'Figuren automatisch hinzufügen'; + + @override + String get settingsAutoAddSpawns => + 'Zeitgesteuerte Spawns automatisch hinzufügen'; + + @override + String get settingsRandomStandees => 'Zufällige Figuren'; + + @override + String get settingsNoCalculations => 'Keine Berechnungen'; + + @override + String get settingsHideLootDeck => 'Plünderungsstapel ausblenden'; + + @override + String get settingsShimmer => 'Statuskartentext schimmern lassen'; + + @override + String get settingsPowerModeLabel => 'Power saving'; + + @override + String get powerModeNormal => 'Normal'; + + @override + String get powerModeDimWhenIdle => 'Dim when idle'; + + @override + String get settingsPowerModeInfoTitle => 'Power saving'; + + @override + String get settingsPowerModeInfo => + 'Three levels of battery saving, from none to most.\n\nNormal — the screen is held awake at full brightness for as long as the app is open. Nothing is dimmed and nothing sleeps. Best while you are actively playing.\n\nDim when idle — the screen is still held awake and the app never locks, but after 30 seconds without input the board dims. The board stays readable from across the table, and a single tap brings it straight back with nothing lost. Good for a game in progress that you glance at between turns.\n\nReduce power use — hands the screen back to your device, so it dims and turns off on its own schedule and you unlock to return. Also lowers drawing quality to save more: card and monster box shadows become hard-edged instead of softly blurred, icons are filtered more cheaply, and shimmering text effects are turned off. Best for infrequent use and low battery capacity devices.\n\nNothing about how the game works changes at any level — no tracking, syncing or rules behaviour is affected.'; + + @override + String get settingsReducePower => 'Reduce power use'; + + @override + String get settingsReducePowerInfoTitle => 'Reduce power use'; + + @override + String get settingsReducePowerInfo => + 'Saves battery by doing less drawing work, at the cost of some visual polish.\n\nWhat changes:\n\n• The screen is allowed to dim and turn off on its own. Normally this app keeps it awake the whole time it is open, which is by far the biggest drain on a phone or tablet.\n\n• Card and monster box shadows become hard-edged instead of softly blurred.\n\n• Icons are filtered more cheaply. You may notice slightly rougher edges on small images.\n\n• Shimmering text effects are turned off.\n\nNothing about how the game works changes — no tracking, syncing or rules behaviour is affected. You can turn this off again at any time.'; + + @override + String get settingsFhHazTerrainCalc => + 'Frosthaven-Gefahrengeländeberechnung in OG Gloomhaven verwenden'; + + @override + String get settingsAllyDeckOGGloom => + 'Verbündeten-Angriffsmodifikationsstapel in OG Gloomhaven verwenden'; + + @override + String get settingsShowScenarioNames => 'Szenarionamen in der Liste anzeigen'; + + @override + String get settingsShowBattleGoalReminder => 'Kampfziel-Erinnerung anzeigen'; + + @override + String get settingsShowCustomContent => 'Benutzerdefinierte Inhalte anzeigen'; + + @override + String get settingsShowSections => + 'Abschnitte auf dem Hauptbildschirm anzeigen'; + + @override + String get settingsShowReminders => + 'Erinnerungen für spezielle Rundenregeln anzeigen'; + + @override + String get settingsShowAmdDeck => 'Angriffsmodifikationsstapel anzeigen'; + + @override + String get settingsShowCharacterAmd => + 'Charakter-Angriffsmodifikationsstapel anzeigen'; + + @override + String get settingsHealthWheel => + 'Lebensrad aktivieren: Links-rechts ziehen zum Ändern'; + + @override + String get settingsFullscreen => 'Vollbild'; + + @override + String get settingsMainListScaling => 'Hauptlisten-Skalierung:'; + + @override + String get settingsAppBarScaling => 'App-Leisten-Skalierung:'; + + @override + String get settingsStyleLabel => 'Stil:'; + + @override + String get styleFrosthaven => 'Frosthaven'; + + @override + String get styleOriginal => 'Original'; + + @override + String get settingsClearUnlocked => + 'Freigeschaltete Charaktere und Inhalte zurücksetzen'; + + @override + String get settingsUnlockSpecials => 'Speziales freischalten'; + + @override + String get settingsLoadSaveState => 'Spielstand laden/speichern'; + + @override + String get noResultsFound => 'Keine Ergebnisse gefunden'; + + @override + String get close => 'Schließen'; + + @override + String get retry => 'WIEDERHOLEN'; + + @override + String get specialUnlocks => 'Spezielle Freischaltungen'; + + @override + String get loadSaveDeleteCharacters => + 'Charaktere laden, speichern oder löschen.'; + + @override + String get loadAddDeleteSaves => + 'Spielstände laden, hinzufügen oder löschen.'; + + @override + String get addNewSave => 'Neuen Spielstand hinzufügen'; + + @override + String get addNewSaveLabel => 'Neuen Spielstand hinzufügen:'; + + @override + String get loadButton => 'Laden'; + + @override + String get saveButton => 'Speichern'; + + @override + String get deleteButton => 'Löschen'; + + @override + String get setSaveName => 'Speichername festlegen:'; + + @override + String get loadOrSaveCharacters => 'Charaktere laden oder speichern'; + + @override + String get loadCharacter => 'Charakter laden:'; + + @override + String get removeAll => 'Alle entfernen'; + + @override + String get removeCardQuestion => 'Karte entfernen?'; + + @override + String get sendToBottom => 'Nach unten senden'; + + @override + String get shuffleUndrawnCards => 'Nicht gezogene Karten mischen'; + + @override + String get returnToDiscardPile => 'Auf den Ablagestapel zurücklegen'; + + @override + String get returnToDrawPile => 'Auf den Zugstapel zurücklegen'; + + @override + String get addExtraLootCard => 'Zusätzliche Plünderungskarte hinzufügen'; + + @override + String get addStandeeNr => 'Figurennummer hinzufügen'; + + @override + String get summonedLabel => 'Herbeigerufen:'; + + @override + String get characterDecks => 'Charakterstapel'; + + @override + String get shuffleAndDraw => 'Mischen\n& Ziehen'; + + @override + String get draw => 'Ziehen'; + + @override + String get nextRound => ' Nächste\nRunde'; + + @override + String get returnTopCard => 'Oberste Karte zurücklegen'; + + @override + String removeCardWithDetails(String title, int nr) { + return '$title entfernen\n(Karten-Nr.: $nr)'; + } + + @override + String get tapCardToAddToDeck => + 'Karte antippen, um sie zum Stapel hinzuzufügen'; + + @override + String get removeCardFromDeckQuestion => 'Karte aus dem Stapel entfernen?'; + + @override + String get changeName => 'Namen ändern:'; + + @override + String get showBosses => 'Bosse anzeigen'; + + @override + String get showScenarioSpecialMonsters => + 'Spezielle Szenariomonster anzeigen'; + + @override + String get addAsAlly => 'Als Verbündeten hinzufügen'; + + @override + String get addMonsterLabel => 'Monster hinzufügen'; + + @override + String get allCampaigns => 'Alle Kampagnen'; + + @override + String get showMonstersFrom => ' Monster anzeigen von: '; + + @override + String setMonsterLevel(String name) { + return 'Stufe von $name festlegen'; + } + + @override + String setSummonHealth(String name) { + return 'Maximale Lebenspunkte von $name festlegen'; + } + + @override + String get setScenarioLevel => 'Szenariostufe festlegen'; + + @override + String enhancedLevel(String level) { + return 'Verbessert: $level'; + } + + @override + String get soloLabel => 'Solo:'; + + @override + String get automaticScenarioLevel => 'Automatische Szenariostufe:'; + + @override + String get difficultyLabel => 'Schwierigkeitsgrad:'; + + @override + String get lootCardEnhancements => 'Plünderungskarten-Verbesserungen'; + + @override + String get addPerks => 'Vorteile hinzufügen'; + + @override + String get useFrosthavenPerks => 'Frosthaven-Vorteile verwenden'; + + @override + String currentCampaign(String campaign) { + return 'Aktuelle Kampagne: $campaign'; + } + + @override + String get addCharacterHint => + 'Charakter hinzufügen (Namen eingeben für versteckte Charakterklassen)'; + + @override + String get trapDamage => 'Fallenschaden'; + + @override + String get hazardousTerrainDamage => 'Gefahrengeländeschaden'; + + @override + String get experienceAdded => 'Erfahrung hinzugefügt'; + + @override + String get goldCoinValue => 'Goldmünzwert'; + + @override + String get levelLegendLabel => 'Stufe'; + + @override + String get saveStateNote => + 'Bitte beachten: Die App speichert deinen Fortschritt automatisch nach jeder Aktion. Diese Spielstände sind für Sicherheitskopien oder mehrere Kampagnen.'; + + @override + String clientConnectedTo(String address) { + return 'Client verbunden mit: $address'; + } + + @override + String clientError(String error) { + return 'Client-Fehler: $error'; + } + + @override + String clientListenError(String error) { + return 'Client-Empfangsfehler: $error'; + } + + @override + String get lostConnectionToServer => 'Verbindung zum Server verloren'; + + @override + String get stateMismatch => + 'Dein Spielstand war nicht aktuell, bitte erneut versuchen.'; + + @override + String get serverUnresponsive => 'Server antwortet nicht. Client getrennt.'; + + @override + String get clientDisconnected => 'Client getrennt'; + + @override + String get serverOffline => 'Server offline'; + + @override + String get clientLeft => 'Client hat die Verbindung getrennt.'; + + @override + String get clientTooOld => + 'Ein veralteter Client hat versucht, sich zu verbinden. Bitte die App aktualisieren.'; + + @override + String networkConnection(String status) { + return 'Netzwerkverbindung: $status'; + } + + @override + String get failedToGetWifiIp => 'IP-Adresse konnte nicht ermittelt werden'; + + @override + String get badOmen => 'Böses Omen'; + + @override + String badOmensLeft(int count) { + return 'Böse Omen übrig: $count'; + } + + @override + String get corrosiveSpew => 'Ätzender Ausstoß'; + + @override + String get empowersOnTop => 'Stärkt oben auf'; + + @override + String addMinusOneCard(String direction, int count) { + String _temp0 = intl.Intl.selectLogic(direction, { + 'added': '-1-Karte hinzufügen (hinzugefügt: $count)', + 'removed': '-1-Karte hinzufügen (entfernt: $count)', + 'other': '-1-Karte ($count)', + }); + return '$_temp0'; + } + + @override + String get removeMinusOneCard => '-1-Karte entfernen'; + + @override + String get removeMinusTwoCard => '-2-Karte entfernen'; + + @override + String get minusTwoCardRemoved => '-2-Karte entfernt'; + + @override + String get removePlusZeroCard => '+0-Karte entfernen'; + + @override + String get plusZeroCardRemoved => '+0-Karte entfernt'; + + @override + String get removeImbue => 'Einbettung entfernen'; + + @override + String get imbue => 'Einbetten'; + + @override + String get advancedImbue => 'Erweiterte Einbettung'; + + @override + String get removeHailPerk => 'Hagel-Vorteil entfernen'; + + @override + String get addHailPerk => 'Hagel-Vorteil hinzufügen'; + + @override + String get removeCassandraPerk => 'Kassandra-\nVorteil entfernen'; + + @override + String get addCassandraPerk => 'Kassandra-\nVorteil hinzufügen'; + + @override + String get dontSaveRevealedCards => 'Aufgedeckte\nKarten nicht speichern'; + + @override + String get saveRevealedCards => 'Aufgedeckte\nKarten speichern'; + + @override + String removedCountLabel(int count) { + return 'Entfernt: $count'; + } + + @override + String get removeDonation => 'Spende\nentfernen'; + + @override + String get donateSanctuary => 'An Heiligtum\nspenden'; + + @override + String get removePartyCard => 'Gruppenkarte\nentfernen:'; + + @override + String get addPartyCard => 'Gruppenkarte\nhinzufügen:'; + + @override + String get perks => 'Vorteile'; + + @override + String get revealCards => 'Karten\naufdecken:'; + + @override + String get revealAll => 'Alle'; + + @override + String get drawExtraCard => 'Zusätzliche Karte ziehen'; + + @override + String get extraShuffle => 'Zusätzlich mischen'; + + @override + String get inactivateMonster => 'Monster\ndeaktivieren'; + + @override + String get activateMonster => 'Monster\naktivieren'; + + @override + String addEliteStandees(int count, String name) { + return '$count Elite $name hinzufügen'; + } + + @override + String addNormalStandees(int count, String name) { + return '$count Normale $name hinzufügen'; + } + + @override + String get characterLoot => 'Charakterausbeute'; + + @override + String addSpecialCard(int nr) { + return 'Karte $nr hinzufügen'; + } + + @override + String removeSpecialCard(int nr) { + return 'Karte $nr entfernen'; + } + + @override + String get enhanceCards => 'Karten verbessern'; + + @override + String get addLootCard => 'Karte hinzufügen'; + + @override + String get returnToTop => 'Nach oben zurücklegen'; + + @override + String get returnToBottom => 'Nach unten zurücklegen'; + + @override + String characterLootTitle(String name) { + return 'Ausbeute von $name:'; + } + + @override + String get setLootOwner => 'Besitzer festlegen:'; + + @override + String get lootNameCoin => 'Münze'; + + @override + String get lootNameHide => 'Fell'; + + @override + String get lootNameLumber => 'Holz'; + + @override + String get lootNameMetal => 'Metall'; + + @override + String get lootNameArrowvine => 'Pfeilranke'; + + @override + String get lootNameAxenut => 'Axtmuss'; + + @override + String get lootNameCorpsecap => 'Leichenpilz'; + + @override + String get lootNameFlamefruit => 'Flammenfrucht'; + + @override + String get lootNameRockroot => 'Felswurzel'; + + @override + String get lootNameSnowthistle => 'Schneendistel'; + + @override + String get lootAmount2For2 => '2 für 2 Spieler'; + + @override + String get lootAmount2For23 => '2 für 2-3 Spieler'; + + @override + String cmdActivateMonster(String name) { + return '$name aktivieren'; + } + + @override + String cmdDeactivateMonster(String name) { + return '$name deaktivieren'; + } + + @override + String cmdAddCharacter(String id) { + return '$id hinzufügen'; + } + + @override + String cmdAddCondition(String condition) { + return 'Zustand hinzufügen: $condition'; + } + + @override + String cmdRemoveCondition(String condition) { + return 'Zustand entfernen: $condition'; + } + + @override + String cmdAddPartyCard(String character, String type) { + return '$character Gruppenk. $type hinzufügen'; + } + + @override + String cmdRemovePartyCard(String character) { + return '$character Gruppenkarte entfernen'; + } + + @override + String cmdAddFactionCard(String character) { + return '$character Fraktionskarte hinzufügen'; + } + + @override + String cmdRemoveFactionCard(String character) { + return '$character Fraktionskarte entfernen'; + } + + @override + String cmdAddLootCard(String type) { + return '$type-Plünderungskarte hinzufügen'; + } + + @override + String cmdAddMonster(String name) { + return '$name hinzufügen'; + } + + @override + String cmdAddSpecialLootCard(int nr) { + return 'Sonderplünderungskarte $nr hinzufügen'; + } + + @override + String cmdRemoveSpecialLootCard(int nr) { + return 'Sonderplünderungskarte $nr entfernen'; + } + + @override + String get cmdAddMinusOne => '-1 hinzufügen'; + + @override + String get cmdRemoveMinusOne => '-1 entfernen'; + + @override + String get cmdRemoveMinusTwo => '-2 entfernen'; + + @override + String get cmdAddBackMinusTwo => '-2 zurücklegen'; + + @override + String get cmdRemovePlusZero => '+0 entfernen'; + + @override + String get cmdAddBackPlusZero => '+0 zurücklegen'; + + @override + String cmdRevealModifierCards(int count) { + return '$count Modifikatorkarten aufdecken'; + } + + @override + String cmdCassandraLeaveRevealed(String deck) { + return 'Aufgedeckte Karten oben auf Stapel $deck lassen'; + } + + @override + String cmdCassandraSpecialOff(String deck) { + return 'Kassandra-Spezial für Stapel $deck deaktiviert'; + } + + @override + String get cmdImbueMonsterDeck => 'Monsterstapel einbetten'; + + @override + String get cmdAdvancedImbueMonsterDeck => 'Monsterstapel erweitert einbetten'; + + @override + String get cmdRemoveImbueMonsterDeck => 'Einbettung entfernen'; + + @override + String get cmdChangeName => 'Charaktername ändern'; + + @override + String get cmdAddNoteRow => 'Notizzeile hinzufügen'; + + @override + String get cmdSetNoteRowText => 'Notiz bearbeiten'; + + @override + String get cmdSetNoteRowColor => 'Notizfarbe ändern'; + + @override + String get cmdLinkNoteRow => 'Notizzeile verknüpfen'; + + @override + String get cmdRemoveNoteRow => 'Notizzeile entfernen'; + + @override + String get cmdAddBless => 'Segen hinzufügen'; + + @override + String get cmdRemoveBless => 'Segen entfernen'; + + @override + String get cmdAddCurse => 'Fluch hinzufügen'; + + @override + String get cmdRemoveCurse => 'Fluch entfernen'; + + @override + String get cmdAddEmpower => 'Stärkung hinzufügen'; + + @override + String get cmdRemoveEmpower => 'Stärkung entfernen'; + + @override + String get cmdAddEnfeeble => 'Schwächung hinzufügen'; + + @override + String get cmdRemoveEnfeeble => 'Schwächung entfernen'; + + @override + String cmdIncreaseMaxHealth(String owner) { + return 'Maximale Lebenspunkte von $owner erhöhen'; + } + + @override + String cmdDecreaseMaxHealth(String owner) { + return 'Maximale Lebenspunkte von $owner verringern'; + } + + @override + String get cmdChangeStat => 'Statuswert ändern'; + + @override + String cmdIncreaseXp(String figure, int amount) { + return 'EP von $figure um $amount erhöhen'; + } + + @override + String cmdDecreaseXp(String figure, int amount) { + return 'EP von $figure um $amount verringern'; + } + + @override + String get cmdClearUnlockedClasses => 'Freigeschaltete Klassen zurücksetzen'; + + @override + String cmdDonateSanctuary(String character) { + return '$character spendet an Heiligtum'; + } + + @override + String cmdRemoveSanctuaryDonation(String character) { + return 'Spende von $character entfernen'; + } + + @override + String get cmdDrawExtraAbilityCard => 'Zusätzliche Fähigkeitskarte ziehen'; + + @override + String get cmdDraw => 'Ziehen'; + + @override + String get cmdDrawLootCard => 'Plünderungskarte ziehen'; + + @override + String cmdDrawModifierCard(String name) { + return '$name-Modifikatorkarte ziehen'; + } + + @override + String get cmdRemoveLootEnhancement => 'Plünderungsverbesserung entfernen'; + + @override + String get cmdAddLootEnhancement => 'Plünderungsverbesserung hinzufügen'; + + @override + String get cmdHideAllyDeck => 'Verbündeten-Stapel ausblenden'; + + @override + String get cmdShowAllyDeck => 'Verbündeten-Stapel anzeigen'; + + @override + String get cmdIceWraithTurnNormal => 'Eisgeist wird normal'; + + @override + String get cmdIceWraithTurnElite => 'Eisgeist wird Elite'; + + @override + String cmdImbueElement(String element) { + return 'Element $element einbetten'; + } + + @override + String cmdUseElement(String element) { + return 'Element $element verbrauchen'; + } + + @override + String cmdLoadCharacter(String name) { + return 'Gespeicherten Charakter laden: $name'; + } + + @override + String cmdLoadGame(String name) { + return 'Gespeichertes Spiel laden: $name'; + } + + @override + String get cmdNextRound => 'Nächste Runde'; + + @override + String get cmdRemoveAmdCard => 'AMD-Karte entfernen'; + + @override + String cmdRemoveCard(String deck, int nr) { + return '$deck-Karte Nr. $nr entfernen'; + } + + @override + String get cmdRemoveAllCharacters => 'Alle Charaktere entfernen'; + + @override + String cmdRemoveCharacter(String id) { + return '$id entfernen'; + } + + @override + String get cmdRemoveAllMonsters => 'Alle Monster entfernen'; + + @override + String cmdRemoveMonster(String name) { + return '$name entfernen'; + } + + @override + String get cmdReorderAbilityCards => 'Fähigkeitskarten neu anordnen'; + + @override + String get cmdReorderList => 'Liste neu anordnen'; + + @override + String get cmdReorderModifierCards => 'Modifikatorkarten neu anordnen'; + + @override + String get cmdReturnLootCard => 'Plünderungskarte zurücklegen'; + + @override + String get cmdReturnModifierCard => 'Modifikatorkarte nach oben zurücklegen'; + + @override + String get cmdReturnRemovedAmdCard => 'Entfernte AMD-Karte zurücklegen'; + + @override + String get cmdNoAllyDeckInOgGloom => + 'Kein Verbündeten-Stapel in 1. Edition Gloomhaven'; + + @override + String get cmdUseAllyDeckInOgGloom => + 'Verbündeten-Stapel in 1. Edition Gloomhaven verwenden'; + + @override + String cmdMarkAsSummon(String owner) { + return '$owner als Beschworenen markieren'; + } + + @override + String cmdRemoveSummonMark(String owner) { + return '$owner\'s Beschwörungsmarkierung entfernen'; + } + + @override + String get cmdAutoLevelOn => 'Automatische Stufenaktualisierung ein'; + + @override + String get cmdAutoLevelOff => 'Automatische Stufenaktualisierung aus'; + + @override + String cmdSetCampaign(String campaign) { + return 'Kampagne $campaign festlegen'; + } + + @override + String cmdSetCharacterLevel(String character) { + return 'Stufe von $character festlegen'; + } + + @override + String cmdSetDifficulty(String difficulty) { + return 'Schwierigkeitsgrad auf $difficulty festlegen'; + } + + @override + String cmdSetInitiative(String character) { + return 'Initiative von $character festlegen'; + } + + @override + String cmdSetCharacterNote(String character) { + return 'Notiz für $character festlegen'; + } + + @override + String get characterNoteTitle => 'Notiz'; + + @override + String get characterNoteHint => 'Notiz hinzufügen…'; + + @override + String get characterNoteQuickAdd => 'Kurznotiz'; + + @override + String cmdSetMonsterLevel(String monster) { + return 'Stufe von $monster festlegen'; + } + + @override + String get cmdSetLootOwner => 'Besitzer der Plünderungskarte festlegen'; + + @override + String get cmdSetScenario => 'Szenario festlegen'; + + @override + String get cmdSetSoloOn => 'Solo-Stufenempfehlung ein'; + + @override + String get cmdSetSoloOff => 'Solo-Stufenempfehlung aus'; + + @override + String get cmdExtraAbilityShuffle => 'Fähigkeitsstapel zusätzlich mischen'; + + @override + String get cmdExtraAmdShuffle => 'AMD-Stapel zusätzlich mischen'; + + @override + String get cmdDrawnAbilityShuffle => 'Gezogenen Fähigkeitsstapel mischen'; + + @override + String get cmdDontTrackStandees => 'Figuren nicht verfolgen'; + + @override + String get cmdTrackStandees => 'Figuren verfolgen'; + + @override + String cmdTurnDone(String id) { + return 'Zug von $id beendet'; + } + + @override + String cmdAddPerk(String character, int index) { + return 'Vorteil $index für \'$character\' hinzufügen'; + } + + @override + String cmdRemovePerk(String character, int index) { + return 'Vorteil $index für \'$character\' entfernen'; + } + + @override + String cmdUnlock(String id) { + return '$id freischalten'; + } + + @override + String cmdLock(String id) { + return '$id sperren'; + } + + @override + String get cmdSetLevel => 'Stufe festlegen'; + + @override + String get cmdAddSection => 'Abschnitt hinzufügen'; + + @override + String cmdAddStandee(String name, int nr) { + return '$name $nr hinzufügen'; + } + + @override + String get cmdDrawMonsterModifierCard => 'Monstertmodifikatorkarte ziehen'; + + @override + String cmdIncreaseHealth(String figure, int amount) { + return 'Lebenspunkte von $figure um $amount erhöhen'; + } + + @override + String cmdKill(String owner) { + return '$owner besiegen'; + } + + @override + String cmdDecreaseHealth(String owner, int amount) { + return 'Lebenspunkte von $owner um $amount verringern'; + } + + @override + String cmdUseFhPerks(String character) { + return '$character verwendet Frosthaven-Vorteile'; + } + + @override + String cmdDontUseFhPerks(String character) { + return '$character verwendet keine Frosthaven-Vorteile'; + } + + @override + String get cmdRemoveNoCharacters => 'Keine Charaktere entfernt'; + + @override + String get cmdRemoveNoMonsters => 'Keine Monster entfernt'; +} diff --git a/server/lib/core/l10n/app_localizations_en.dart b/server/lib/core/l10n/app_localizations_en.dart new file mode 100644 index 0000000..4284221 --- /dev/null +++ b/server/lib/core/l10n/app_localizations_en.dart @@ -0,0 +1,1157 @@ +// ignore: unused_import +import 'package:intl/intl.dart' as intl; +import 'app_localizations.dart'; + +// ignore_for_file: type=lint + +/// The translations for English (`en`). +class AppLocalizationsEn extends AppLocalizations { + AppLocalizationsEn([String locale = 'en']) : super(locale); + + @override + String get menuSetScenario => 'Set Scenario'; + + @override + String get menuAddCharacter => 'Add Character'; + + @override + String get menuRemoveCharacters => 'Remove Characters'; + + @override + String get menuSetLevel => 'Set Level'; + + @override + String get menuLootDeck => 'Loot Deck Menu'; + + @override + String get menuAddMonsters => 'Add Monsters'; + + @override + String get menuRemoveMonsters => 'Remove Monsters'; + + @override + String get menuShowAllyDeck => 'Show Ally Attack Modifier Deck'; + + @override + String get menuHideAllyDeck => 'Hide Ally Attack Modifier Deck'; + + @override + String get menuSettings => 'Settings'; + + @override + String get menuDocumentation => 'Documentation'; + + @override + String get menuDonate => 'Donate'; + + @override + String get menuExit => 'Exit'; + + @override + String get menuAddSection => 'Add Section'; + + @override + String get menuAddRandomDungeonCard => 'Add Random Dungeon Card'; + + @override + String get menuActionLog => 'View Action Log'; + + @override + String get actionLogTitle => 'Last 20 Actions'; + + @override + String get actionLogEmpty => 'No actions yet'; + + @override + String get actionLogRollbackHint => 'Tap an action to roll back to it'; + + @override + String get actionLogRollbackTitle => 'Roll back?'; + + @override + String actionLogRollbackBody(String action, int count) { + return 'Undo back to \"$action\"? This reverses $count later action(s). You can redo them until you make a change.'; + } + + @override + String get actionLogRollbackConfirm => 'Roll back'; + + @override + String get menuAddNoteRow => 'Add Note Row'; + + @override + String get noteRowTitle => 'Note'; + + @override + String get noteRowHint => 'Note text…'; + + @override + String get noteRowColourLabel => 'Colour'; + + @override + String get noteRowConnectLabel => 'Connect to:'; + + @override + String get noteRowConnectNone => 'Nothing (free note)'; + + @override + String get noteRowConnectPlayer => 'Player'; + + @override + String get noteRowConnectMonster => 'Monster'; + + @override + String get noteRowWholeGroup => 'Whole group'; + + @override + String get noteRowAll => 'All'; + + @override + String noteRowStandeeNr(int nr) { + return 'Standee $nr'; + } + + @override + String get noteRowAddFromMenu => 'Add note'; + + @override + String get noteRowDelete => 'Delete note'; + + @override + String get undo => 'Undo'; + + @override + String undoWithDescription(String description) { + return 'Undo: $description'; + } + + @override + String get redo => 'Redo'; + + @override + String redoWithDescription(String description) { + return 'Redo: $description'; + } + + @override + String versionLabel(String version) { + return 'Version $version'; + } + + @override + String get connectedAsClient => 'Connected as Client'; + + @override + String get connecting => 'Connecting...'; + + @override + String get cancelConnect => 'Cancel'; + + @override + String get connectionCancelled => 'Connection cancelled'; + + @override + String connectAsClientWithIp(String ip) { + return 'Connect as Client ($ip)'; + } + + @override + String get connectAsClientLabel => 'Connect as Client'; + + @override + String stopServerWithIp(String ip) { + return 'Stop Server $ip'; + } + + @override + String startHostServerWithIp(String ip) { + return 'Start Host Server $ip'; + } + + @override + String get stopServerButton => 'Stop Server'; + + @override + String get startHostServerButton => 'Start Host Server'; + + @override + String get networkConnectLocal => 'Connect devices on local wifi:'; + + @override + String get networkServerIpHint => 'server ip address'; + + @override + String get networkPortHint => 'port'; + + @override + String get settingsLanguage => 'Language:'; + + @override + String get settingsDarkMode => 'Dark mode'; + + @override + String get settingsSoftNumpad => 'Soft numpad for input'; + + @override + String get settingsNoInit => 'Don\'t ask for initiative'; + + @override + String get settingsExpireConditions => 'Expire Conditions'; + + @override + String get settingsNoStandees => 'Don\'t track Standees'; + + @override + String get settingsAutoAddStandees => 'Auto Add Standees'; + + @override + String get settingsAutoAddSpawns => 'Auto Add Timed Spawns'; + + @override + String get settingsRandomStandees => 'Random Standees'; + + @override + String get settingsNoCalculations => 'No Calculations'; + + @override + String get settingsHideLootDeck => 'Hide Loot Deck'; + + @override + String get settingsShimmer => 'Stat card text shimmers'; + + @override + String get settingsPowerModeLabel => 'Power saving'; + + @override + String get powerModeNormal => 'Normal'; + + @override + String get powerModeDimWhenIdle => 'Dim when idle'; + + @override + String get settingsPowerModeInfoTitle => 'Power saving'; + + @override + String get settingsPowerModeInfo => + 'Three levels of battery saving, from none to most.\n\nNormal — the screen is held awake at full brightness for as long as the app is open. Nothing is dimmed and nothing sleeps. Best while you are actively playing.\n\nDim when idle — the screen is still held awake and the app never locks, but after 30 seconds without input the board dims. The board stays readable from across the table, and a single tap brings it straight back with nothing lost. Good for a game in progress that you glance at between turns.\n\nReduce power use — hands the screen back to your device, so it dims and turns off on its own schedule and you unlock to return. Also lowers drawing quality to save more: card and monster box shadows become hard-edged instead of softly blurred, icons are filtered more cheaply, and shimmering text effects are turned off. Best for infrequent use and low battery capacity devices.\n\nNothing about how the game works changes at any level — no tracking, syncing or rules behaviour is affected.'; + + @override + String get settingsReducePower => 'Reduce power use'; + + @override + String get settingsReducePowerInfoTitle => 'Reduce power use'; + + @override + String get settingsReducePowerInfo => + 'Saves battery by doing less drawing work, at the cost of some visual polish.\n\nWhat changes:\n\n• The screen is allowed to dim and turn off on its own. Normally this app keeps it awake the whole time it is open, which is by far the biggest drain on a phone or tablet.\n\n• Card and monster box shadows become hard-edged instead of softly blurred.\n\n• Icons are filtered more cheaply. You may notice slightly rougher edges on small images.\n\n• Shimmering text effects are turned off.\n\nNothing about how the game works changes — no tracking, syncing or rules behaviour is affected. You can turn this off again at any time.'; + + @override + String get settingsFhHazTerrainCalc => + 'Use Frosthaven Hazardous Terrain Calculation in OG Gloomhaven'; + + @override + String get settingsAllyDeckOGGloom => + 'Use Ally Attack Modifier Deck in OG Gloomhaven'; + + @override + String get settingsShowScenarioNames => 'Show Scenario names in list'; + + @override + String get settingsShowBattleGoalReminder => 'Show Battle Goal Reminder'; + + @override + String get settingsShowCustomContent => 'Show Custom Content'; + + @override + String get settingsShowSections => 'Show Sections in Main Screen'; + + @override + String get settingsShowReminders => 'Show Round Special Rule Reminders'; + + @override + String get settingsShowAmdDeck => 'Show Attack Modifier Decks'; + + @override + String get settingsShowCharacterAmd => 'Show character Attack Modifier Decks'; + + @override + String get settingsHealthWheel => + 'Enable heath wheel: drag left-right to change health'; + + @override + String get settingsFullscreen => 'Fullscreen'; + + @override + String get settingsMainListScaling => 'Main List Scaling:'; + + @override + String get settingsAppBarScaling => 'App Bar Scaling:'; + + @override + String get settingsStyleLabel => 'Style:'; + + @override + String get styleFrosthaven => 'Frosthaven'; + + @override + String get styleOriginal => 'Original'; + + @override + String get settingsClearUnlocked => 'Clear unlocked characters and stuff'; + + @override + String get settingsUnlockSpecials => 'Unlock specials'; + + @override + String get settingsLoadSaveState => 'Load/Save State'; + + @override + String get noResultsFound => 'No results found'; + + @override + String get close => 'Close'; + + @override + String get retry => 'RETRY'; + + @override + String get specialUnlocks => 'Special Unlocks'; + + @override + String get loadSaveDeleteCharacters => 'Load, Save or Delete Characters.'; + + @override + String get loadAddDeleteSaves => 'Load, Add or Delete save states.'; + + @override + String get addNewSave => 'Add new Save'; + + @override + String get addNewSaveLabel => 'Add new Save:'; + + @override + String get loadButton => 'Load'; + + @override + String get saveButton => 'Save'; + + @override + String get deleteButton => 'Delete'; + + @override + String get setSaveName => 'Set save name:'; + + @override + String get loadOrSaveCharacters => 'Load or Save Characters'; + + @override + String get loadCharacter => 'Load Character:'; + + @override + String get removeAll => 'Remove All'; + + @override + String get removeCardQuestion => 'Remove card?'; + + @override + String get sendToBottom => 'Send to Bottom'; + + @override + String get shuffleUndrawnCards => 'Shuffle un-drawn Cards'; + + @override + String get returnToDiscardPile => 'Return card to discard pile'; + + @override + String get returnToDrawPile => 'Return card to draw pile'; + + @override + String get addExtraLootCard => 'Add Extra Loot Card'; + + @override + String get addStandeeNr => 'Add Standee Nr'; + + @override + String get summonedLabel => 'Summoned:'; + + @override + String get characterDecks => 'Character Decks'; + + @override + String get shuffleAndDraw => 'Shuffle\n& Draw'; + + @override + String get draw => 'Draw'; + + @override + String get nextRound => ' Next\nRound'; + + @override + String get returnTopCard => 'Return top card'; + + @override + String removeCardWithDetails(String title, int nr) { + return 'Remove $title\n(card nr: $nr)'; + } + + @override + String get tapCardToAddToDeck => 'Tap Card to add to your deck'; + + @override + String get removeCardFromDeckQuestion => 'Remove card from your deck?'; + + @override + String get changeName => 'Change name:'; + + @override + String get showBosses => 'Show Bosses'; + + @override + String get showScenarioSpecialMonsters => 'Show Scenario Special Monsters'; + + @override + String get addAsAlly => 'Add as Ally'; + + @override + String get addMonsterLabel => 'Add Monster'; + + @override + String get allCampaigns => 'All Campaigns'; + + @override + String get showMonstersFrom => ' Show monsters from: '; + + @override + String setMonsterLevel(String name) { + return 'Set $name\'s level'; + } + + @override + String setSummonHealth(String name) { + return 'Set $name\'s max health'; + } + + @override + String get setScenarioLevel => 'Set Scenario Level'; + + @override + String enhancedLevel(String level) { + return 'Enhanced: $level'; + } + + @override + String get soloLabel => 'Solo:'; + + @override + String get automaticScenarioLevel => 'Automatic Scenario Level:'; + + @override + String get difficultyLabel => 'Difficulty:'; + + @override + String get lootCardEnhancements => 'Loot Card Enhancements'; + + @override + String get addPerks => 'Add Perks'; + + @override + String get useFrosthavenPerks => 'Use Frosthaven Perks'; + + @override + String currentCampaign(String campaign) { + return 'Current Campaign: $campaign'; + } + + @override + String get addCharacterHint => + 'Add Character (type name for hidden character classes)'; + + @override + String get trapDamage => 'trap damage'; + + @override + String get hazardousTerrainDamage => 'hazardous terrain damage'; + + @override + String get experienceAdded => 'experience added'; + + @override + String get goldCoinValue => 'gold coin value'; + + @override + String get levelLegendLabel => 'level'; + + @override + String get saveStateNote => + 'Please note that the app automatically saves your progress after every action. These are for backups or multiple campaigns.'; + + @override + String clientConnectedTo(String address) { + return 'Client Connected to: $address'; + } + + @override + String clientError(String error) { + return 'Client error: $error'; + } + + @override + String clientListenError(String error) { + return 'Client listen error: $error'; + } + + @override + String get lostConnectionToServer => 'Lost connection to server'; + + @override + String get stateMismatch => 'Your state was not up to date, try again.'; + + @override + String get serverUnresponsive => 'Server unresponsive. Client disconnected.'; + + @override + String get clientDisconnected => 'client disconnected'; + + @override + String get serverOffline => 'Server Offline'; + + @override + String get clientLeft => 'Client left.'; + + @override + String get clientTooOld => + 'Old client attempted to connect. Please update the app.'; + + @override + String networkConnection(String status) { + return 'Network connection: $status'; + } + + @override + String get failedToGetWifiIp => 'Failed to get IP address'; + + @override + String get badOmen => 'Bad Omen'; + + @override + String badOmensLeft(int count) { + return 'Bad Omens Left: $count'; + } + + @override + String get corrosiveSpew => 'Corrosive Spew'; + + @override + String get empowersOnTop => 'Empowers on top'; + + @override + String addMinusOneCard(String direction, int count) { + String _temp0 = intl.Intl.selectLogic(direction, { + 'added': 'Add -1 card (added: $count)', + 'removed': 'Add -1 card (removed: $count)', + 'other': 'Add -1 card ($count)', + }); + return '$_temp0'; + } + + @override + String get removeMinusOneCard => 'Remove -1 card'; + + @override + String get removeMinusTwoCard => 'Remove -2 card'; + + @override + String get minusTwoCardRemoved => '-2 card removed'; + + @override + String get removePlusZeroCard => 'Remove +0 card'; + + @override + String get plusZeroCardRemoved => '+0 card removed'; + + @override + String get removeImbue => 'Remove Imbue'; + + @override + String get imbue => 'Imbue'; + + @override + String get advancedImbue => 'Advanced Imbue'; + + @override + String get removeHailPerk => 'Remove Hail Perk'; + + @override + String get addHailPerk => 'Add Hail Perk'; + + @override + String get removeCassandraPerk => 'Remove\nCassandra Perk'; + + @override + String get addCassandraPerk => 'Add\nCassandra Perk'; + + @override + String get dontSaveRevealedCards => 'Don\'t Save\nRevealed Cards'; + + @override + String get saveRevealedCards => 'Save\nRevealed Cards'; + + @override + String removedCountLabel(int count) { + return 'Removed: $count'; + } + + @override + String get removeDonation => 'Remove\nDonation'; + + @override + String get donateSanctuary => 'Donate to\nSanctuary'; + + @override + String get removePartyCard => 'Remove\nParty Card:'; + + @override + String get addPartyCard => 'Add Party\nCard:'; + + @override + String get perks => 'Perks'; + + @override + String get revealCards => 'Reveal\ncards:'; + + @override + String get revealAll => 'All'; + + @override + String get drawExtraCard => 'Draw extra card'; + + @override + String get extraShuffle => 'Extra Shuffle'; + + @override + String get inactivateMonster => 'Inactivate\nMonster'; + + @override + String get activateMonster => 'Activate\nMonster'; + + @override + String addEliteStandees(int count, String name) { + return 'Add $count Elite $name'; + } + + @override + String addNormalStandees(int count, String name) { + return 'Add $count Normal $name'; + } + + @override + String get characterLoot => 'Character loot'; + + @override + String addSpecialCard(int nr) { + return 'Add card $nr'; + } + + @override + String removeSpecialCard(int nr) { + return 'Remove card $nr'; + } + + @override + String get enhanceCards => 'Enhance cards'; + + @override + String get addLootCard => 'Add Card'; + + @override + String get returnToTop => 'Return to Top'; + + @override + String get returnToBottom => 'Return to Bottom'; + + @override + String characterLootTitle(String name) { + return '$name\'s loot:'; + } + + @override + String get setLootOwner => 'Set Loot Owner:'; + + @override + String get lootNameCoin => 'coin'; + + @override + String get lootNameHide => 'hide'; + + @override + String get lootNameLumber => 'lumber'; + + @override + String get lootNameMetal => 'metal'; + + @override + String get lootNameArrowvine => 'arrowvine'; + + @override + String get lootNameAxenut => 'axenut'; + + @override + String get lootNameCorpsecap => 'corpsecap'; + + @override + String get lootNameFlamefruit => 'flamefruit'; + + @override + String get lootNameRockroot => 'rockroot'; + + @override + String get lootNameSnowthistle => 'snowthistle'; + + @override + String get lootAmount2For2 => '2 for 2 characters'; + + @override + String get lootAmount2For23 => '2 for 2-3 characters'; + + @override + String cmdActivateMonster(String name) { + return 'Activate $name'; + } + + @override + String cmdDeactivateMonster(String name) { + return 'Deactivate $name'; + } + + @override + String cmdAddCharacter(String id) { + return 'Add $id'; + } + + @override + String cmdAddCondition(String condition) { + return 'Add condition: $condition'; + } + + @override + String cmdRemoveCondition(String condition) { + return 'Remove condition: $condition'; + } + + @override + String cmdAddPartyCard(String character, String type) { + return '$character add party card $type'; + } + + @override + String cmdRemovePartyCard(String character) { + return '$character remove party card'; + } + + @override + String cmdAddFactionCard(String character) { + return '$character add faction card'; + } + + @override + String cmdRemoveFactionCard(String character) { + return '$character remove faction card'; + } + + @override + String cmdAddLootCard(String type) { + return 'Add $type Loot Card'; + } + + @override + String cmdAddMonster(String name) { + return 'Add $name'; + } + + @override + String cmdAddSpecialLootCard(int nr) { + return 'Add Special loot card $nr'; + } + + @override + String cmdRemoveSpecialLootCard(int nr) { + return 'Remove Special loot card $nr'; + } + + @override + String get cmdAddMinusOne => 'Add minus one'; + + @override + String get cmdRemoveMinusOne => 'Remove minus one'; + + @override + String get cmdRemoveMinusTwo => 'Remove minus two'; + + @override + String get cmdAddBackMinusTwo => 'Add back minus two'; + + @override + String get cmdRemovePlusZero => 'Remove plus zero'; + + @override + String get cmdAddBackPlusZero => 'Add back plus zero'; + + @override + String cmdRevealModifierCards(int count) { + return 'Reveal $count modifier cards'; + } + + @override + String cmdCassandraLeaveRevealed(String deck) { + return 'Leave revealed cards on top of $deck deck'; + } + + @override + String cmdCassandraSpecialOff(String deck) { + return 'Cassandra Special turned off for $deck deck'; + } + + @override + String get cmdImbueMonsterDeck => 'Imbue Monster Deck'; + + @override + String get cmdAdvancedImbueMonsterDeck => 'Advanced Imbue Monster Deck'; + + @override + String get cmdRemoveImbueMonsterDeck => 'Remove Imbuement'; + + @override + String get cmdChangeName => 'Change character name'; + + @override + String get cmdAddNoteRow => 'Add note row'; + + @override + String get cmdSetNoteRowText => 'Edit note'; + + @override + String get cmdSetNoteRowColor => 'Change note colour'; + + @override + String get cmdLinkNoteRow => 'Link note row'; + + @override + String get cmdRemoveNoteRow => 'Remove note row'; + + @override + String get cmdAddBless => 'Add a Bless'; + + @override + String get cmdRemoveBless => 'Remove a Bless'; + + @override + String get cmdAddCurse => 'Add a Curse'; + + @override + String get cmdRemoveCurse => 'Remove a Curse'; + + @override + String get cmdAddEmpower => 'Add Empower'; + + @override + String get cmdRemoveEmpower => 'Remove Empower'; + + @override + String get cmdAddEnfeeble => 'Add Enfeeble'; + + @override + String get cmdRemoveEnfeeble => 'Remove Enfeeble'; + + @override + String cmdIncreaseMaxHealth(String owner) { + return 'Increase $owner\'s max health'; + } + + @override + String cmdDecreaseMaxHealth(String owner) { + return 'Decrease $owner\'s max health'; + } + + @override + String get cmdChangeStat => 'Change stat'; + + @override + String cmdIncreaseXp(String figure, int amount) { + return 'Increase $figure\'s xp by $amount'; + } + + @override + String cmdDecreaseXp(String figure, int amount) { + return 'Decrease $figure\'s xp by $amount'; + } + + @override + String get cmdClearUnlockedClasses => 'Clear unlocked classes'; + + @override + String cmdDonateSanctuary(String character) { + return '$character donate to sanctuary'; + } + + @override + String cmdRemoveSanctuaryDonation(String character) { + return 'Remove $character\'s donation'; + } + + @override + String get cmdDrawExtraAbilityCard => 'Draw extra ability card'; + + @override + String get cmdDraw => 'Draw'; + + @override + String get cmdDrawLootCard => 'Draw loot card'; + + @override + String cmdDrawModifierCard(String name) { + return 'Draw $name modifier card'; + } + + @override + String get cmdRemoveLootEnhancement => 'Remove Loot Enhancement'; + + @override + String get cmdAddLootEnhancement => 'Add Loot Enhancement'; + + @override + String get cmdHideAllyDeck => 'Hide Ally Deck'; + + @override + String get cmdShowAllyDeck => 'Show Ally Deck'; + + @override + String get cmdIceWraithTurnNormal => 'Ice Wraith turn normal'; + + @override + String get cmdIceWraithTurnElite => 'Ice Wraith turn elite'; + + @override + String cmdImbueElement(String element) { + return 'Imbue element $element'; + } + + @override + String cmdUseElement(String element) { + return 'Use Element $element'; + } + + @override + String cmdLoadCharacter(String name) { + return 'Load saved character: $name'; + } + + @override + String cmdLoadGame(String name) { + return 'Load saved game: $name'; + } + + @override + String get cmdNextRound => 'Next Round'; + + @override + String get cmdRemoveAmdCard => 'Remove AMD card'; + + @override + String cmdRemoveCard(String deck, int nr) { + return 'Remove $deck card nr $nr'; + } + + @override + String get cmdRemoveAllCharacters => 'Remove all characters'; + + @override + String cmdRemoveCharacter(String id) { + return 'Remove $id'; + } + + @override + String get cmdRemoveAllMonsters => 'Remove all monsters'; + + @override + String cmdRemoveMonster(String name) { + return 'Remove $name'; + } + + @override + String get cmdReorderAbilityCards => 'Reorder Ability Cards'; + + @override + String get cmdReorderList => 'Reorder List'; + + @override + String get cmdReorderModifierCards => 'Reorder Modifier Cards'; + + @override + String get cmdReturnLootCard => 'Return loot card'; + + @override + String get cmdReturnModifierCard => 'Return modifier card to top'; + + @override + String get cmdReturnRemovedAmdCard => 'Return removed AMD card'; + + @override + String get cmdNoAllyDeckInOgGloom => + 'No ally deck in 1st edition Gloomhaven campaigns'; + + @override + String get cmdUseAllyDeckInOgGloom => + 'Use Ally Deck in 1st edition Gloomhaven Campaigns'; + + @override + String cmdMarkAsSummon(String owner) { + return 'Mark $owner as summon'; + } + + @override + String cmdRemoveSummonMark(String owner) { + return 'Remove $owner\'s summon mark'; + } + + @override + String get cmdAutoLevelOn => 'Turn automatic level update on'; + + @override + String get cmdAutoLevelOff => 'Turn automatic level update off'; + + @override + String cmdSetCampaign(String campaign) { + return 'Set $campaign campaign'; + } + + @override + String cmdSetCharacterLevel(String character) { + return 'Set $character\'s Level'; + } + + @override + String cmdSetDifficulty(String difficulty) { + return 'Set difficulty level to $difficulty'; + } + + @override + String cmdSetInitiative(String character) { + return 'Set initiative of $character'; + } + + @override + String cmdSetCharacterNote(String character) { + return 'Set note for $character'; + } + + @override + String get characterNoteTitle => 'Note'; + + @override + String get characterNoteHint => 'Add a note…'; + + @override + String get characterNoteQuickAdd => 'Quick note'; + + @override + String cmdSetMonsterLevel(String monster) { + return 'Set $monster\'s level'; + } + + @override + String get cmdSetLootOwner => 'Set loot card owner'; + + @override + String get cmdSetScenario => 'Set Scenario'; + + @override + String get cmdSetSoloOn => 'Set solo level recommendation on'; + + @override + String get cmdSetSoloOff => 'Set solo level recommendation off'; + + @override + String get cmdExtraAbilityShuffle => 'Extra ability deck shuffle'; + + @override + String get cmdExtraAmdShuffle => 'Extra AMD deck shuffle'; + + @override + String get cmdDrawnAbilityShuffle => 'Drawn ability deck shuffle'; + + @override + String get cmdDontTrackStandees => 'Don\'t track standees'; + + @override + String get cmdTrackStandees => 'Track standees'; + + @override + String cmdTurnDone(String id) { + return '$id\'s turn done'; + } + + @override + String cmdAddPerk(String character, int index) { + return 'Add \'$character\' Perk $index'; + } + + @override + String cmdRemovePerk(String character, int index) { + return 'Remove \'$character\' Perk $index'; + } + + @override + String cmdUnlock(String id) { + return 'Unlock $id'; + } + + @override + String cmdLock(String id) { + return 'Lock $id'; + } + + @override + String get cmdSetLevel => 'Set Level'; + + @override + String get cmdAddSection => 'Add Section'; + + @override + String cmdAddStandee(String name, int nr) { + return 'Add $name $nr'; + } + + @override + String get cmdDrawMonsterModifierCard => 'Draw monster modifier card'; + + @override + String cmdIncreaseHealth(String figure, int amount) { + return 'Increase $figure\'s health by $amount'; + } + + @override + String cmdKill(String owner) { + return 'Kill $owner'; + } + + @override + String cmdDecreaseHealth(String owner, int amount) { + return 'Decrease $owner\'s health by $amount'; + } + + @override + String cmdUseFhPerks(String character) { + return '$character use Frosthaven Perks'; + } + + @override + String cmdDontUseFhPerks(String character) { + return '$character don\'t use Frosthaven Perks'; + } + + @override + String get cmdRemoveNoCharacters => 'Remove no characters'; + + @override + String get cmdRemoveNoMonsters => 'Remove no monsters'; +} diff --git a/server/lib/core/l10n/app_localizations_es.dart b/server/lib/core/l10n/app_localizations_es.dart new file mode 100644 index 0000000..2b5835a --- /dev/null +++ b/server/lib/core/l10n/app_localizations_es.dart @@ -0,0 +1,1170 @@ +// ignore: unused_import +import 'package:intl/intl.dart' as intl; +import 'app_localizations.dart'; + +// ignore_for_file: type=lint + +/// The translations for Spanish Castilian (`es`). +class AppLocalizationsEs extends AppLocalizations { + AppLocalizationsEs([String locale = 'es']) : super(locale); + + @override + String get menuSetScenario => 'Definir escenario'; + + @override + String get menuAddCharacter => 'Añadir personaje'; + + @override + String get menuRemoveCharacters => 'Retirar personajes'; + + @override + String get menuSetLevel => 'Definir nivel'; + + @override + String get menuLootDeck => 'Menú mazo de botín'; + + @override + String get menuAddMonsters => 'Añadir monstruos'; + + @override + String get menuRemoveMonsters => 'Retirar monstruos'; + + @override + String get menuShowAllyDeck => 'Mostrar mazo de modificadores aliado'; + + @override + String get menuHideAllyDeck => 'Ocultar mazo de modificadores aliado'; + + @override + String get menuSettings => 'Ajustes'; + + @override + String get menuDocumentation => 'Documentación'; + + @override + String get menuDonate => 'Donar'; + + @override + String get menuExit => 'Salir'; + + @override + String get menuAddSection => 'Añadir sección'; + + @override + String get menuAddRandomDungeonCard => 'Añadir carta de mazmorra aleatoria'; + + @override + String get menuActionLog => 'Ver registro de acciones'; + + @override + String get actionLogTitle => 'Últimas 20 acciones'; + + @override + String get actionLogEmpty => 'Aún no hay acciones'; + + @override + String get actionLogRollbackHint => 'Toca una acción para volver a ella'; + + @override + String get actionLogRollbackTitle => '¿Revertir?'; + + @override + String actionLogRollbackBody(String action, int count) { + return '¿Volver a \"$action\"? Esto revierte $count acción(es) posterior(es). Puedes rehacerlas hasta que hagas un cambio.'; + } + + @override + String get actionLogRollbackConfirm => 'Revertir'; + + @override + String get menuAddNoteRow => 'Añadir fila de nota'; + + @override + String get noteRowTitle => 'Nota'; + + @override + String get noteRowHint => 'Texto de la nota…'; + + @override + String get noteRowColourLabel => 'Color'; + + @override + String get noteRowConnectLabel => 'Conectar con:'; + + @override + String get noteRowConnectNone => 'Nada (nota libre)'; + + @override + String get noteRowConnectPlayer => 'Jugador'; + + @override + String get noteRowConnectMonster => 'Monstruo'; + + @override + String get noteRowWholeGroup => 'Todo el grupo'; + + @override + String get noteRowAll => 'Todos'; + + @override + String noteRowStandeeNr(int nr) { + return 'Peana $nr'; + } + + @override + String get noteRowAddFromMenu => 'Añadir nota'; + + @override + String get noteRowDelete => 'Eliminar nota'; + + @override + String get undo => 'Deshacer'; + + @override + String undoWithDescription(String description) { + return 'Deshacer: $description'; + } + + @override + String get redo => 'Rehacer'; + + @override + String redoWithDescription(String description) { + return 'Rehacer: $description'; + } + + @override + String versionLabel(String version) { + return 'Versión $version'; + } + + @override + String get connectedAsClient => 'Conectado como cliente'; + + @override + String get connecting => 'Conectando…'; + + @override + String get cancelConnect => 'Cancel'; + + @override + String get connectionCancelled => 'Connection cancelled'; + + @override + String connectAsClientWithIp(String ip) { + return 'Conectar como cliente ($ip)'; + } + + @override + String get connectAsClientLabel => 'Conectar como cliente'; + + @override + String stopServerWithIp(String ip) { + return 'Detener servidor $ip'; + } + + @override + String startHostServerWithIp(String ip) { + return 'Iniciar servidor $ip'; + } + + @override + String get stopServerButton => 'Detener servidor'; + + @override + String get startHostServerButton => 'Iniciar servidor anfitrión'; + + @override + String get networkConnectLocal => 'Conectar dispositivos en Wi-Fi local:'; + + @override + String get networkServerIpHint => 'IP del servidor'; + + @override + String get networkPortHint => 'puerto'; + + @override + String get settingsLanguage => 'Idioma:'; + + @override + String get settingsDarkMode => 'Modo oscuro'; + + @override + String get settingsSoftNumpad => 'Teclado numérico en pantalla'; + + @override + String get settingsNoInit => 'No pedir iniciativa'; + + @override + String get settingsExpireConditions => 'Expirar condiciones'; + + @override + String get settingsNoStandees => 'No rastrear figurines'; + + @override + String get settingsAutoAddStandees => 'Añadir figurines automáticamente'; + + @override + String get settingsAutoAddSpawns => 'Añadir apariciones automáticamente'; + + @override + String get settingsRandomStandees => 'Figurines aleatorios'; + + @override + String get settingsNoCalculations => 'Sin cálculos'; + + @override + String get settingsHideLootDeck => 'Ocultar mazo de botín'; + + @override + String get settingsShimmer => 'Texto brillante en cartas de estadísticas'; + + @override + String get settingsPowerModeLabel => 'Power saving'; + + @override + String get powerModeNormal => 'Normal'; + + @override + String get powerModeDimWhenIdle => 'Dim when idle'; + + @override + String get settingsPowerModeInfoTitle => 'Power saving'; + + @override + String get settingsPowerModeInfo => + 'Three levels of battery saving, from none to most.\n\nNormal — the screen is held awake at full brightness for as long as the app is open. Nothing is dimmed and nothing sleeps. Best while you are actively playing.\n\nDim when idle — the screen is still held awake and the app never locks, but after 30 seconds without input the board dims. The board stays readable from across the table, and a single tap brings it straight back with nothing lost. Good for a game in progress that you glance at between turns.\n\nReduce power use — hands the screen back to your device, so it dims and turns off on its own schedule and you unlock to return. Also lowers drawing quality to save more: card and monster box shadows become hard-edged instead of softly blurred, icons are filtered more cheaply, and shimmering text effects are turned off. Best for infrequent use and low battery capacity devices.\n\nNothing about how the game works changes at any level — no tracking, syncing or rules behaviour is affected.'; + + @override + String get settingsReducePower => 'Reduce power use'; + + @override + String get settingsReducePowerInfoTitle => 'Reduce power use'; + + @override + String get settingsReducePowerInfo => + 'Saves battery by doing less drawing work, at the cost of some visual polish.\n\nWhat changes:\n\n• The screen is allowed to dim and turn off on its own. Normally this app keeps it awake the whole time it is open, which is by far the biggest drain on a phone or tablet.\n\n• Card and monster box shadows become hard-edged instead of softly blurred.\n\n• Icons are filtered more cheaply. You may notice slightly rougher edges on small images.\n\n• Shimmering text effects are turned off.\n\nNothing about how the game works changes — no tracking, syncing or rules behaviour is affected. You can turn this off again at any time.'; + + @override + String get settingsFhHazTerrainCalc => + 'Cálculo terreno peligroso Frosthaven en Gloomhaven orig.'; + + @override + String get settingsAllyDeckOGGloom => + 'Mazo modificadores aliado en Gloomhaven orig.'; + + @override + String get settingsShowScenarioNames => 'Mostrar nombres de escenarios'; + + @override + String get settingsShowBattleGoalReminder => + 'Mostrar recordatorio de objetivo de batalla'; + + @override + String get settingsShowCustomContent => 'Mostrar contenido personalizado'; + + @override + String get settingsShowSections => + 'Mostrar secciones en la pantalla principal'; + + @override + String get settingsShowReminders => + 'Mostrar recordatorios de reglas especiales'; + + @override + String get settingsShowAmdDeck => 'Mostrar mazos de modificadores de ataque'; + + @override + String get settingsShowCharacterAmd => + 'Mostrar mazos de modificadores de personajes'; + + @override + String get settingsHealthWheel => + 'Rueda de vida: arrastrar izquierda-derecha'; + + @override + String get settingsFullscreen => 'Pantalla completa'; + + @override + String get settingsMainListScaling => 'Escala de la lista principal:'; + + @override + String get settingsAppBarScaling => 'Escala de la barra de la app:'; + + @override + String get settingsStyleLabel => 'Estilo:'; + + @override + String get styleFrosthaven => 'Frosthaven'; + + @override + String get styleOriginal => 'Original'; + + @override + String get settingsClearUnlocked => + 'Borrar personajes y contenido desbloqueados'; + + @override + String get settingsUnlockSpecials => 'Desbloquear especiales'; + + @override + String get settingsLoadSaveState => 'Cargar/Guardar estado'; + + @override + String get noResultsFound => 'Sin resultados'; + + @override + String get close => 'Cerrar'; + + @override + String get retry => 'REINTENTAR'; + + @override + String get specialUnlocks => 'Desbloqueos especiales'; + + @override + String get loadSaveDeleteCharacters => + 'Cargar, guardar o eliminar personajes.'; + + @override + String get loadAddDeleteSaves => + 'Cargar, añadir o eliminar estados guardados.'; + + @override + String get addNewSave => 'Nuevo guardado'; + + @override + String get addNewSaveLabel => 'Nuevo guardado:'; + + @override + String get loadButton => 'Cargar'; + + @override + String get saveButton => 'Guardar'; + + @override + String get deleteButton => 'Eliminar'; + + @override + String get setSaveName => 'Nombre del guardado:'; + + @override + String get loadOrSaveCharacters => 'Cargar o guardar personajes'; + + @override + String get loadCharacter => 'Cargar personaje:'; + + @override + String get removeAll => 'Retirar todo'; + + @override + String get removeCardQuestion => '¿Retirar la carta?'; + + @override + String get sendToBottom => 'Enviar al fondo'; + + @override + String get shuffleUndrawnCards => 'Barajar cartas no robadas'; + + @override + String get returnToDiscardPile => 'Devolver al descarte'; + + @override + String get returnToDrawPile => 'Devolver al mazo'; + + @override + String get addExtraLootCard => 'Añadir carta de botín extra'; + + @override + String get addStandeeNr => 'Añadir figurín n.º'; + + @override + String get summonedLabel => 'Invocados:'; + + @override + String get characterDecks => 'Mazos de personajes'; + + @override + String get shuffleAndDraw => 'Barajar\ny robar'; + + @override + String get draw => 'Robar'; + + @override + String get nextRound => ' Siguiente\nronda'; + + @override + String get returnTopCard => 'Devolver carta superior'; + + @override + String removeCardWithDetails(String title, int nr) { + return 'Retirar $title\n(carta n.º: $nr)'; + } + + @override + String get tapCardToAddToDeck => 'Toca una carta para añadirla al mazo'; + + @override + String get removeCardFromDeckQuestion => '¿Retirar carta del mazo?'; + + @override + String get changeName => 'Cambiar nombre:'; + + @override + String get showBosses => 'Mostrar jefes'; + + @override + String get showScenarioSpecialMonsters => + 'Mostrar monstruos especiales del escenario'; + + @override + String get addAsAlly => 'Añadir como aliado'; + + @override + String get addMonsterLabel => 'Añadir monstruo'; + + @override + String get allCampaigns => 'Todas las campañas'; + + @override + String get showMonstersFrom => ' Mostrar monstruos de: '; + + @override + String setMonsterLevel(String name) { + return 'Nivel de $name'; + } + + @override + String setSummonHealth(String name) { + return 'Vida máx. de $name'; + } + + @override + String get setScenarioLevel => 'Nivel del escenario'; + + @override + String enhancedLevel(String level) { + return 'Mejorado: $level'; + } + + @override + String get soloLabel => 'Solo:'; + + @override + String get automaticScenarioLevel => 'Nivel de escenario automático:'; + + @override + String get difficultyLabel => 'Dificultad:'; + + @override + String get lootCardEnhancements => 'Mejoras de cartas de botín'; + + @override + String get addPerks => 'Añadir ventajas'; + + @override + String get useFrosthavenPerks => 'Ventajas Frosthaven'; + + @override + String currentCampaign(String campaign) { + return 'Campaña actual: $campaign'; + } + + @override + String get addCharacterHint => + 'Añadir personaje (escribir nombre para clases ocultas)'; + + @override + String get trapDamage => 'daño de trampa'; + + @override + String get hazardousTerrainDamage => 'daño de terreno peligroso'; + + @override + String get experienceAdded => 'experiencia añadida'; + + @override + String get goldCoinValue => 'valor de moneda de oro'; + + @override + String get levelLegendLabel => 'nivel'; + + @override + String get saveStateNote => + 'La app guarda automáticamente tras cada acción. Estos son para copias de seguridad o varias campañas.'; + + @override + String clientConnectedTo(String address) { + return 'Cliente conectado a: $address'; + } + + @override + String clientError(String error) { + return 'Error de cliente: $error'; + } + + @override + String clientListenError(String error) { + return 'Error de escucha de cliente: $error'; + } + + @override + String get lostConnectionToServer => 'Conexión con el servidor perdida'; + + @override + String get stateMismatch => + 'Tu estado no estaba actualizado, inténtalo de nuevo.'; + + @override + String get serverUnresponsive => + 'Servidor sin respuesta. Cliente desconectado.'; + + @override + String get clientDisconnected => 'cliente desconectado'; + + @override + String get serverOffline => 'Servidor sin conexión'; + + @override + String get clientLeft => 'Cliente se fue.'; + + @override + String get clientTooOld => + 'Cliente antiguo intentó conectarse. Actualiza la app.'; + + @override + String networkConnection(String status) { + return 'Conexión de red: $status'; + } + + @override + String get failedToGetWifiIp => 'Error al obtener la dirección IP'; + + @override + String get badOmen => 'Mal augurio'; + + @override + String badOmensLeft(int count) { + return 'Malos augurios restantes: $count'; + } + + @override + String get corrosiveSpew => 'Escupitajo corrosivo'; + + @override + String get empowersOnTop => 'Potenciados encima'; + + @override + String addMinusOneCard(String direction, int count) { + String _temp0 = intl.Intl.selectLogic(direction, { + 'added': 'Añadir carta -1 (añadidas: $count)', + 'removed': 'Añadir carta -1 (quitadas: $count)', + 'other': 'Carta -1 ($count)', + }); + return '$_temp0'; + } + + @override + String get removeMinusOneCard => 'Retirar carta -1'; + + @override + String get removeMinusTwoCard => 'Retirar carta -2'; + + @override + String get minusTwoCardRemoved => 'Carta -2 retirada'; + + @override + String get removePlusZeroCard => 'Retirar carta +0'; + + @override + String get plusZeroCardRemoved => 'Carta +0 retirada'; + + @override + String get removeImbue => 'Retirar imbuido'; + + @override + String get imbue => 'Imbuir'; + + @override + String get advancedImbue => 'Imbuido avanzado'; + + @override + String get removeHailPerk => 'Retirar ventaja Granizo'; + + @override + String get addHailPerk => 'Añadir ventaja Granizo'; + + @override + String get removeCassandraPerk => 'Retirar\nventaja Cassandra'; + + @override + String get addCassandraPerk => 'Añadir\nventaja Cassandra'; + + @override + String get dontSaveRevealedCards => 'No guardar\ncartas reveladas'; + + @override + String get saveRevealedCards => 'Guardar\ncartas reveladas'; + + @override + String removedCountLabel(int count) { + return 'Retiradas: $count'; + } + + @override + String get removeDonation => 'Retirar\ndonación'; + + @override + String get donateSanctuary => 'Donar al\nsantuario'; + + @override + String get removePartyCard => 'Retirar\ncarta de grupo:'; + + @override + String get addPartyCard => 'Añadir\ncarta de grupo:'; + + @override + String get perks => 'Ventajas'; + + @override + String get revealCards => 'Revelar\ncartas:'; + + @override + String get revealAll => 'Todas'; + + @override + String get drawExtraCard => 'Robar carta extra'; + + @override + String get extraShuffle => 'Barajada extra'; + + @override + String get inactivateMonster => 'Inactivar\nmonstruo'; + + @override + String get activateMonster => 'Activar\nmonstruo'; + + @override + String addEliteStandees(int count, String name) { + return 'Añadir $count $name élite'; + } + + @override + String addNormalStandees(int count, String name) { + return 'Añadir $count $name normal'; + } + + @override + String get characterLoot => 'Botín del personaje'; + + @override + String addSpecialCard(int nr) { + return 'Añadir carta $nr'; + } + + @override + String removeSpecialCard(int nr) { + return 'Retirar carta $nr'; + } + + @override + String get enhanceCards => 'Mejorar cartas'; + + @override + String get addLootCard => 'Añadir carta'; + + @override + String get returnToTop => 'Devolver arriba'; + + @override + String get returnToBottom => 'Devolver abajo'; + + @override + String characterLootTitle(String name) { + return 'Botín de $name:'; + } + + @override + String get setLootOwner => 'Propietario del botín:'; + + @override + String get lootNameCoin => 'moneda'; + + @override + String get lootNameHide => 'piel'; + + @override + String get lootNameLumber => 'madera'; + + @override + String get lootNameMetal => 'metal'; + + @override + String get lootNameArrowvine => 'vid-flecha'; + + @override + String get lootNameAxenut => 'nuez-hacha'; + + @override + String get lootNameCorpsecap => 'gorro-cadáver'; + + @override + String get lootNameFlamefruit => 'fruta-llama'; + + @override + String get lootNameRockroot => 'raíz-roca'; + + @override + String get lootNameSnowthistle => 'cardo-nieve'; + + @override + String get lootAmount2For2 => '2 para 2 jugadores'; + + @override + String get lootAmount2For23 => '2 para 2-3 jugadores'; + + @override + String cmdActivateMonster(String name) { + return 'Activar $name'; + } + + @override + String cmdDeactivateMonster(String name) { + return 'Desactivar $name'; + } + + @override + String cmdAddCharacter(String id) { + return 'Añadir $id'; + } + + @override + String cmdAddCondition(String condition) { + return 'Añadir condición: $condition'; + } + + @override + String cmdRemoveCondition(String condition) { + return 'Retirar condición: $condition'; + } + + @override + String cmdAddPartyCard(String character, String type) { + return '$character añadir carta de grupo $type'; + } + + @override + String cmdRemovePartyCard(String character) { + return '$character retirar carta de grupo'; + } + + @override + String cmdAddFactionCard(String character) { + return '$character añadir carta de facción'; + } + + @override + String cmdRemoveFactionCard(String character) { + return '$character retirar carta de facción'; + } + + @override + String cmdAddLootCard(String type) { + return 'Añadir carta de botín $type'; + } + + @override + String cmdAddMonster(String name) { + return 'Añadir $name'; + } + + @override + String cmdAddSpecialLootCard(int nr) { + return 'Añadir carta de botín especial $nr'; + } + + @override + String cmdRemoveSpecialLootCard(int nr) { + return 'Retirar carta de botín especial $nr'; + } + + @override + String get cmdAddMinusOne => 'Añadir menos uno'; + + @override + String get cmdRemoveMinusOne => 'Retirar menos uno'; + + @override + String get cmdRemoveMinusTwo => 'Retirar menos dos'; + + @override + String get cmdAddBackMinusTwo => 'Devolver menos dos'; + + @override + String get cmdRemovePlusZero => 'Retirar más cero'; + + @override + String get cmdAddBackPlusZero => 'Devolver más cero'; + + @override + String cmdRevealModifierCards(int count) { + return 'Revelar $count cartas modificadoras'; + } + + @override + String cmdCassandraLeaveRevealed(String deck) { + return 'Dejar cartas reveladas encima del mazo $deck'; + } + + @override + String cmdCassandraSpecialOff(String deck) { + return 'Especial Cassandra desactivado para mazo $deck'; + } + + @override + String get cmdImbueMonsterDeck => 'Imbuir mazo de monstruos'; + + @override + String get cmdAdvancedImbueMonsterDeck => + 'Imbuido avanzado del mazo de monstruos'; + + @override + String get cmdRemoveImbueMonsterDeck => 'Retirar imbuido'; + + @override + String get cmdChangeName => 'Cambiar nombre del personaje'; + + @override + String get cmdAddNoteRow => 'Añadir fila de nota'; + + @override + String get cmdSetNoteRowText => 'Editar nota'; + + @override + String get cmdSetNoteRowColor => 'Cambiar color de nota'; + + @override + String get cmdLinkNoteRow => 'Vincular fila de nota'; + + @override + String get cmdRemoveNoteRow => 'Eliminar fila de nota'; + + @override + String get cmdAddBless => 'Añadir bendición'; + + @override + String get cmdRemoveBless => 'Retirar bendición'; + + @override + String get cmdAddCurse => 'Añadir maldición'; + + @override + String get cmdRemoveCurse => 'Retirar maldición'; + + @override + String get cmdAddEmpower => 'Añadir potenciación'; + + @override + String get cmdRemoveEmpower => 'Retirar potenciación'; + + @override + String get cmdAddEnfeeble => 'Añadir debilitación'; + + @override + String get cmdRemoveEnfeeble => 'Retirar debilitación'; + + @override + String cmdIncreaseMaxHealth(String owner) { + return 'Aumentar vida máx. de $owner'; + } + + @override + String cmdDecreaseMaxHealth(String owner) { + return 'Reducir vida máx. de $owner'; + } + + @override + String get cmdChangeStat => 'Modificar estadística'; + + @override + String cmdIncreaseXp(String figure, int amount) { + return 'Aumentar XP de $figure en $amount'; + } + + @override + String cmdDecreaseXp(String figure, int amount) { + return 'Reducir XP de $figure en $amount'; + } + + @override + String get cmdClearUnlockedClasses => 'Borrar clases desbloqueadas'; + + @override + String cmdDonateSanctuary(String character) { + return '$character donar al santuario'; + } + + @override + String cmdRemoveSanctuaryDonation(String character) { + return 'Retirar donación de $character'; + } + + @override + String get cmdDrawExtraAbilityCard => 'Robar carta de habilidad extra'; + + @override + String get cmdDraw => 'Robar'; + + @override + String get cmdDrawLootCard => 'Robar carta de botín'; + + @override + String cmdDrawModifierCard(String name) { + return 'Robar carta modificadora $name'; + } + + @override + String get cmdRemoveLootEnhancement => 'Retirar mejora de botín'; + + @override + String get cmdAddLootEnhancement => 'Añadir mejora de botín'; + + @override + String get cmdHideAllyDeck => 'Ocultar mazo aliado'; + + @override + String get cmdShowAllyDeck => 'Mostrar mazo aliado'; + + @override + String get cmdIceWraithTurnNormal => 'Espectro de hielo pasa a normal'; + + @override + String get cmdIceWraithTurnElite => 'Espectro de hielo pasa a élite'; + + @override + String cmdImbueElement(String element) { + return 'Imbuir elemento $element'; + } + + @override + String cmdUseElement(String element) { + return 'Usar elemento $element'; + } + + @override + String cmdLoadCharacter(String name) { + return 'Cargar personaje guardado: $name'; + } + + @override + String cmdLoadGame(String name) { + return 'Cargar partida guardada: $name'; + } + + @override + String get cmdNextRound => 'Siguiente ronda'; + + @override + String get cmdRemoveAmdCard => 'Retirar carta AMD'; + + @override + String cmdRemoveCard(String deck, int nr) { + return 'Retirar carta $deck n.º $nr'; + } + + @override + String get cmdRemoveAllCharacters => 'Retirar todos los personajes'; + + @override + String cmdRemoveCharacter(String id) { + return 'Retirar $id'; + } + + @override + String get cmdRemoveAllMonsters => 'Retirar todos los monstruos'; + + @override + String cmdRemoveMonster(String name) { + return 'Retirar $name'; + } + + @override + String get cmdReorderAbilityCards => 'Reordenar cartas de habilidad'; + + @override + String get cmdReorderList => 'Reordenar lista'; + + @override + String get cmdReorderModifierCards => 'Reordenar cartas modificadoras'; + + @override + String get cmdReturnLootCard => 'Devolver carta de botín'; + + @override + String get cmdReturnModifierCard => 'Devolver carta modificadora arriba'; + + @override + String get cmdReturnRemovedAmdCard => 'Devolver carta AMD retirada'; + + @override + String get cmdNoAllyDeckInOgGloom => + 'Sin mazo aliado en Gloomhaven 1.ª edición'; + + @override + String get cmdUseAllyDeckInOgGloom => + 'Usar mazo aliado en Gloomhaven 1.ª edición'; + + @override + String cmdMarkAsSummon(String owner) { + return 'Marcar $owner como invocado'; + } + + @override + String cmdRemoveSummonMark(String owner) { + return 'Retirar marca de invocación de $owner'; + } + + @override + String get cmdAutoLevelOn => 'Activar actualización automática de nivel'; + + @override + String get cmdAutoLevelOff => 'Desactivar actualización automática de nivel'; + + @override + String cmdSetCampaign(String campaign) { + return 'Definir campaña $campaign'; + } + + @override + String cmdSetCharacterLevel(String character) { + return 'Definir nivel de $character'; + } + + @override + String cmdSetDifficulty(String difficulty) { + return 'Definir dificultad a $difficulty'; + } + + @override + String cmdSetInitiative(String character) { + return 'Definir iniciativa de $character'; + } + + @override + String cmdSetCharacterNote(String character) { + return 'Establecer nota para $character'; + } + + @override + String get characterNoteTitle => 'Nota'; + + @override + String get characterNoteHint => 'Añadir una nota…'; + + @override + String get characterNoteQuickAdd => 'Nota rápida'; + + @override + String cmdSetMonsterLevel(String monster) { + return 'Definir nivel de $monster'; + } + + @override + String get cmdSetLootOwner => 'Definir propietario de botín'; + + @override + String get cmdSetScenario => 'Definir escenario'; + + @override + String get cmdSetSoloOn => 'Activar recomendación nivel solo'; + + @override + String get cmdSetSoloOff => 'Desactivar recomendación nivel solo'; + + @override + String get cmdExtraAbilityShuffle => 'Barajada extra del mazo de habilidades'; + + @override + String get cmdExtraAmdShuffle => 'Barajada extra del mazo AMD'; + + @override + String get cmdDrawnAbilityShuffle => + 'Barajada del mazo de habilidades robadas'; + + @override + String get cmdDontTrackStandees => 'No rastrear figurines'; + + @override + String get cmdTrackStandees => 'Rastrear figurines'; + + @override + String cmdTurnDone(String id) { + return 'Turno de $id terminado'; + } + + @override + String cmdAddPerk(String character, int index) { + return 'Añadir ventaja $index de \'$character\''; + } + + @override + String cmdRemovePerk(String character, int index) { + return 'Retirar ventaja $index de \'$character\''; + } + + @override + String cmdUnlock(String id) { + return 'Desbloquear $id'; + } + + @override + String cmdLock(String id) { + return 'Bloquear $id'; + } + + @override + String get cmdSetLevel => 'Definir nivel'; + + @override + String get cmdAddSection => 'Añadir sección'; + + @override + String cmdAddStandee(String name, int nr) { + return 'Añadir $name $nr'; + } + + @override + String get cmdDrawMonsterModifierCard => + 'Robar carta modificadora de monstruo'; + + @override + String cmdIncreaseHealth(String figure, int amount) { + return 'Aumentar vida de $figure en $amount'; + } + + @override + String cmdKill(String owner) { + return 'Eliminar $owner'; + } + + @override + String cmdDecreaseHealth(String owner, int amount) { + return 'Reducir vida de $owner en $amount'; + } + + @override + String cmdUseFhPerks(String character) { + return '$character usar ventajas Frosthaven'; + } + + @override + String cmdDontUseFhPerks(String character) { + return '$character no usar ventajas Frosthaven'; + } + + @override + String get cmdRemoveNoCharacters => 'Sin personajes retirados'; + + @override + String get cmdRemoveNoMonsters => 'Sin monstruos retirados'; +} diff --git a/server/lib/core/l10n/app_localizations_fr.dart b/server/lib/core/l10n/app_localizations_fr.dart new file mode 100644 index 0000000..07808bd --- /dev/null +++ b/server/lib/core/l10n/app_localizations_fr.dart @@ -0,0 +1,1170 @@ +// ignore: unused_import +import 'package:intl/intl.dart' as intl; +import 'app_localizations.dart'; + +// ignore_for_file: type=lint + +/// The translations for French (`fr`). +class AppLocalizationsFr extends AppLocalizations { + AppLocalizationsFr([String locale = 'fr']) : super(locale); + + @override + String get menuSetScenario => 'Définir le scénario'; + + @override + String get menuAddCharacter => 'Ajouter un personnage'; + + @override + String get menuRemoveCharacters => 'Retirer des personnages'; + + @override + String get menuSetLevel => 'Définir le niveau'; + + @override + String get menuLootDeck => 'Menu pioche de butin'; + + @override + String get menuAddMonsters => 'Ajouter des monstres'; + + @override + String get menuRemoveMonsters => 'Retirer des monstres'; + + @override + String get menuShowAllyDeck => 'Afficher le deck modificateurs allié'; + + @override + String get menuHideAllyDeck => 'Masquer le deck modificateurs allié'; + + @override + String get menuSettings => 'Paramètres'; + + @override + String get menuDocumentation => 'Documentation'; + + @override + String get menuDonate => 'Faire un don'; + + @override + String get menuExit => 'Quitter'; + + @override + String get menuAddSection => 'Ajouter une section'; + + @override + String get menuAddRandomDungeonCard => 'Ajouter une carte donjon aléatoire'; + + @override + String get menuActionLog => 'Voir le journal des actions'; + + @override + String get actionLogTitle => '20 dernières actions'; + + @override + String get actionLogEmpty => 'Aucune action pour l\'instant'; + + @override + String get actionLogRollbackHint => 'Touchez une action pour y revenir'; + + @override + String get actionLogRollbackTitle => 'Revenir en arrière ?'; + + @override + String actionLogRollbackBody(String action, int count) { + return 'Revenir à \"$action\" ? Cela annule $count action(s) ultérieure(s). Vous pouvez les rétablir jusqu\'à ce que vous fassiez une modification.'; + } + + @override + String get actionLogRollbackConfirm => 'Revenir'; + + @override + String get menuAddNoteRow => 'Ajouter une ligne de note'; + + @override + String get noteRowTitle => 'Note'; + + @override + String get noteRowHint => 'Texte de la note…'; + + @override + String get noteRowColourLabel => 'Couleur'; + + @override + String get noteRowConnectLabel => 'Connecter à :'; + + @override + String get noteRowConnectNone => 'Rien (note libre)'; + + @override + String get noteRowConnectPlayer => 'Joueur'; + + @override + String get noteRowConnectMonster => 'Monstre'; + + @override + String get noteRowWholeGroup => 'Groupe entier'; + + @override + String get noteRowAll => 'Tous'; + + @override + String noteRowStandeeNr(int nr) { + return 'Figurine $nr'; + } + + @override + String get noteRowAddFromMenu => 'Ajouter une note'; + + @override + String get noteRowDelete => 'Supprimer la note'; + + @override + String get undo => 'Annuler'; + + @override + String undoWithDescription(String description) { + return 'Annuler : $description'; + } + + @override + String get redo => 'Rétablir'; + + @override + String redoWithDescription(String description) { + return 'Rétablir : $description'; + } + + @override + String versionLabel(String version) { + return 'Version $version'; + } + + @override + String get connectedAsClient => 'Connecté en tant que client'; + + @override + String get connecting => 'Connexion en cours…'; + + @override + String get cancelConnect => 'Cancel'; + + @override + String get connectionCancelled => 'Connection cancelled'; + + @override + String connectAsClientWithIp(String ip) { + return 'Se connecter ($ip)'; + } + + @override + String get connectAsClientLabel => 'Se connecter en tant que client'; + + @override + String stopServerWithIp(String ip) { + return 'Arrêter serveur $ip'; + } + + @override + String startHostServerWithIp(String ip) { + return 'Démarrer serveur $ip'; + } + + @override + String get stopServerButton => 'Arrêter le serveur'; + + @override + String get startHostServerButton => 'Démarrer le serveur hôte'; + + @override + String get networkConnectLocal => 'Connecter des appareils en Wi-Fi local :'; + + @override + String get networkServerIpHint => 'adresse IP du serveur'; + + @override + String get networkPortHint => 'port'; + + @override + String get settingsLanguage => 'Langue :'; + + @override + String get settingsDarkMode => 'Mode sombre'; + + @override + String get settingsSoftNumpad => 'Pavé numérique logiciel'; + + @override + String get settingsNoInit => 'Ne pas demander l\'initiative'; + + @override + String get settingsExpireConditions => 'Expirer les conditions'; + + @override + String get settingsNoStandees => 'Ne pas suivre les figurines'; + + @override + String get settingsAutoAddStandees => 'Ajouter les figurines automatiquement'; + + @override + String get settingsAutoAddSpawns => 'Ajouter les apparitions automatiquement'; + + @override + String get settingsRandomStandees => 'Figurines aléatoires'; + + @override + String get settingsNoCalculations => 'Pas de calculs automatiques'; + + @override + String get settingsHideLootDeck => 'Masquer la pioche de butin'; + + @override + String get settingsShimmer => 'Texte scintillant sur cartes de stats'; + + @override + String get settingsPowerModeLabel => 'Power saving'; + + @override + String get powerModeNormal => 'Normal'; + + @override + String get powerModeDimWhenIdle => 'Dim when idle'; + + @override + String get settingsPowerModeInfoTitle => 'Power saving'; + + @override + String get settingsPowerModeInfo => + 'Three levels of battery saving, from none to most.\n\nNormal — the screen is held awake at full brightness for as long as the app is open. Nothing is dimmed and nothing sleeps. Best while you are actively playing.\n\nDim when idle — the screen is still held awake and the app never locks, but after 30 seconds without input the board dims. The board stays readable from across the table, and a single tap brings it straight back with nothing lost. Good for a game in progress that you glance at between turns.\n\nReduce power use — hands the screen back to your device, so it dims and turns off on its own schedule and you unlock to return. Also lowers drawing quality to save more: card and monster box shadows become hard-edged instead of softly blurred, icons are filtered more cheaply, and shimmering text effects are turned off. Best for infrequent use and low battery capacity devices.\n\nNothing about how the game works changes at any level — no tracking, syncing or rules behaviour is affected.'; + + @override + String get settingsReducePower => 'Reduce power use'; + + @override + String get settingsReducePowerInfoTitle => 'Reduce power use'; + + @override + String get settingsReducePowerInfo => + 'Saves battery by doing less drawing work, at the cost of some visual polish.\n\nWhat changes:\n\n• The screen is allowed to dim and turn off on its own. Normally this app keeps it awake the whole time it is open, which is by far the biggest drain on a phone or tablet.\n\n• Card and monster box shadows become hard-edged instead of softly blurred.\n\n• Icons are filtered more cheaply. You may notice slightly rougher edges on small images.\n\n• Shimmering text effects are turned off.\n\nNothing about how the game works changes — no tracking, syncing or rules behaviour is affected. You can turn this off again at any time.'; + + @override + String get settingsFhHazTerrainCalc => + 'Calcul terrain dangereux Frosthaven dans Gloomhaven orig.'; + + @override + String get settingsAllyDeckOGGloom => + 'Deck modificateurs allié dans Gloomhaven orig.'; + + @override + String get settingsShowScenarioNames => 'Afficher les noms de scénarios'; + + @override + String get settingsShowBattleGoalReminder => + 'Afficher le rappel d\'objectif de combat'; + + @override + String get settingsShowCustomContent => 'Afficher le contenu personnalisé'; + + @override + String get settingsShowSections => + 'Afficher les sections dans l\'écran principal'; + + @override + String get settingsShowReminders => + 'Afficher les rappels de règles spéciales'; + + @override + String get settingsShowAmdDeck => + 'Afficher les decks modificateurs d\'attaque'; + + @override + String get settingsShowCharacterAmd => + 'Afficher les decks modificateurs des personnages'; + + @override + String get settingsHealthWheel => + 'Roue de vie : glisser gauche-droite pour changer'; + + @override + String get settingsFullscreen => 'Plein écran'; + + @override + String get settingsMainListScaling => 'Échelle de la liste principale :'; + + @override + String get settingsAppBarScaling => 'Échelle de la barre d\'app :'; + + @override + String get settingsStyleLabel => 'Style :'; + + @override + String get styleFrosthaven => 'Frosthaven'; + + @override + String get styleOriginal => 'Original'; + + @override + String get settingsClearUnlocked => + 'Réinitialiser personnages et contenus débloqués'; + + @override + String get settingsUnlockSpecials => 'Débloquer les spéciaux'; + + @override + String get settingsLoadSaveState => 'Charger/Sauvegarder état'; + + @override + String get noResultsFound => 'Aucun résultat'; + + @override + String get close => 'Fermer'; + + @override + String get retry => 'RÉESSAYER'; + + @override + String get specialUnlocks => 'Déverrouillages spéciaux'; + + @override + String get loadSaveDeleteCharacters => + 'Charger, sauvegarder ou supprimer des personnages.'; + + @override + String get loadAddDeleteSaves => + 'Charger, ajouter ou supprimer des sauvegardes.'; + + @override + String get addNewSave => 'Nouvelle sauvegarde'; + + @override + String get addNewSaveLabel => 'Nouvelle sauvegarde :'; + + @override + String get loadButton => 'Charger'; + + @override + String get saveButton => 'Sauvegarder'; + + @override + String get deleteButton => 'Supprimer'; + + @override + String get setSaveName => 'Nom de la sauvegarde :'; + + @override + String get loadOrSaveCharacters => 'Charger ou sauvegarder des personnages'; + + @override + String get loadCharacter => 'Charger un personnage :'; + + @override + String get removeAll => 'Tout retirer'; + + @override + String get removeCardQuestion => 'Retirer la carte ?'; + + @override + String get sendToBottom => 'Envoyer en bas'; + + @override + String get shuffleUndrawnCards => 'Mélanger les cartes non piochées'; + + @override + String get returnToDiscardPile => 'Remettre dans la défausse'; + + @override + String get returnToDrawPile => 'Remettre dans la pioche'; + + @override + String get addExtraLootCard => 'Ajouter une carte de butin supplémentaire'; + + @override + String get addStandeeNr => 'Ajouter figurine n°'; + + @override + String get summonedLabel => 'Invoqués :'; + + @override + String get characterDecks => 'Decks des personnages'; + + @override + String get shuffleAndDraw => 'Mélanger\net piocher'; + + @override + String get draw => 'Piocher'; + + @override + String get nextRound => ' Tour\nsuivant'; + + @override + String get returnTopCard => 'Remettre la carte du dessus'; + + @override + String removeCardWithDetails(String title, int nr) { + return 'Retirer $title\n(carte n° : $nr)'; + } + + @override + String get tapCardToAddToDeck => + 'Appuyer sur une carte pour l\'ajouter au deck'; + + @override + String get removeCardFromDeckQuestion => 'Retirer la carte du deck ?'; + + @override + String get changeName => 'Changer le nom :'; + + @override + String get showBosses => 'Afficher les boss'; + + @override + String get showScenarioSpecialMonsters => + 'Afficher les monstres spéciaux du scénario'; + + @override + String get addAsAlly => 'Ajouter comme allié'; + + @override + String get addMonsterLabel => 'Ajouter un monstre'; + + @override + String get allCampaigns => 'Toutes les campagnes'; + + @override + String get showMonstersFrom => ' Afficher monstres de : '; + + @override + String setMonsterLevel(String name) { + return 'Niveau de $name'; + } + + @override + String setSummonHealth(String name) { + return 'Vie max de $name'; + } + + @override + String get setScenarioLevel => 'Niveau du scénario'; + + @override + String enhancedLevel(String level) { + return 'Amélioré : $level'; + } + + @override + String get soloLabel => 'Solo :'; + + @override + String get automaticScenarioLevel => 'Niveau de scénario automatique :'; + + @override + String get difficultyLabel => 'Difficulté :'; + + @override + String get lootCardEnhancements => 'Améliorations cartes de butin'; + + @override + String get addPerks => 'Ajouter des avantages'; + + @override + String get useFrosthavenPerks => 'Avantages Frosthaven'; + + @override + String currentCampaign(String campaign) { + return 'Campagne actuelle : $campaign'; + } + + @override + String get addCharacterHint => + 'Ajouter un personnage (taper le nom pour les classes cachées)'; + + @override + String get trapDamage => 'dégâts de piège'; + + @override + String get hazardousTerrainDamage => 'dégâts de terrain dangereux'; + + @override + String get experienceAdded => 'expérience ajoutée'; + + @override + String get goldCoinValue => 'valeur des pièces d\'or'; + + @override + String get levelLegendLabel => 'niveau'; + + @override + String get saveStateNote => + 'L\'app sauvegarde automatiquement après chaque action. Celles-ci servent de sauvegarde ou pour plusieurs campagnes.'; + + @override + String clientConnectedTo(String address) { + return 'Client connecté à : $address'; + } + + @override + String clientError(String error) { + return 'Erreur client : $error'; + } + + @override + String clientListenError(String error) { + return 'Erreur d\'écoute client : $error'; + } + + @override + String get lostConnectionToServer => 'Connexion au serveur perdue'; + + @override + String get stateMismatch => 'Votre état n\'était pas à jour, réessayez.'; + + @override + String get serverUnresponsive => 'Serveur ne répond pas. Client déconnecté.'; + + @override + String get clientDisconnected => 'client déconnecté'; + + @override + String get serverOffline => 'Serveur hors ligne'; + + @override + String get clientLeft => 'Client parti.'; + + @override + String get clientTooOld => + 'Ancien client a tenté de se connecter. Mettez l\'app à jour.'; + + @override + String networkConnection(String status) { + return 'Connexion réseau : $status'; + } + + @override + String get failedToGetWifiIp => 'Impossible d\'obtenir l\'adresse IP'; + + @override + String get badOmen => 'Mauvais présage'; + + @override + String badOmensLeft(int count) { + return 'Mauvais présages restants : $count'; + } + + @override + String get corrosiveSpew => 'Crachat corrosif'; + + @override + String get empowersOnTop => 'Renforcés au dessus'; + + @override + String addMinusOneCard(String direction, int count) { + String _temp0 = intl.Intl.selectLogic(direction, { + 'added': 'Ajouter carte -1 (ajoutées : $count)', + 'removed': 'Ajouter carte -1 (retirées : $count)', + 'other': 'Carte -1 ($count)', + }); + return '$_temp0'; + } + + @override + String get removeMinusOneCard => 'Retirer carte -1'; + + @override + String get removeMinusTwoCard => 'Retirer carte -2'; + + @override + String get minusTwoCardRemoved => 'Carte -2 retirée'; + + @override + String get removePlusZeroCard => 'Retirer carte +0'; + + @override + String get plusZeroCardRemoved => 'Carte +0 retirée'; + + @override + String get removeImbue => 'Retirer l\'imprégnation'; + + @override + String get imbue => 'Imprégner'; + + @override + String get advancedImbue => 'Imprégnation avancée'; + + @override + String get removeHailPerk => 'Retirer avantage Grêle'; + + @override + String get addHailPerk => 'Ajouter avantage Grêle'; + + @override + String get removeCassandraPerk => 'Retirer\navantage Cassandra'; + + @override + String get addCassandraPerk => 'Ajouter\navantage Cassandra'; + + @override + String get dontSaveRevealedCards => 'Ne pas garder\nles cartes révélées'; + + @override + String get saveRevealedCards => 'Garder\nles cartes révélées'; + + @override + String removedCountLabel(int count) { + return 'Retirées : $count'; + } + + @override + String get removeDonation => 'Retirer\nle don'; + + @override + String get donateSanctuary => 'Donner au\nsanctuaire'; + + @override + String get removePartyCard => 'Retirer\nla carte groupe :'; + + @override + String get addPartyCard => 'Ajouter\ncarte groupe :'; + + @override + String get perks => 'Avantages'; + + @override + String get revealCards => 'Révéler\nles cartes :'; + + @override + String get revealAll => 'Tout'; + + @override + String get drawExtraCard => 'Piocher une carte supplémentaire'; + + @override + String get extraShuffle => 'Mélange supplémentaire'; + + @override + String get inactivateMonster => 'Désactiver\nle monstre'; + + @override + String get activateMonster => 'Activer\nle monstre'; + + @override + String addEliteStandees(int count, String name) { + return 'Ajouter $count $name élite'; + } + + @override + String addNormalStandees(int count, String name) { + return 'Ajouter $count $name normal'; + } + + @override + String get characterLoot => 'Butin du personnage'; + + @override + String addSpecialCard(int nr) { + return 'Ajouter carte $nr'; + } + + @override + String removeSpecialCard(int nr) { + return 'Retirer carte $nr'; + } + + @override + String get enhanceCards => 'Améliorer les cartes'; + + @override + String get addLootCard => 'Ajouter une carte'; + + @override + String get returnToTop => 'Remettre en haut'; + + @override + String get returnToBottom => 'Remettre en bas'; + + @override + String characterLootTitle(String name) { + return 'Butin de $name :'; + } + + @override + String get setLootOwner => 'Propriétaire du butin :'; + + @override + String get lootNameCoin => 'pièce'; + + @override + String get lootNameHide => 'peau'; + + @override + String get lootNameLumber => 'bois'; + + @override + String get lootNameMetal => 'métal'; + + @override + String get lootNameArrowvine => 'liane-flèche'; + + @override + String get lootNameAxenut => 'noix-hache'; + + @override + String get lootNameCorpsecap => 'chapeau-cadavre'; + + @override + String get lootNameFlamefruit => 'fruit-flamme'; + + @override + String get lootNameRockroot => 'racine-roc'; + + @override + String get lootNameSnowthistle => 'chardon des neiges'; + + @override + String get lootAmount2For2 => '2 pour 2 joueurs'; + + @override + String get lootAmount2For23 => '2 pour 2-3 joueurs'; + + @override + String cmdActivateMonster(String name) { + return 'Activer $name'; + } + + @override + String cmdDeactivateMonster(String name) { + return 'Désactiver $name'; + } + + @override + String cmdAddCharacter(String id) { + return 'Ajouter $id'; + } + + @override + String cmdAddCondition(String condition) { + return 'Ajouter condition : $condition'; + } + + @override + String cmdRemoveCondition(String condition) { + return 'Retirer condition : $condition'; + } + + @override + String cmdAddPartyCard(String character, String type) { + return '$character ajouter carte groupe $type'; + } + + @override + String cmdRemovePartyCard(String character) { + return '$character retirer carte groupe'; + } + + @override + String cmdAddFactionCard(String character) { + return '$character ajouter carte faction'; + } + + @override + String cmdRemoveFactionCard(String character) { + return '$character retirer carte faction'; + } + + @override + String cmdAddLootCard(String type) { + return 'Ajouter carte butin $type'; + } + + @override + String cmdAddMonster(String name) { + return 'Ajouter $name'; + } + + @override + String cmdAddSpecialLootCard(int nr) { + return 'Ajouter carte butin spéciale $nr'; + } + + @override + String cmdRemoveSpecialLootCard(int nr) { + return 'Retirer carte butin spéciale $nr'; + } + + @override + String get cmdAddMinusOne => 'Ajouter moins un'; + + @override + String get cmdRemoveMinusOne => 'Retirer moins un'; + + @override + String get cmdRemoveMinusTwo => 'Retirer moins deux'; + + @override + String get cmdAddBackMinusTwo => 'Remettre moins deux'; + + @override + String get cmdRemovePlusZero => 'Retirer plus zéro'; + + @override + String get cmdAddBackPlusZero => 'Remettre plus zéro'; + + @override + String cmdRevealModifierCards(int count) { + return 'Révéler $count cartes modificateurs'; + } + + @override + String cmdCassandraLeaveRevealed(String deck) { + return 'Laisser les cartes révélées sur le deck $deck'; + } + + @override + String cmdCassandraSpecialOff(String deck) { + return 'Spécial Cassandra désactivé pour deck $deck'; + } + + @override + String get cmdImbueMonsterDeck => 'Imprégner le deck monstres'; + + @override + String get cmdAdvancedImbueMonsterDeck => + 'Imprégnation avancée du deck monstres'; + + @override + String get cmdRemoveImbueMonsterDeck => 'Retirer l\'imprégnation'; + + @override + String get cmdChangeName => 'Changer le nom du personnage'; + + @override + String get cmdAddNoteRow => 'Ajouter une ligne de note'; + + @override + String get cmdSetNoteRowText => 'Modifier la note'; + + @override + String get cmdSetNoteRowColor => 'Changer la couleur de la note'; + + @override + String get cmdLinkNoteRow => 'Lier la ligne de note'; + + @override + String get cmdRemoveNoteRow => 'Supprimer la ligne de note'; + + @override + String get cmdAddBless => 'Ajouter une bénédiction'; + + @override + String get cmdRemoveBless => 'Retirer une bénédiction'; + + @override + String get cmdAddCurse => 'Ajouter une malédiction'; + + @override + String get cmdRemoveCurse => 'Retirer une malédiction'; + + @override + String get cmdAddEmpower => 'Ajouter renforcement'; + + @override + String get cmdRemoveEmpower => 'Retirer renforcement'; + + @override + String get cmdAddEnfeeble => 'Ajouter affaiblissement'; + + @override + String get cmdRemoveEnfeeble => 'Retirer affaiblissement'; + + @override + String cmdIncreaseMaxHealth(String owner) { + return 'Augmenter la vie max de $owner'; + } + + @override + String cmdDecreaseMaxHealth(String owner) { + return 'Diminuer la vie max de $owner'; + } + + @override + String get cmdChangeStat => 'Modifier une statistique'; + + @override + String cmdIncreaseXp(String figure, int amount) { + return 'Augmenter l\'XP de $figure de $amount'; + } + + @override + String cmdDecreaseXp(String figure, int amount) { + return 'Diminuer l\'XP de $figure de $amount'; + } + + @override + String get cmdClearUnlockedClasses => 'Réinitialiser les classes débloquées'; + + @override + String cmdDonateSanctuary(String character) { + return '$character faire un don au sanctuaire'; + } + + @override + String cmdRemoveSanctuaryDonation(String character) { + return 'Retirer le don de $character'; + } + + @override + String get cmdDrawExtraAbilityCard => + 'Piocher une carte capacité supplémentaire'; + + @override + String get cmdDraw => 'Piocher'; + + @override + String get cmdDrawLootCard => 'Piocher une carte butin'; + + @override + String cmdDrawModifierCard(String name) { + return 'Piocher carte modificateur $name'; + } + + @override + String get cmdRemoveLootEnhancement => 'Retirer amélioration butin'; + + @override + String get cmdAddLootEnhancement => 'Ajouter amélioration butin'; + + @override + String get cmdHideAllyDeck => 'Masquer deck allié'; + + @override + String get cmdShowAllyDeck => 'Afficher deck allié'; + + @override + String get cmdIceWraithTurnNormal => 'Spectre des glaces passe en normal'; + + @override + String get cmdIceWraithTurnElite => 'Spectre des glaces passe en élite'; + + @override + String cmdImbueElement(String element) { + return 'Imprégner élément $element'; + } + + @override + String cmdUseElement(String element) { + return 'Utiliser élément $element'; + } + + @override + String cmdLoadCharacter(String name) { + return 'Charger personnage sauvegardé : $name'; + } + + @override + String cmdLoadGame(String name) { + return 'Charger partie sauvegardée : $name'; + } + + @override + String get cmdNextRound => 'Tour suivant'; + + @override + String get cmdRemoveAmdCard => 'Retirer carte AMD'; + + @override + String cmdRemoveCard(String deck, int nr) { + return 'Retirer carte $deck n° $nr'; + } + + @override + String get cmdRemoveAllCharacters => 'Retirer tous les personnages'; + + @override + String cmdRemoveCharacter(String id) { + return 'Retirer $id'; + } + + @override + String get cmdRemoveAllMonsters => 'Retirer tous les monstres'; + + @override + String cmdRemoveMonster(String name) { + return 'Retirer $name'; + } + + @override + String get cmdReorderAbilityCards => 'Réordonner les cartes capacités'; + + @override + String get cmdReorderList => 'Réordonner la liste'; + + @override + String get cmdReorderModifierCards => 'Réordonner les cartes modificateurs'; + + @override + String get cmdReturnLootCard => 'Remettre la carte butin'; + + @override + String get cmdReturnModifierCard => 'Remettre la carte modificateur en haut'; + + @override + String get cmdReturnRemovedAmdCard => 'Remettre la carte AMD retirée'; + + @override + String get cmdNoAllyDeckInOgGloom => + 'Pas de deck allié dans Gloomhaven 1re édition'; + + @override + String get cmdUseAllyDeckInOgGloom => + 'Utiliser deck allié dans Gloomhaven 1re édition'; + + @override + String cmdMarkAsSummon(String owner) { + return 'Marquer $owner comme invoqué'; + } + + @override + String cmdRemoveSummonMark(String owner) { + return 'Retirer la marque d\'invocation de $owner'; + } + + @override + String get cmdAutoLevelOn => 'Activer la mise à jour automatique du niveau'; + + @override + String get cmdAutoLevelOff => + 'Désactiver la mise à jour automatique du niveau'; + + @override + String cmdSetCampaign(String campaign) { + return 'Définir campagne $campaign'; + } + + @override + String cmdSetCharacterLevel(String character) { + return 'Définir le niveau de $character'; + } + + @override + String cmdSetDifficulty(String difficulty) { + return 'Définir la difficulté à $difficulty'; + } + + @override + String cmdSetInitiative(String character) { + return 'Définir l\'initiative de $character'; + } + + @override + String cmdSetCharacterNote(String character) { + return 'Définir la note pour $character'; + } + + @override + String get characterNoteTitle => 'Note'; + + @override + String get characterNoteHint => 'Ajouter une note…'; + + @override + String get characterNoteQuickAdd => 'Note rapide'; + + @override + String cmdSetMonsterLevel(String monster) { + return 'Définir le niveau de $monster'; + } + + @override + String get cmdSetLootOwner => 'Définir le propriétaire du butin'; + + @override + String get cmdSetScenario => 'Définir le scénario'; + + @override + String get cmdSetSoloOn => 'Activer la recommandation niveau solo'; + + @override + String get cmdSetSoloOff => 'Désactiver la recommandation niveau solo'; + + @override + String get cmdExtraAbilityShuffle => 'Mélange supplémentaire deck capacités'; + + @override + String get cmdExtraAmdShuffle => 'Mélange supplémentaire deck AMD'; + + @override + String get cmdDrawnAbilityShuffle => 'Mélange deck capacités piochées'; + + @override + String get cmdDontTrackStandees => 'Ne pas suivre les figurines'; + + @override + String get cmdTrackStandees => 'Suivre les figurines'; + + @override + String cmdTurnDone(String id) { + return 'Tour de $id terminé'; + } + + @override + String cmdAddPerk(String character, int index) { + return 'Ajouter avantage $index de \'$character\''; + } + + @override + String cmdRemovePerk(String character, int index) { + return 'Retirer avantage $index de \'$character\''; + } + + @override + String cmdUnlock(String id) { + return 'Débloquer $id'; + } + + @override + String cmdLock(String id) { + return 'Verrouiller $id'; + } + + @override + String get cmdSetLevel => 'Définir le niveau'; + + @override + String get cmdAddSection => 'Ajouter une section'; + + @override + String cmdAddStandee(String name, int nr) { + return 'Ajouter $name $nr'; + } + + @override + String get cmdDrawMonsterModifierCard => 'Piocher carte modificateur monstre'; + + @override + String cmdIncreaseHealth(String figure, int amount) { + return 'Augmenter la vie de $figure de $amount'; + } + + @override + String cmdKill(String owner) { + return 'Éliminer $owner'; + } + + @override + String cmdDecreaseHealth(String owner, int amount) { + return 'Diminuer la vie de $owner de $amount'; + } + + @override + String cmdUseFhPerks(String character) { + return '$character utiliser avantages Frosthaven'; + } + + @override + String cmdDontUseFhPerks(String character) { + return '$character ne pas utiliser avantages Frosthaven'; + } + + @override + String get cmdRemoveNoCharacters => 'Aucun personnage retiré'; + + @override + String get cmdRemoveNoMonsters => 'Aucun monstre retiré'; +} diff --git a/server/lib/core/l10n/app_localizations_ko.dart b/server/lib/core/l10n/app_localizations_ko.dart new file mode 100644 index 0000000..2e71f79 --- /dev/null +++ b/server/lib/core/l10n/app_localizations_ko.dart @@ -0,0 +1,1150 @@ +// ignore: unused_import +import 'package:intl/intl.dart' as intl; +import 'app_localizations.dart'; + +// ignore_for_file: type=lint + +/// The translations for Korean (`ko`). +class AppLocalizationsKo extends AppLocalizations { + AppLocalizationsKo([String locale = 'ko']) : super(locale); + + @override + String get menuSetScenario => '시나리오 설정'; + + @override + String get menuAddCharacter => '캐릭터 추가'; + + @override + String get menuRemoveCharacters => '캐릭터 제거'; + + @override + String get menuSetLevel => '레벨 설정'; + + @override + String get menuLootDeck => '전리품 덱 메뉴'; + + @override + String get menuAddMonsters => '몬스터 추가'; + + @override + String get menuRemoveMonsters => '몬스터 제거'; + + @override + String get menuShowAllyDeck => '동맹 수정 덱 표시'; + + @override + String get menuHideAllyDeck => '동맹 수정 덱 숨기기'; + + @override + String get menuSettings => '설정'; + + @override + String get menuDocumentation => '도움말'; + + @override + String get menuDonate => '기부'; + + @override + String get menuExit => '종료'; + + @override + String get menuAddSection => '섹션 추가'; + + @override + String get menuAddRandomDungeonCard => '무작위 던전 카드 추가'; + + @override + String get menuActionLog => '작업 기록 보기'; + + @override + String get actionLogTitle => '최근 20개 작업'; + + @override + String get actionLogEmpty => '아직 작업이 없습니다'; + + @override + String get actionLogRollbackHint => '작업을 탭하여 되돌리기'; + + @override + String get actionLogRollbackTitle => '되돌리시겠습니까?'; + + @override + String actionLogRollbackBody(String action, int count) { + return '\"$action\"(으)로 되돌리시겠습니까? 이후 $count개의 작업이 취소됩니다. 변경하기 전까지 다시 실행할 수 있습니다.'; + } + + @override + String get actionLogRollbackConfirm => '되돌리기'; + + @override + String get menuAddNoteRow => '메모 행 추가'; + + @override + String get noteRowTitle => '메모'; + + @override + String get noteRowHint => '메모 내용…'; + + @override + String get noteRowColourLabel => '색상'; + + @override + String get noteRowConnectLabel => '연결 대상:'; + + @override + String get noteRowConnectNone => '없음 (자유 메모)'; + + @override + String get noteRowConnectPlayer => '플레이어'; + + @override + String get noteRowConnectMonster => '몬스터'; + + @override + String get noteRowWholeGroup => '전체 그룹'; + + @override + String get noteRowAll => '전체'; + + @override + String noteRowStandeeNr(int nr) { + return '스탠디 $nr'; + } + + @override + String get noteRowAddFromMenu => '메모 추가'; + + @override + String get noteRowDelete => '메모 삭제'; + + @override + String get undo => '실행 취소'; + + @override + String undoWithDescription(String description) { + return '실행 취소: $description'; + } + + @override + String get redo => '다시 실행'; + + @override + String redoWithDescription(String description) { + return '다시 실행: $description'; + } + + @override + String versionLabel(String version) { + return '버전 $version'; + } + + @override + String get connectedAsClient => '클라이언트로 연결됨'; + + @override + String get connecting => '연결 중…'; + + @override + String get cancelConnect => 'Cancel'; + + @override + String get connectionCancelled => 'Connection cancelled'; + + @override + String connectAsClientWithIp(String ip) { + return '클라이언트로 연결 ($ip)'; + } + + @override + String get connectAsClientLabel => '클라이언트로 연결'; + + @override + String stopServerWithIp(String ip) { + return '서버 중지 $ip'; + } + + @override + String startHostServerWithIp(String ip) { + return '서버 시작 $ip'; + } + + @override + String get stopServerButton => '서버 중지'; + + @override + String get startHostServerButton => '호스트 서버 시작'; + + @override + String get networkConnectLocal => '로컬 Wi-Fi로 기기 연결:'; + + @override + String get networkServerIpHint => '서버 IP 주소'; + + @override + String get networkPortHint => '포트'; + + @override + String get settingsLanguage => '언어:'; + + @override + String get settingsDarkMode => '다크 모드'; + + @override + String get settingsSoftNumpad => '소프트 숫자 키패드'; + + @override + String get settingsNoInit => '선제권 묻지 않기'; + + @override + String get settingsExpireConditions => '상태 이상 만료'; + + @override + String get settingsNoStandees => '스탠디 추적 안 함'; + + @override + String get settingsAutoAddStandees => '스탠디 자동 추가'; + + @override + String get settingsAutoAddSpawns => '소환물 자동 추가'; + + @override + String get settingsRandomStandees => '무작위 스탠디'; + + @override + String get settingsNoCalculations => '자동 계산 없음'; + + @override + String get settingsHideLootDeck => '전리품 덱 숨기기'; + + @override + String get settingsShimmer => '스탯 카드 텍스트 반짝임'; + + @override + String get settingsPowerModeLabel => 'Power saving'; + + @override + String get powerModeNormal => 'Normal'; + + @override + String get powerModeDimWhenIdle => 'Dim when idle'; + + @override + String get settingsPowerModeInfoTitle => 'Power saving'; + + @override + String get settingsPowerModeInfo => + 'Three levels of battery saving, from none to most.\n\nNormal — the screen is held awake at full brightness for as long as the app is open. Nothing is dimmed and nothing sleeps. Best while you are actively playing.\n\nDim when idle — the screen is still held awake and the app never locks, but after 30 seconds without input the board dims. The board stays readable from across the table, and a single tap brings it straight back with nothing lost. Good for a game in progress that you glance at between turns.\n\nReduce power use — hands the screen back to your device, so it dims and turns off on its own schedule and you unlock to return. Also lowers drawing quality to save more: card and monster box shadows become hard-edged instead of softly blurred, icons are filtered more cheaply, and shimmering text effects are turned off. Best for infrequent use and low battery capacity devices.\n\nNothing about how the game works changes at any level — no tracking, syncing or rules behaviour is affected.'; + + @override + String get settingsReducePower => 'Reduce power use'; + + @override + String get settingsReducePowerInfoTitle => 'Reduce power use'; + + @override + String get settingsReducePowerInfo => + 'Saves battery by doing less drawing work, at the cost of some visual polish.\n\nWhat changes:\n\n• The screen is allowed to dim and turn off on its own. Normally this app keeps it awake the whole time it is open, which is by far the biggest drain on a phone or tablet.\n\n• Card and monster box shadows become hard-edged instead of softly blurred.\n\n• Icons are filtered more cheaply. You may notice slightly rougher edges on small images.\n\n• Shimmering text effects are turned off.\n\nNothing about how the game works changes — no tracking, syncing or rules behaviour is affected. You can turn this off again at any time.'; + + @override + String get settingsFhHazTerrainCalc => '원본 Gloomhaven에서 Frosthaven 위험 지형 계산'; + + @override + String get settingsAllyDeckOGGloom => '원본 Gloomhaven 동맹 수정 덱'; + + @override + String get settingsShowScenarioNames => '시나리오 이름 표시'; + + @override + String get settingsShowBattleGoalReminder => '전투 목표 알림 표시'; + + @override + String get settingsShowCustomContent => '커스텀 컨텐츠 표시'; + + @override + String get settingsShowSections => '메인 화면 섹션 표시'; + + @override + String get settingsShowReminders => '특수 규칙 알림 표시'; + + @override + String get settingsShowAmdDeck => '공격 수정 덱 표시'; + + @override + String get settingsShowCharacterAmd => '캐릭터 수정 덱 표시'; + + @override + String get settingsHealthWheel => 'HP 휠: 좌우로 드래그하여 변경'; + + @override + String get settingsFullscreen => '전체 화면'; + + @override + String get settingsMainListScaling => '메인 목록 크기:'; + + @override + String get settingsAppBarScaling => '앱 바 크기:'; + + @override + String get settingsStyleLabel => '스타일:'; + + @override + String get styleFrosthaven => 'Frosthaven'; + + @override + String get styleOriginal => '오리지널'; + + @override + String get settingsClearUnlocked => '해금된 캐릭터 및 컨텐츠 초기화'; + + @override + String get settingsUnlockSpecials => '특수 잠금 해제'; + + @override + String get settingsLoadSaveState => '상태 불러오기/저장'; + + @override + String get noResultsFound => '결과 없음'; + + @override + String get close => '닫기'; + + @override + String get retry => '재시도'; + + @override + String get specialUnlocks => '특수 잠금 해제'; + + @override + String get loadSaveDeleteCharacters => '캐릭터를 불러오거나 저장하거나 삭제합니다.'; + + @override + String get loadAddDeleteSaves => '저장 상태를 불러오거나 추가하거나 삭제합니다.'; + + @override + String get addNewSave => '새 저장'; + + @override + String get addNewSaveLabel => '새 저장:'; + + @override + String get loadButton => '불러오기'; + + @override + String get saveButton => '저장'; + + @override + String get deleteButton => '삭제'; + + @override + String get setSaveName => '저장 이름:'; + + @override + String get loadOrSaveCharacters => '캐릭터 불러오기 또는 저장'; + + @override + String get loadCharacter => '캐릭터 불러오기:'; + + @override + String get removeAll => '모두 제거'; + + @override + String get removeCardQuestion => '카드를 제거할까요?'; + + @override + String get sendToBottom => '아래로 보내기'; + + @override + String get shuffleUndrawnCards => '미사용 카드 섞기'; + + @override + String get returnToDiscardPile => '버린 카드 더미로 반환'; + + @override + String get returnToDrawPile => '덱으로 반환'; + + @override + String get addExtraLootCard => '추가 전리품 카드 추가'; + + @override + String get addStandeeNr => '스탠디 번호 추가'; + + @override + String get summonedLabel => '소환물:'; + + @override + String get characterDecks => '캐릭터 덱'; + + @override + String get shuffleAndDraw => '섞기\n및 뽑기'; + + @override + String get draw => '뽑기'; + + @override + String get nextRound => ' 다음\n라운드'; + + @override + String get returnTopCard => '맨 위 카드 반환'; + + @override + String removeCardWithDetails(String title, int nr) { + return '$title 제거\n(카드 번호: $nr)'; + } + + @override + String get tapCardToAddToDeck => '카드를 탭하여 덱에 추가'; + + @override + String get removeCardFromDeckQuestion => '덱에서 카드를 제거할까요?'; + + @override + String get changeName => '이름 변경:'; + + @override + String get showBosses => '보스 표시'; + + @override + String get showScenarioSpecialMonsters => '시나리오 특수 몬스터 표시'; + + @override + String get addAsAlly => '동맹으로 추가'; + + @override + String get addMonsterLabel => '몬스터 추가'; + + @override + String get allCampaigns => '모든 캠페인'; + + @override + String get showMonstersFrom => ' 다음에서 몬스터 표시: '; + + @override + String setMonsterLevel(String name) { + return '$name 레벨'; + } + + @override + String setSummonHealth(String name) { + return '$name 최대 HP'; + } + + @override + String get setScenarioLevel => '시나리오 레벨'; + + @override + String enhancedLevel(String level) { + return '강화됨: $level'; + } + + @override + String get soloLabel => '솔로:'; + + @override + String get automaticScenarioLevel => '자동 시나리오 레벨:'; + + @override + String get difficultyLabel => '난이도:'; + + @override + String get lootCardEnhancements => '전리품 카드 강화'; + + @override + String get addPerks => '특전 추가'; + + @override + String get useFrosthavenPerks => 'Frosthaven 특전 사용'; + + @override + String currentCampaign(String campaign) { + return '현재 캠페인: $campaign'; + } + + @override + String get addCharacterHint => '캐릭터 추가 (숨겨진 클래스는 이름 입력)'; + + @override + String get trapDamage => '함정 피해'; + + @override + String get hazardousTerrainDamage => '위험 지형 피해'; + + @override + String get experienceAdded => '경험치 추가'; + + @override + String get goldCoinValue => '금화 가치'; + + @override + String get levelLegendLabel => '레벨'; + + @override + String get saveStateNote => + '앱은 매 행동 후 자동으로 저장됩니다. 이 저장 파일들은 백업 또는 여러 캠페인 진행용입니다.'; + + @override + String clientConnectedTo(String address) { + return '클라이언트 연결됨: $address'; + } + + @override + String clientError(String error) { + return '클라이언트 오류: $error'; + } + + @override + String clientListenError(String error) { + return '클라이언트 수신 오류: $error'; + } + + @override + String get lostConnectionToServer => '서버 연결이 끊겼습니다'; + + @override + String get stateMismatch => '상태가 최신이 아닙니다. 다시 시도하세요.'; + + @override + String get serverUnresponsive => '서버가 응답하지 않습니다. 클라이언트 연결 해제.'; + + @override + String get clientDisconnected => '클라이언트 연결 해제'; + + @override + String get serverOffline => '서버 오프라인'; + + @override + String get clientLeft => '클라이언트가 떠났습니다.'; + + @override + String get clientTooOld => '오래된 클라이언트가 연결을 시도했습니다. 앱을 업데이트하세요.'; + + @override + String networkConnection(String status) { + return '네트워크 연결: $status'; + } + + @override + String get failedToGetWifiIp => 'IP 주소를 가져오지 못했습니다'; + + @override + String get badOmen => '불길한 징조'; + + @override + String badOmensLeft(int count) { + return '남은 불길한 징조: $count'; + } + + @override + String get corrosiveSpew => '부식성 분출'; + + @override + String get empowersOnTop => '강화 카드 맨 위에'; + + @override + String addMinusOneCard(String direction, int count) { + String _temp0 = intl.Intl.selectLogic(direction, { + 'added': '-1 카드 추가 (추가됨: $count)', + 'removed': '-1 카드 추가 (제거됨: $count)', + 'other': '-1 카드 ($count)', + }); + return '$_temp0'; + } + + @override + String get removeMinusOneCard => '-1 카드 제거'; + + @override + String get removeMinusTwoCard => '-2 카드 제거'; + + @override + String get minusTwoCardRemoved => '-2 카드 제거됨'; + + @override + String get removePlusZeroCard => '+0 카드 제거'; + + @override + String get plusZeroCardRemoved => '+0 카드 제거됨'; + + @override + String get removeImbue => '주입 제거'; + + @override + String get imbue => '주입'; + + @override + String get advancedImbue => '고급 주입'; + + @override + String get removeHailPerk => '우박 특전 제거'; + + @override + String get addHailPerk => '우박 특전 추가'; + + @override + String get removeCassandraPerk => '카산드라\n특전 제거'; + + @override + String get addCassandraPerk => '카산드라\n특전 추가'; + + @override + String get dontSaveRevealedCards => '공개된 카드\n저장 안 함'; + + @override + String get saveRevealedCards => '공개된 카드\n저장'; + + @override + String removedCountLabel(int count) { + return '제거됨: $count'; + } + + @override + String get removeDonation => '기부\n제거'; + + @override + String get donateSanctuary => '성소에\n기부'; + + @override + String get removePartyCard => '그룹 카드\n제거:'; + + @override + String get addPartyCard => '그룹 카드\n추가:'; + + @override + String get perks => '특전'; + + @override + String get revealCards => '카드\n공개:'; + + @override + String get revealAll => '전체'; + + @override + String get drawExtraCard => '추가 카드 뽑기'; + + @override + String get extraShuffle => '추가 섞기'; + + @override + String get inactivateMonster => '몬스터\n비활성화'; + + @override + String get activateMonster => '몬스터\n활성화'; + + @override + String addEliteStandees(int count, String name) { + return '엘리트 $name $count개 추가'; + } + + @override + String addNormalStandees(int count, String name) { + return '일반 $name $count개 추가'; + } + + @override + String get characterLoot => '캐릭터 전리품'; + + @override + String addSpecialCard(int nr) { + return '$nr번 카드 추가'; + } + + @override + String removeSpecialCard(int nr) { + return '$nr번 카드 제거'; + } + + @override + String get enhanceCards => '카드 강화'; + + @override + String get addLootCard => '카드 추가'; + + @override + String get returnToTop => '맨 위로 반환'; + + @override + String get returnToBottom => '맨 아래로 반환'; + + @override + String characterLootTitle(String name) { + return '$name의 전리품:'; + } + + @override + String get setLootOwner => '전리품 소유자:'; + + @override + String get lootNameCoin => '동전'; + + @override + String get lootNameHide => '가죽'; + + @override + String get lootNameLumber => '목재'; + + @override + String get lootNameMetal => '금속'; + + @override + String get lootNameArrowvine => '화살나무'; + + @override + String get lootNameAxenut => '도끼열매'; + + @override + String get lootNameCorpsecap => '시체버섯'; + + @override + String get lootNameFlamefruit => '화염과일'; + + @override + String get lootNameRockroot => '암석뿌리'; + + @override + String get lootNameSnowthistle => '눈엉겅퀴'; + + @override + String get lootAmount2For2 => '2인용 2개'; + + @override + String get lootAmount2For23 => '2~3인용 2개'; + + @override + String cmdActivateMonster(String name) { + return '$name 활성화'; + } + + @override + String cmdDeactivateMonster(String name) { + return '$name 비활성화'; + } + + @override + String cmdAddCharacter(String id) { + return '$id 추가'; + } + + @override + String cmdAddCondition(String condition) { + return '상태 이상 추가: $condition'; + } + + @override + String cmdRemoveCondition(String condition) { + return '상태 이상 제거: $condition'; + } + + @override + String cmdAddPartyCard(String character, String type) { + return '$character 그룹 카드 $type 추가'; + } + + @override + String cmdRemovePartyCard(String character) { + return '$character 그룹 카드 제거'; + } + + @override + String cmdAddFactionCard(String character) { + return '$character 파벌 카드 추가'; + } + + @override + String cmdRemoveFactionCard(String character) { + return '$character 파벌 카드 제거'; + } + + @override + String cmdAddLootCard(String type) { + return '전리품 카드 $type 추가'; + } + + @override + String cmdAddMonster(String name) { + return '$name 추가'; + } + + @override + String cmdAddSpecialLootCard(int nr) { + return '특수 전리품 카드 $nr 추가'; + } + + @override + String cmdRemoveSpecialLootCard(int nr) { + return '특수 전리품 카드 $nr 제거'; + } + + @override + String get cmdAddMinusOne => '마이너스 원 추가'; + + @override + String get cmdRemoveMinusOne => '마이너스 원 제거'; + + @override + String get cmdRemoveMinusTwo => '마이너스 투 제거'; + + @override + String get cmdAddBackMinusTwo => '마이너스 투 복원'; + + @override + String get cmdRemovePlusZero => '플러스 제로 제거'; + + @override + String get cmdAddBackPlusZero => '플러스 제로 복원'; + + @override + String cmdRevealModifierCards(int count) { + return '수정 카드 $count장 공개'; + } + + @override + String cmdCassandraLeaveRevealed(String deck) { + return '$deck 덱 위에 공개 카드 유지'; + } + + @override + String cmdCassandraSpecialOff(String deck) { + return '$deck 덱의 카산드라 특수 비활성화'; + } + + @override + String get cmdImbueMonsterDeck => '몬스터 덱 주입'; + + @override + String get cmdAdvancedImbueMonsterDeck => '몬스터 덱 고급 주입'; + + @override + String get cmdRemoveImbueMonsterDeck => '주입 제거'; + + @override + String get cmdChangeName => '캐릭터 이름 변경'; + + @override + String get cmdAddNoteRow => '메모 행 추가'; + + @override + String get cmdSetNoteRowText => '메모 편집'; + + @override + String get cmdSetNoteRowColor => '메모 색상 변경'; + + @override + String get cmdLinkNoteRow => '메모 행 연결'; + + @override + String get cmdRemoveNoteRow => '메모 행 제거'; + + @override + String get cmdAddBless => '축복 추가'; + + @override + String get cmdRemoveBless => '축복 제거'; + + @override + String get cmdAddCurse => '저주 추가'; + + @override + String get cmdRemoveCurse => '저주 제거'; + + @override + String get cmdAddEmpower => '강화 추가'; + + @override + String get cmdRemoveEmpower => '강화 제거'; + + @override + String get cmdAddEnfeeble => '약화 추가'; + + @override + String get cmdRemoveEnfeeble => '약화 제거'; + + @override + String cmdIncreaseMaxHealth(String owner) { + return '$owner 최대 HP 증가'; + } + + @override + String cmdDecreaseMaxHealth(String owner) { + return '$owner 최대 HP 감소'; + } + + @override + String get cmdChangeStat => '스탯 변경'; + + @override + String cmdIncreaseXp(String figure, int amount) { + return '$figure 경험치 $amount 증가'; + } + + @override + String cmdDecreaseXp(String figure, int amount) { + return '$figure 경험치 $amount 감소'; + } + + @override + String get cmdClearUnlockedClasses => '해금된 클래스 초기화'; + + @override + String cmdDonateSanctuary(String character) { + return '$character 성소에 기부'; + } + + @override + String cmdRemoveSanctuaryDonation(String character) { + return '$character 기부 제거'; + } + + @override + String get cmdDrawExtraAbilityCard => '추가 능력 카드 뽑기'; + + @override + String get cmdDraw => '뽑기'; + + @override + String get cmdDrawLootCard => '전리품 카드 뽑기'; + + @override + String cmdDrawModifierCard(String name) { + return '$name 수정 카드 뽑기'; + } + + @override + String get cmdRemoveLootEnhancement => '전리품 강화 제거'; + + @override + String get cmdAddLootEnhancement => '전리품 강화 추가'; + + @override + String get cmdHideAllyDeck => '동맹 덱 숨기기'; + + @override + String get cmdShowAllyDeck => '동맹 덱 표시'; + + @override + String get cmdIceWraithTurnNormal => '얼음 망령 일반으로 전환'; + + @override + String get cmdIceWraithTurnElite => '얼음 망령 엘리트로 전환'; + + @override + String cmdImbueElement(String element) { + return '$element 원소 주입'; + } + + @override + String cmdUseElement(String element) { + return '$element 원소 사용'; + } + + @override + String cmdLoadCharacter(String name) { + return '저장된 캐릭터 불러오기: $name'; + } + + @override + String cmdLoadGame(String name) { + return '저장된 게임 불러오기: $name'; + } + + @override + String get cmdNextRound => '다음 라운드'; + + @override + String get cmdRemoveAmdCard => 'AMD 카드 제거'; + + @override + String cmdRemoveCard(String deck, int nr) { + return '$deck $nr번 카드 제거'; + } + + @override + String get cmdRemoveAllCharacters => '모든 캐릭터 제거'; + + @override + String cmdRemoveCharacter(String id) { + return '$id 제거'; + } + + @override + String get cmdRemoveAllMonsters => '모든 몬스터 제거'; + + @override + String cmdRemoveMonster(String name) { + return '$name 제거'; + } + + @override + String get cmdReorderAbilityCards => '능력 카드 순서 변경'; + + @override + String get cmdReorderList => '목록 순서 변경'; + + @override + String get cmdReorderModifierCards => '수정 카드 순서 변경'; + + @override + String get cmdReturnLootCard => '전리품 카드 반환'; + + @override + String get cmdReturnModifierCard => '수정 카드 맨 위로 반환'; + + @override + String get cmdReturnRemovedAmdCard => '제거된 AMD 카드 반환'; + + @override + String get cmdNoAllyDeckInOgGloom => '원본 Gloomhaven에 동맹 덱 없음'; + + @override + String get cmdUseAllyDeckInOgGloom => '원본 Gloomhaven에서 동맹 덱 사용'; + + @override + String cmdMarkAsSummon(String owner) { + return '$owner를 소환물로 표시'; + } + + @override + String cmdRemoveSummonMark(String owner) { + return '$owner의 소환 표시 제거'; + } + + @override + String get cmdAutoLevelOn => '자동 레벨 업데이트 활성화'; + + @override + String get cmdAutoLevelOff => '자동 레벨 업데이트 비활성화'; + + @override + String cmdSetCampaign(String campaign) { + return '$campaign 캠페인 설정'; + } + + @override + String cmdSetCharacterLevel(String character) { + return '$character 레벨 설정'; + } + + @override + String cmdSetDifficulty(String difficulty) { + return '난이도 $difficulty 설정'; + } + + @override + String cmdSetInitiative(String character) { + return '$character 선제권 설정'; + } + + @override + String cmdSetCharacterNote(String character) { + return '$character의 메모 설정'; + } + + @override + String get characterNoteTitle => '메모'; + + @override + String get characterNoteHint => '메모 추가…'; + + @override + String get characterNoteQuickAdd => '빠른 메모'; + + @override + String cmdSetMonsterLevel(String monster) { + return '$monster 레벨 설정'; + } + + @override + String get cmdSetLootOwner => '전리품 소유자 설정'; + + @override + String get cmdSetScenario => '시나리오 설정'; + + @override + String get cmdSetSoloOn => '솔로 레벨 추천 활성화'; + + @override + String get cmdSetSoloOff => '솔로 레벨 추천 비활성화'; + + @override + String get cmdExtraAbilityShuffle => '능력 덱 추가 섞기'; + + @override + String get cmdExtraAmdShuffle => 'AMD 덱 추가 섞기'; + + @override + String get cmdDrawnAbilityShuffle => '뽑힌 능력 덱 섞기'; + + @override + String get cmdDontTrackStandees => '스탠디 추적 안 함'; + + @override + String get cmdTrackStandees => '스탠디 추적'; + + @override + String cmdTurnDone(String id) { + return '$id 턴 완료'; + } + + @override + String cmdAddPerk(String character, int index) { + return '\'$character\'의 $index번 특전 추가'; + } + + @override + String cmdRemovePerk(String character, int index) { + return '\'$character\'의 $index번 특전 제거'; + } + + @override + String cmdUnlock(String id) { + return '$id 잠금 해제'; + } + + @override + String cmdLock(String id) { + return '$id 잠금'; + } + + @override + String get cmdSetLevel => '레벨 설정'; + + @override + String get cmdAddSection => '섹션 추가'; + + @override + String cmdAddStandee(String name, int nr) { + return '$name $nr 추가'; + } + + @override + String get cmdDrawMonsterModifierCard => '몬스터 수정 카드 뽑기'; + + @override + String cmdIncreaseHealth(String figure, int amount) { + return '$figure HP $amount 증가'; + } + + @override + String cmdKill(String owner) { + return '$owner 처치'; + } + + @override + String cmdDecreaseHealth(String owner, int amount) { + return '$owner HP $amount 감소'; + } + + @override + String cmdUseFhPerks(String character) { + return '$character Frosthaven 특전 사용'; + } + + @override + String cmdDontUseFhPerks(String character) { + return '$character Frosthaven 특전 미사용'; + } + + @override + String get cmdRemoveNoCharacters => '제거된 캐릭터 없음'; + + @override + String get cmdRemoveNoMonsters => '제거된 몬스터 없음'; +} diff --git a/server/lib/core/l10n/app_localizations_pl.dart b/server/lib/core/l10n/app_localizations_pl.dart new file mode 100644 index 0000000..242acb7 --- /dev/null +++ b/server/lib/core/l10n/app_localizations_pl.dart @@ -0,0 +1,1161 @@ +// ignore: unused_import +import 'package:intl/intl.dart' as intl; +import 'app_localizations.dart'; + +// ignore_for_file: type=lint + +/// The translations for Polish (`pl`). +class AppLocalizationsPl extends AppLocalizations { + AppLocalizationsPl([String locale = 'pl']) : super(locale); + + @override + String get menuSetScenario => 'Ustaw scenariusz'; + + @override + String get menuAddCharacter => 'Dodaj postać'; + + @override + String get menuRemoveCharacters => 'Usuń postacie'; + + @override + String get menuSetLevel => 'Ustaw poziom'; + + @override + String get menuLootDeck => 'Menu talii łupów'; + + @override + String get menuAddMonsters => 'Dodaj potwory'; + + @override + String get menuRemoveMonsters => 'Usuń potwory'; + + @override + String get menuShowAllyDeck => 'Pokaż talię modyfikatorów sojusznika'; + + @override + String get menuHideAllyDeck => 'Ukryj talię modyfikatorów sojusznika'; + + @override + String get menuSettings => 'Ustawienia'; + + @override + String get menuDocumentation => 'Dokumentacja'; + + @override + String get menuDonate => 'Przekaż darowiznę'; + + @override + String get menuExit => 'Wyjdź'; + + @override + String get menuAddSection => 'Dodaj sekcję'; + + @override + String get menuAddRandomDungeonCard => 'Dodaj losową kartę lochu'; + + @override + String get menuActionLog => 'Pokaż dziennik akcji'; + + @override + String get actionLogTitle => 'Ostatnie 20 akcji'; + + @override + String get actionLogEmpty => 'Brak akcji'; + + @override + String get actionLogRollbackHint => 'Dotknij akcji, aby do niej wrócić'; + + @override + String get actionLogRollbackTitle => 'Cofnąć?'; + + @override + String actionLogRollbackBody(String action, int count) { + return 'Cofnąć do \"$action\"? Odwróci to $count późniejszych akcji. Możesz je ponowić, dopóki nie wprowadzisz zmiany.'; + } + + @override + String get actionLogRollbackConfirm => 'Cofnij'; + + @override + String get menuAddNoteRow => 'Dodaj wiersz notatki'; + + @override + String get noteRowTitle => 'Notatka'; + + @override + String get noteRowHint => 'Treść notatki…'; + + @override + String get noteRowColourLabel => 'Kolor'; + + @override + String get noteRowConnectLabel => 'Połącz z:'; + + @override + String get noteRowConnectNone => 'Nic (wolna notatka)'; + + @override + String get noteRowConnectPlayer => 'Gracz'; + + @override + String get noteRowConnectMonster => 'Potwór'; + + @override + String get noteRowWholeGroup => 'Cała grupa'; + + @override + String get noteRowAll => 'Wszystkie'; + + @override + String noteRowStandeeNr(int nr) { + return 'Figurka $nr'; + } + + @override + String get noteRowAddFromMenu => 'Dodaj notatkę'; + + @override + String get noteRowDelete => 'Usuń notatkę'; + + @override + String get undo => 'Cofnij'; + + @override + String undoWithDescription(String description) { + return 'Cofnij: $description'; + } + + @override + String get redo => 'Ponów'; + + @override + String redoWithDescription(String description) { + return 'Ponów: $description'; + } + + @override + String versionLabel(String version) { + return 'Wersja $version'; + } + + @override + String get connectedAsClient => 'Połączono jako klient'; + + @override + String get connecting => 'Łączenie…'; + + @override + String get cancelConnect => 'Cancel'; + + @override + String get connectionCancelled => 'Connection cancelled'; + + @override + String connectAsClientWithIp(String ip) { + return 'Połącz jako klient ($ip)'; + } + + @override + String get connectAsClientLabel => 'Połącz jako klient'; + + @override + String stopServerWithIp(String ip) { + return 'Zatrzymaj serwer $ip'; + } + + @override + String startHostServerWithIp(String ip) { + return 'Uruchom serwer $ip'; + } + + @override + String get stopServerButton => 'Zatrzymaj serwer'; + + @override + String get startHostServerButton => 'Uruchom serwer hosta'; + + @override + String get networkConnectLocal => + 'Połącz urządzenia przez lokalną sieć Wi-Fi:'; + + @override + String get networkServerIpHint => 'adres IP serwera'; + + @override + String get networkPortHint => 'port'; + + @override + String get settingsLanguage => 'Język:'; + + @override + String get settingsDarkMode => 'Tryb ciemny'; + + @override + String get settingsSoftNumpad => 'Programowa klawiatura numeryczna'; + + @override + String get settingsNoInit => 'Nie pytaj o inicjatywę'; + + @override + String get settingsExpireConditions => 'Wygasanie stanów'; + + @override + String get settingsNoStandees => 'Nie śledź pionków'; + + @override + String get settingsAutoAddStandees => 'Automatycznie dodawaj pionki'; + + @override + String get settingsAutoAddSpawns => 'Automatycznie dodawaj przywoływanych'; + + @override + String get settingsRandomStandees => 'Losowe pionki'; + + @override + String get settingsNoCalculations => 'Bez obliczeń'; + + @override + String get settingsHideLootDeck => 'Ukryj talię łupów'; + + @override + String get settingsShimmer => 'Migotanie tekstu na kartach statystyk'; + + @override + String get settingsPowerModeLabel => 'Power saving'; + + @override + String get powerModeNormal => 'Normal'; + + @override + String get powerModeDimWhenIdle => 'Dim when idle'; + + @override + String get settingsPowerModeInfoTitle => 'Power saving'; + + @override + String get settingsPowerModeInfo => + 'Three levels of battery saving, from none to most.\n\nNormal — the screen is held awake at full brightness for as long as the app is open. Nothing is dimmed and nothing sleeps. Best while you are actively playing.\n\nDim when idle — the screen is still held awake and the app never locks, but after 30 seconds without input the board dims. The board stays readable from across the table, and a single tap brings it straight back with nothing lost. Good for a game in progress that you glance at between turns.\n\nReduce power use — hands the screen back to your device, so it dims and turns off on its own schedule and you unlock to return. Also lowers drawing quality to save more: card and monster box shadows become hard-edged instead of softly blurred, icons are filtered more cheaply, and shimmering text effects are turned off. Best for infrequent use and low battery capacity devices.\n\nNothing about how the game works changes at any level — no tracking, syncing or rules behaviour is affected.'; + + @override + String get settingsReducePower => 'Reduce power use'; + + @override + String get settingsReducePowerInfoTitle => 'Reduce power use'; + + @override + String get settingsReducePowerInfo => + 'Saves battery by doing less drawing work, at the cost of some visual polish.\n\nWhat changes:\n\n• The screen is allowed to dim and turn off on its own. Normally this app keeps it awake the whole time it is open, which is by far the biggest drain on a phone or tablet.\n\n• Card and monster box shadows become hard-edged instead of softly blurred.\n\n• Icons are filtered more cheaply. You may notice slightly rougher edges on small images.\n\n• Shimmering text effects are turned off.\n\nNothing about how the game works changes — no tracking, syncing or rules behaviour is affected. You can turn this off again at any time.'; + + @override + String get settingsFhHazTerrainCalc => + 'Obliczenia niebezp. terenu z Frosthaven w orig. Gloomhaven'; + + @override + String get settingsAllyDeckOGGloom => + 'Talia modyfikatorów sojusznika w orig. Gloomhaven'; + + @override + String get settingsShowScenarioNames => 'Pokaż nazwy scenariuszy'; + + @override + String get settingsShowBattleGoalReminder => + 'Pokaż przypomnienie o celu bitewnym'; + + @override + String get settingsShowCustomContent => 'Pokaż zawartość niestandardową'; + + @override + String get settingsShowSections => 'Pokaż sekcje na głównym ekranie'; + + @override + String get settingsShowReminders => 'Pokaż przypomnienia specjalnych zasad'; + + @override + String get settingsShowAmdDeck => 'Pokaż talie modyfikatorów ataku'; + + @override + String get settingsShowCharacterAmd => 'Pokaż talie modyfikatorów postaci'; + + @override + String get settingsHealthWheel => + 'Koło życia: przeciągnij lewo-prawo by zmienić'; + + @override + String get settingsFullscreen => 'Pełny ekran'; + + @override + String get settingsMainListScaling => 'Skalowanie listy głównej:'; + + @override + String get settingsAppBarScaling => 'Skalowanie paska aplikacji:'; + + @override + String get settingsStyleLabel => 'Styl:'; + + @override + String get styleFrosthaven => 'Frosthaven'; + + @override + String get styleOriginal => 'Oryginalny'; + + @override + String get settingsClearUnlocked => + 'Wyczyść odblokowane postacie i zawartość'; + + @override + String get settingsUnlockSpecials => 'Odblokuj specjalne'; + + @override + String get settingsLoadSaveState => 'Wczytaj/Zapisz stan'; + + @override + String get noResultsFound => 'Brak wyników'; + + @override + String get close => 'Zamknij'; + + @override + String get retry => 'PONÓW'; + + @override + String get specialUnlocks => 'Specjalne odblokowania'; + + @override + String get loadSaveDeleteCharacters => 'Wczytaj, zapisz lub usuń postacie.'; + + @override + String get loadAddDeleteSaves => 'Wczytaj, dodaj lub usuń zapisane stany.'; + + @override + String get addNewSave => 'Nowy zapis'; + + @override + String get addNewSaveLabel => 'Nowy zapis:'; + + @override + String get loadButton => 'Wczytaj'; + + @override + String get saveButton => 'Zapisz'; + + @override + String get deleteButton => 'Usuń'; + + @override + String get setSaveName => 'Nazwa zapisu:'; + + @override + String get loadOrSaveCharacters => 'Wczytaj lub zapisz postacie'; + + @override + String get loadCharacter => 'Wczytaj postać:'; + + @override + String get removeAll => 'Usuń wszystko'; + + @override + String get removeCardQuestion => 'Usunąć kartę?'; + + @override + String get sendToBottom => 'Wyślij na dół'; + + @override + String get shuffleUndrawnCards => 'Przetasuj niedobrane karty'; + + @override + String get returnToDiscardPile => 'Zwróć na stos odrzuconych'; + + @override + String get returnToDrawPile => 'Zwróć do talii'; + + @override + String get addExtraLootCard => 'Dodaj dodatkową kartę łupów'; + + @override + String get addStandeeNr => 'Dodaj pionek nr'; + + @override + String get summonedLabel => 'Przywołani:'; + + @override + String get characterDecks => 'Talie postaci'; + + @override + String get shuffleAndDraw => 'Tasuj\ni dobierz'; + + @override + String get draw => 'Dobierz'; + + @override + String get nextRound => ' Następna\nrunda'; + + @override + String get returnTopCard => 'Zwróć górną kartę'; + + @override + String removeCardWithDetails(String title, int nr) { + return 'Usuń $title\n(karta nr: $nr)'; + } + + @override + String get tapCardToAddToDeck => 'Dotknij kartę, aby dodać do talii'; + + @override + String get removeCardFromDeckQuestion => 'Usunąć kartę z talii?'; + + @override + String get changeName => 'Zmień nazwę:'; + + @override + String get showBosses => 'Pokaż bossów'; + + @override + String get showScenarioSpecialMonsters => + 'Pokaż specjalne potwory scenariusza'; + + @override + String get addAsAlly => 'Dodaj jako sojusznika'; + + @override + String get addMonsterLabel => 'Dodaj potwora'; + + @override + String get allCampaigns => 'Wszystkie kampanie'; + + @override + String get showMonstersFrom => ' Pokaż potwory z: '; + + @override + String setMonsterLevel(String name) { + return 'Poziom $name'; + } + + @override + String setSummonHealth(String name) { + return 'Maks. życie $name'; + } + + @override + String get setScenarioLevel => 'Poziom scenariusza'; + + @override + String enhancedLevel(String level) { + return 'Ulepszone: $level'; + } + + @override + String get soloLabel => 'Solo:'; + + @override + String get automaticScenarioLevel => 'Automatyczny poziom scenariusza:'; + + @override + String get difficultyLabel => 'Trudność:'; + + @override + String get lootCardEnhancements => 'Ulepszenia kart łupów'; + + @override + String get addPerks => 'Dodaj atuty'; + + @override + String get useFrosthavenPerks => 'Atuty Frosthaven'; + + @override + String currentCampaign(String campaign) { + return 'Aktualna kampania: $campaign'; + } + + @override + String get addCharacterHint => 'Dodaj postać (wpisz nazwę dla ukrytych klas)'; + + @override + String get trapDamage => 'obrażenia od pułapki'; + + @override + String get hazardousTerrainDamage => 'obrażenia od niebezpiecznego terenu'; + + @override + String get experienceAdded => 'dodane doświadczenie'; + + @override + String get goldCoinValue => 'wartość złotej monety'; + + @override + String get levelLegendLabel => 'poziom'; + + @override + String get saveStateNote => + 'Aplikacja zapisuje postępy po każdej akcji. Te zapisy służą jako kopie zapasowe lub dla wielu kampanii.'; + + @override + String clientConnectedTo(String address) { + return 'Klient połączony z: $address'; + } + + @override + String clientError(String error) { + return 'Błąd klienta: $error'; + } + + @override + String clientListenError(String error) { + return 'Błąd nasłuchiwania klienta: $error'; + } + + @override + String get lostConnectionToServer => 'Utracono połączenie z serwerem'; + + @override + String get stateMismatch => 'Twój stan był nieaktualny, spróbuj ponownie.'; + + @override + String get serverUnresponsive => 'Serwer nie odpowiada. Klient rozłączony.'; + + @override + String get clientDisconnected => 'klient rozłączony'; + + @override + String get serverOffline => 'Serwer offline'; + + @override + String get clientLeft => 'Klient wyszedł.'; + + @override + String get clientTooOld => + 'Stary klient próbował się połączyć. Zaktualizuj aplikację.'; + + @override + String networkConnection(String status) { + return 'Połączenie sieciowe: $status'; + } + + @override + String get failedToGetWifiIp => 'Nie udało się uzyskać adresu IP'; + + @override + String get badOmen => 'Zły omen'; + + @override + String badOmensLeft(int count) { + return 'Pozostałe złe omeny: $count'; + } + + @override + String get corrosiveSpew => 'Żrący wyrzut'; + + @override + String get empowersOnTop => 'Wzmocnienia na górze'; + + @override + String addMinusOneCard(String direction, int count) { + String _temp0 = intl.Intl.selectLogic(direction, { + 'added': 'Dodaj kartę -1 (dodane: $count)', + 'removed': 'Dodaj kartę -1 (usunięte: $count)', + 'other': 'Karta -1 ($count)', + }); + return '$_temp0'; + } + + @override + String get removeMinusOneCard => 'Usuń kartę -1'; + + @override + String get removeMinusTwoCard => 'Usuń kartę -2'; + + @override + String get minusTwoCardRemoved => 'Karta -2 usunięta'; + + @override + String get removePlusZeroCard => 'Usuń kartę +0'; + + @override + String get plusZeroCardRemoved => 'Karta +0 usunięta'; + + @override + String get removeImbue => 'Usuń nasycenie'; + + @override + String get imbue => 'Nasyć'; + + @override + String get advancedImbue => 'Zaawansowane nasycenie'; + + @override + String get removeHailPerk => 'Usuń atut Grad'; + + @override + String get addHailPerk => 'Dodaj atut Grad'; + + @override + String get removeCassandraPerk => 'Usuń\natut Cassandry'; + + @override + String get addCassandraPerk => 'Dodaj\natut Cassandry'; + + @override + String get dontSaveRevealedCards => 'Nie zachowuj\nodsłoniętych kart'; + + @override + String get saveRevealedCards => 'Zachowaj\nodsłonięte karty'; + + @override + String removedCountLabel(int count) { + return 'Usunięte: $count'; + } + + @override + String get removeDonation => 'Usuń\ndarowiznę'; + + @override + String get donateSanctuary => 'Przekaż do\nsanktuarium'; + + @override + String get removePartyCard => 'Usuń\nkartę grupy:'; + + @override + String get addPartyCard => 'Dodaj\nkartę grupy:'; + + @override + String get perks => 'Atuty'; + + @override + String get revealCards => 'Odsłoń\nkarty:'; + + @override + String get revealAll => 'Wszystkie'; + + @override + String get drawExtraCard => 'Dobierz dodatkową kartę'; + + @override + String get extraShuffle => 'Dodatkowe tasowanie'; + + @override + String get inactivateMonster => 'Dezaktywuj\npotwora'; + + @override + String get activateMonster => 'Aktywuj\npotwora'; + + @override + String addEliteStandees(int count, String name) { + return 'Dodaj $count elitarnych $name'; + } + + @override + String addNormalStandees(int count, String name) { + return 'Dodaj $count zwykłych $name'; + } + + @override + String get characterLoot => 'Łup postaci'; + + @override + String addSpecialCard(int nr) { + return 'Dodaj kartę $nr'; + } + + @override + String removeSpecialCard(int nr) { + return 'Usuń kartę $nr'; + } + + @override + String get enhanceCards => 'Ulepsz karty'; + + @override + String get addLootCard => 'Dodaj kartę'; + + @override + String get returnToTop => 'Wróć na górę'; + + @override + String get returnToBottom => 'Wróć na dół'; + + @override + String characterLootTitle(String name) { + return 'Łup $name:'; + } + + @override + String get setLootOwner => 'Właściciel łupu:'; + + @override + String get lootNameCoin => 'moneta'; + + @override + String get lootNameHide => 'skóra'; + + @override + String get lootNameLumber => 'drewno'; + + @override + String get lootNameMetal => 'metal'; + + @override + String get lootNameArrowvine => 'strzałowiec'; + + @override + String get lootNameAxenut => 'siekierorzech'; + + @override + String get lootNameCorpsecap => 'trupielnik'; + + @override + String get lootNameFlamefruit => 'ognioowoc'; + + @override + String get lootNameRockroot => 'skalniak'; + + @override + String get lootNameSnowthistle => 'śnieżny oset'; + + @override + String get lootAmount2For2 => '2 dla 2 graczy'; + + @override + String get lootAmount2For23 => '2 dla 2-3 graczy'; + + @override + String cmdActivateMonster(String name) { + return 'Aktywuj $name'; + } + + @override + String cmdDeactivateMonster(String name) { + return 'Dezaktywuj $name'; + } + + @override + String cmdAddCharacter(String id) { + return 'Dodaj $id'; + } + + @override + String cmdAddCondition(String condition) { + return 'Dodaj stan: $condition'; + } + + @override + String cmdRemoveCondition(String condition) { + return 'Usuń stan: $condition'; + } + + @override + String cmdAddPartyCard(String character, String type) { + return '$character dodaj kartę grupy $type'; + } + + @override + String cmdRemovePartyCard(String character) { + return '$character usuń kartę grupy'; + } + + @override + String cmdAddFactionCard(String character) { + return '$character dodaj kartę frakcji'; + } + + @override + String cmdRemoveFactionCard(String character) { + return '$character usuń kartę frakcji'; + } + + @override + String cmdAddLootCard(String type) { + return 'Dodaj kartę łupów $type'; + } + + @override + String cmdAddMonster(String name) { + return 'Dodaj $name'; + } + + @override + String cmdAddSpecialLootCard(int nr) { + return 'Dodaj specjalną kartę łupów $nr'; + } + + @override + String cmdRemoveSpecialLootCard(int nr) { + return 'Usuń specjalną kartę łupów $nr'; + } + + @override + String get cmdAddMinusOne => 'Dodaj minus jeden'; + + @override + String get cmdRemoveMinusOne => 'Usuń minus jeden'; + + @override + String get cmdRemoveMinusTwo => 'Usuń minus dwa'; + + @override + String get cmdAddBackMinusTwo => 'Przywróć minus dwa'; + + @override + String get cmdRemovePlusZero => 'Usuń plus zero'; + + @override + String get cmdAddBackPlusZero => 'Przywróć plus zero'; + + @override + String cmdRevealModifierCards(int count) { + return 'Odsłoń $count kart modyfikatorów'; + } + + @override + String cmdCassandraLeaveRevealed(String deck) { + return 'Zostaw odsłonięte karty na talii $deck'; + } + + @override + String cmdCassandraSpecialOff(String deck) { + return 'Specjał Cassandry wyłączony dla talii $deck'; + } + + @override + String get cmdImbueMonsterDeck => 'Nasyć talię potworów'; + + @override + String get cmdAdvancedImbueMonsterDeck => + 'Zaawansowane nasycenie talii potworów'; + + @override + String get cmdRemoveImbueMonsterDeck => 'Usuń nasycenie'; + + @override + String get cmdChangeName => 'Zmień nazwę postaci'; + + @override + String get cmdAddNoteRow => 'Dodaj wiersz notatki'; + + @override + String get cmdSetNoteRowText => 'Edytuj notatkę'; + + @override + String get cmdSetNoteRowColor => 'Zmień kolor notatki'; + + @override + String get cmdLinkNoteRow => 'Połącz wiersz notatki'; + + @override + String get cmdRemoveNoteRow => 'Usuń wiersz notatki'; + + @override + String get cmdAddBless => 'Dodaj błogosławieństwo'; + + @override + String get cmdRemoveBless => 'Usuń błogosławieństwo'; + + @override + String get cmdAddCurse => 'Dodaj klątwę'; + + @override + String get cmdRemoveCurse => 'Usuń klątwę'; + + @override + String get cmdAddEmpower => 'Dodaj wzmocnienie'; + + @override + String get cmdRemoveEmpower => 'Usuń wzmocnienie'; + + @override + String get cmdAddEnfeeble => 'Dodaj osłabienie'; + + @override + String get cmdRemoveEnfeeble => 'Usuń osłabienie'; + + @override + String cmdIncreaseMaxHealth(String owner) { + return 'Zwiększ maks. życie $owner'; + } + + @override + String cmdDecreaseMaxHealth(String owner) { + return 'Zmniejsz maks. życie $owner'; + } + + @override + String get cmdChangeStat => 'Zmień statystykę'; + + @override + String cmdIncreaseXp(String figure, int amount) { + return 'Zwiększ PD $figure o $amount'; + } + + @override + String cmdDecreaseXp(String figure, int amount) { + return 'Zmniejsz PD $figure o $amount'; + } + + @override + String get cmdClearUnlockedClasses => 'Wyczyść odblokowane klasy'; + + @override + String cmdDonateSanctuary(String character) { + return '$character przekazuje do sanktuarium'; + } + + @override + String cmdRemoveSanctuaryDonation(String character) { + return 'Usuń darowiznę $character'; + } + + @override + String get cmdDrawExtraAbilityCard => 'Dobierz dodatkową kartę zdolności'; + + @override + String get cmdDraw => 'Dobierz'; + + @override + String get cmdDrawLootCard => 'Dobierz kartę łupów'; + + @override + String cmdDrawModifierCard(String name) { + return 'Dobierz kartę modyfikatora $name'; + } + + @override + String get cmdRemoveLootEnhancement => 'Usuń ulepszenie łupów'; + + @override + String get cmdAddLootEnhancement => 'Dodaj ulepszenie łupów'; + + @override + String get cmdHideAllyDeck => 'Ukryj talię sojusznika'; + + @override + String get cmdShowAllyDeck => 'Pokaż talię sojusznika'; + + @override + String get cmdIceWraithTurnNormal => 'Lodowy zjaw staje się zwykły'; + + @override + String get cmdIceWraithTurnElite => 'Lodowy zjaw staje się elitarny'; + + @override + String cmdImbueElement(String element) { + return 'Nasyć żywioł $element'; + } + + @override + String cmdUseElement(String element) { + return 'Użyj żywiołu $element'; + } + + @override + String cmdLoadCharacter(String name) { + return 'Wczytaj zapisaną postać: $name'; + } + + @override + String cmdLoadGame(String name) { + return 'Wczytaj zapisaną grę: $name'; + } + + @override + String get cmdNextRound => 'Następna runda'; + + @override + String get cmdRemoveAmdCard => 'Usuń kartę AMD'; + + @override + String cmdRemoveCard(String deck, int nr) { + return 'Usuń kartę $deck nr $nr'; + } + + @override + String get cmdRemoveAllCharacters => 'Usuń wszystkie postacie'; + + @override + String cmdRemoveCharacter(String id) { + return 'Usuń $id'; + } + + @override + String get cmdRemoveAllMonsters => 'Usuń wszystkie potwory'; + + @override + String cmdRemoveMonster(String name) { + return 'Usuń $name'; + } + + @override + String get cmdReorderAbilityCards => 'Zmień kolejność kart zdolności'; + + @override + String get cmdReorderList => 'Zmień kolejność listy'; + + @override + String get cmdReorderModifierCards => 'Zmień kolejność kart modyfikatorów'; + + @override + String get cmdReturnLootCard => 'Zwróć kartę łupów'; + + @override + String get cmdReturnModifierCard => 'Zwróć kartę modyfikatora na górę'; + + @override + String get cmdReturnRemovedAmdCard => 'Zwróć usuniętą kartę AMD'; + + @override + String get cmdNoAllyDeckInOgGloom => + 'Brak talii sojusznika w orig. Gloomhaven'; + + @override + String get cmdUseAllyDeckInOgGloom => + 'Użyj talii sojusznika w orig. Gloomhaven'; + + @override + String cmdMarkAsSummon(String owner) { + return 'Oznacz $owner jako przywołanego'; + } + + @override + String cmdRemoveSummonMark(String owner) { + return 'Usuń oznaczenie przywołania $owner'; + } + + @override + String get cmdAutoLevelOn => 'Włącz automatyczną aktualizację poziomu'; + + @override + String get cmdAutoLevelOff => 'Wyłącz automatyczną aktualizację poziomu'; + + @override + String cmdSetCampaign(String campaign) { + return 'Ustaw kampanię $campaign'; + } + + @override + String cmdSetCharacterLevel(String character) { + return 'Ustaw poziom $character'; + } + + @override + String cmdSetDifficulty(String difficulty) { + return 'Ustaw trudność na $difficulty'; + } + + @override + String cmdSetInitiative(String character) { + return 'Ustaw inicjatywę $character'; + } + + @override + String cmdSetCharacterNote(String character) { + return 'Ustaw notatkę dla $character'; + } + + @override + String get characterNoteTitle => 'Notatka'; + + @override + String get characterNoteHint => 'Dodaj notatkę…'; + + @override + String get characterNoteQuickAdd => 'Szybka notatka'; + + @override + String cmdSetMonsterLevel(String monster) { + return 'Ustaw poziom $monster'; + } + + @override + String get cmdSetLootOwner => 'Ustaw właściciela łupu'; + + @override + String get cmdSetScenario => 'Ustaw scenariusz'; + + @override + String get cmdSetSoloOn => 'Włącz rekomendację poziomu solo'; + + @override + String get cmdSetSoloOff => 'Wyłącz rekomendację poziomu solo'; + + @override + String get cmdExtraAbilityShuffle => 'Dodatkowe tasowanie talii zdolności'; + + @override + String get cmdExtraAmdShuffle => 'Dodatkowe tasowanie talii AMD'; + + @override + String get cmdDrawnAbilityShuffle => 'Tasowanie dobranej talii zdolności'; + + @override + String get cmdDontTrackStandees => 'Nie śledź pionków'; + + @override + String get cmdTrackStandees => 'Śledź pionki'; + + @override + String cmdTurnDone(String id) { + return 'Tura $id zakończona'; + } + + @override + String cmdAddPerk(String character, int index) { + return 'Dodaj atut $index postaci \'$character\''; + } + + @override + String cmdRemovePerk(String character, int index) { + return 'Usuń atut $index postaci \'$character\''; + } + + @override + String cmdUnlock(String id) { + return 'Odblokuj $id'; + } + + @override + String cmdLock(String id) { + return 'Zablokuj $id'; + } + + @override + String get cmdSetLevel => 'Ustaw poziom'; + + @override + String get cmdAddSection => 'Dodaj sekcję'; + + @override + String cmdAddStandee(String name, int nr) { + return 'Dodaj $name $nr'; + } + + @override + String get cmdDrawMonsterModifierCard => 'Dobierz kartę modyfikatora potwora'; + + @override + String cmdIncreaseHealth(String figure, int amount) { + return 'Zwiększ życie $figure o $amount'; + } + + @override + String cmdKill(String owner) { + return 'Zabij $owner'; + } + + @override + String cmdDecreaseHealth(String owner, int amount) { + return 'Zmniejsz życie $owner o $amount'; + } + + @override + String cmdUseFhPerks(String character) { + return '$character używa atutów Frosthaven'; + } + + @override + String cmdDontUseFhPerks(String character) { + return '$character nie używa atutów Frosthaven'; + } + + @override + String get cmdRemoveNoCharacters => 'Nie usunięto postaci'; + + @override + String get cmdRemoveNoMonsters => 'Nie usunięto potworów'; +} diff --git a/server/lib/core/l10n/app_localizations_ru.dart b/server/lib/core/l10n/app_localizations_ru.dart new file mode 100644 index 0000000..3c90957 --- /dev/null +++ b/server/lib/core/l10n/app_localizations_ru.dart @@ -0,0 +1,1168 @@ +// ignore: unused_import +import 'package:intl/intl.dart' as intl; +import 'app_localizations.dart'; + +// ignore_for_file: type=lint + +/// The translations for Russian (`ru`). +class AppLocalizationsRu extends AppLocalizations { + AppLocalizationsRu([String locale = 'ru']) : super(locale); + + @override + String get menuSetScenario => 'Задать сценарий'; + + @override + String get menuAddCharacter => 'Добавить персонажа'; + + @override + String get menuRemoveCharacters => 'Убрать персонажей'; + + @override + String get menuSetLevel => 'Задать уровень'; + + @override + String get menuLootDeck => 'Меню колоды добычи'; + + @override + String get menuAddMonsters => 'Добавить монстров'; + + @override + String get menuRemoveMonsters => 'Убрать монстров'; + + @override + String get menuShowAllyDeck => 'Показать колоду модификаторов союзника'; + + @override + String get menuHideAllyDeck => 'Скрыть колоду модификаторов союзника'; + + @override + String get menuSettings => 'Настройки'; + + @override + String get menuDocumentation => 'Документация'; + + @override + String get menuDonate => 'Пожертвовать'; + + @override + String get menuExit => 'Выход'; + + @override + String get menuAddSection => 'Добавить секцию'; + + @override + String get menuAddRandomDungeonCard => 'Добавить случайную карту подземелья'; + + @override + String get menuActionLog => 'Журнал действий'; + + @override + String get actionLogTitle => 'Последние 20 действий'; + + @override + String get actionLogEmpty => 'Пока нет действий'; + + @override + String get actionLogRollbackHint => + 'Нажмите на действие, чтобы вернуться к нему'; + + @override + String get actionLogRollbackTitle => 'Откатить?'; + + @override + String actionLogRollbackBody(String action, int count) { + return 'Вернуться к \"$action\"? Это отменит $count последующих действий. Их можно повторить, пока вы не внесёте изменение.'; + } + + @override + String get actionLogRollbackConfirm => 'Откатить'; + + @override + String get menuAddNoteRow => 'Добавить строку заметки'; + + @override + String get noteRowTitle => 'Заметка'; + + @override + String get noteRowHint => 'Текст заметки…'; + + @override + String get noteRowColourLabel => 'Цвет'; + + @override + String get noteRowConnectLabel => 'Связать с:'; + + @override + String get noteRowConnectNone => 'Ничего (свободная заметка)'; + + @override + String get noteRowConnectPlayer => 'Игрок'; + + @override + String get noteRowConnectMonster => 'Монстр'; + + @override + String get noteRowWholeGroup => 'Вся группа'; + + @override + String get noteRowAll => 'Все'; + + @override + String noteRowStandeeNr(int nr) { + return 'Фишка $nr'; + } + + @override + String get noteRowAddFromMenu => 'Добавить заметку'; + + @override + String get noteRowDelete => 'Удалить заметку'; + + @override + String get undo => 'Отменить'; + + @override + String undoWithDescription(String description) { + return 'Отмена: $description'; + } + + @override + String get redo => 'Повторить'; + + @override + String redoWithDescription(String description) { + return 'Повтор: $description'; + } + + @override + String versionLabel(String version) { + return 'Версия $version'; + } + + @override + String get connectedAsClient => 'Подключён как клиент'; + + @override + String get connecting => 'Подключение…'; + + @override + String get cancelConnect => 'Cancel'; + + @override + String get connectionCancelled => 'Connection cancelled'; + + @override + String connectAsClientWithIp(String ip) { + return 'Подключиться ($ip)'; + } + + @override + String get connectAsClientLabel => 'Подключиться как клиент'; + + @override + String stopServerWithIp(String ip) { + return 'Остановить сервер $ip'; + } + + @override + String startHostServerWithIp(String ip) { + return 'Запустить сервер $ip'; + } + + @override + String get stopServerButton => 'Остановить сервер'; + + @override + String get startHostServerButton => 'Запустить сервер хоста'; + + @override + String get networkConnectLocal => 'Подключить устройства по локальной Wi-Fi:'; + + @override + String get networkServerIpHint => 'IP-адрес сервера'; + + @override + String get networkPortHint => 'порт'; + + @override + String get settingsLanguage => 'Язык:'; + + @override + String get settingsDarkMode => 'Тёмная тема'; + + @override + String get settingsSoftNumpad => 'Экранная цифровая клавиатура'; + + @override + String get settingsNoInit => 'Не запрашивать инициативу'; + + @override + String get settingsExpireConditions => 'Истечение состояний'; + + @override + String get settingsNoStandees => 'Не отслеживать фишки'; + + @override + String get settingsAutoAddStandees => 'Автодобавление фишек'; + + @override + String get settingsAutoAddSpawns => 'Автодобавление призывов'; + + @override + String get settingsRandomStandees => 'Случайные фишки'; + + @override + String get settingsNoCalculations => 'Без расчётов'; + + @override + String get settingsHideLootDeck => 'Скрыть колоду добычи'; + + @override + String get settingsShimmer => 'Мерцание текста на картах характеристик'; + + @override + String get settingsPowerModeLabel => 'Power saving'; + + @override + String get powerModeNormal => 'Normal'; + + @override + String get powerModeDimWhenIdle => 'Dim when idle'; + + @override + String get settingsPowerModeInfoTitle => 'Power saving'; + + @override + String get settingsPowerModeInfo => + 'Three levels of battery saving, from none to most.\n\nNormal — the screen is held awake at full brightness for as long as the app is open. Nothing is dimmed and nothing sleeps. Best while you are actively playing.\n\nDim when idle — the screen is still held awake and the app never locks, but after 30 seconds without input the board dims. The board stays readable from across the table, and a single tap brings it straight back with nothing lost. Good for a game in progress that you glance at between turns.\n\nReduce power use — hands the screen back to your device, so it dims and turns off on its own schedule and you unlock to return. Also lowers drawing quality to save more: card and monster box shadows become hard-edged instead of softly blurred, icons are filtered more cheaply, and shimmering text effects are turned off. Best for infrequent use and low battery capacity devices.\n\nNothing about how the game works changes at any level — no tracking, syncing or rules behaviour is affected.'; + + @override + String get settingsReducePower => 'Reduce power use'; + + @override + String get settingsReducePowerInfoTitle => 'Reduce power use'; + + @override + String get settingsReducePowerInfo => + 'Saves battery by doing less drawing work, at the cost of some visual polish.\n\nWhat changes:\n\n• The screen is allowed to dim and turn off on its own. Normally this app keeps it awake the whole time it is open, which is by far the biggest drain on a phone or tablet.\n\n• Card and monster box shadows become hard-edged instead of softly blurred.\n\n• Icons are filtered more cheaply. You may notice slightly rougher edges on small images.\n\n• Shimmering text effects are turned off.\n\nNothing about how the game works changes — no tracking, syncing or rules behaviour is affected. You can turn this off again at any time.'; + + @override + String get settingsFhHazTerrainCalc => + 'Расчёт опасной местности Frosthaven в оригинальном Gloomhaven'; + + @override + String get settingsAllyDeckOGGloom => + 'Колода модификаторов союзника в оригинальном Gloomhaven'; + + @override + String get settingsShowScenarioNames => 'Показывать названия сценариев'; + + @override + String get settingsShowBattleGoalReminder => + 'Показывать напоминание о цели битвы'; + + @override + String get settingsShowCustomContent => 'Показывать пользовательский контент'; + + @override + String get settingsShowSections => 'Показывать секции на главном экране'; + + @override + String get settingsShowReminders => 'Показывать напоминания особых правил'; + + @override + String get settingsShowAmdDeck => 'Показывать колоды модификаторов атаки'; + + @override + String get settingsShowCharacterAmd => + 'Показывать колоды модификаторов персонажей'; + + @override + String get settingsHealthWheel => + 'Колесо HP: тяните влево-вправо для изменения'; + + @override + String get settingsFullscreen => 'Полный экран'; + + @override + String get settingsMainListScaling => 'Масштаб основного списка:'; + + @override + String get settingsAppBarScaling => 'Масштаб панели приложения:'; + + @override + String get settingsStyleLabel => 'Стиль:'; + + @override + String get styleFrosthaven => 'Frosthaven'; + + @override + String get styleOriginal => 'Оригинальный'; + + @override + String get settingsClearUnlocked => + 'Очистить разблокированных персонажей и контент'; + + @override + String get settingsUnlockSpecials => 'Разблокировать особые'; + + @override + String get settingsLoadSaveState => 'Загрузить/сохранить состояние'; + + @override + String get noResultsFound => 'Ничего не найдено'; + + @override + String get close => 'Закрыть'; + + @override + String get retry => 'ПОВТОР'; + + @override + String get specialUnlocks => 'Особые разблокировки'; + + @override + String get loadSaveDeleteCharacters => + 'Загрузить, сохранить или удалить персонажей.'; + + @override + String get loadAddDeleteSaves => + 'Загрузить, добавить или удалить сохранения.'; + + @override + String get addNewSave => 'Новое сохранение'; + + @override + String get addNewSaveLabel => 'Новое сохранение:'; + + @override + String get loadButton => 'Загрузить'; + + @override + String get saveButton => 'Сохранить'; + + @override + String get deleteButton => 'Удалить'; + + @override + String get setSaveName => 'Имя сохранения:'; + + @override + String get loadOrSaveCharacters => 'Загрузить или сохранить персонажей'; + + @override + String get loadCharacter => 'Загрузить персонажа:'; + + @override + String get removeAll => 'Убрать всё'; + + @override + String get removeCardQuestion => 'Убрать карту?'; + + @override + String get sendToBottom => 'Отправить вниз'; + + @override + String get shuffleUndrawnCards => 'Перемешать невзятые карты'; + + @override + String get returnToDiscardPile => 'Вернуть в сброс'; + + @override + String get returnToDrawPile => 'Вернуть в колоду'; + + @override + String get addExtraLootCard => 'Добавить дополнительную карту добычи'; + + @override + String get addStandeeNr => 'Добавить фишку №'; + + @override + String get summonedLabel => 'Призванные:'; + + @override + String get characterDecks => 'Колоды персонажей'; + + @override + String get shuffleAndDraw => 'Перемешать\nи взять'; + + @override + String get draw => 'Взять'; + + @override + String get nextRound => ' Следующий\nраунд'; + + @override + String get returnTopCard => 'Вернуть верхнюю карту'; + + @override + String removeCardWithDetails(String title, int nr) { + return 'Убрать $title\n(карта №: $nr)'; + } + + @override + String get tapCardToAddToDeck => 'Нажмите карту, чтобы добавить в колоду'; + + @override + String get removeCardFromDeckQuestion => 'Убрать карту из колоды?'; + + @override + String get changeName => 'Изменить имя:'; + + @override + String get showBosses => 'Показать боссов'; + + @override + String get showScenarioSpecialMonsters => 'Показать особых монстров сценария'; + + @override + String get addAsAlly => 'Добавить как союзника'; + + @override + String get addMonsterLabel => 'Добавить монстра'; + + @override + String get allCampaigns => 'Все кампании'; + + @override + String get showMonstersFrom => ' Показать монстров из: '; + + @override + String setMonsterLevel(String name) { + return 'Уровень $name'; + } + + @override + String setSummonHealth(String name) { + return 'Макс. HP $name'; + } + + @override + String get setScenarioLevel => 'Уровень сценария'; + + @override + String enhancedLevel(String level) { + return 'Улучшено: $level'; + } + + @override + String get soloLabel => 'Соло:'; + + @override + String get automaticScenarioLevel => 'Автоматический уровень сценария:'; + + @override + String get difficultyLabel => 'Сложность:'; + + @override + String get lootCardEnhancements => 'Улучшения карт добычи'; + + @override + String get addPerks => 'Добавить особенности'; + + @override + String get useFrosthavenPerks => 'Особенности Frosthaven'; + + @override + String currentCampaign(String campaign) { + return 'Текущая кампания: $campaign'; + } + + @override + String get addCharacterHint => + 'Добавить персонажа (введите имя для скрытых классов)'; + + @override + String get trapDamage => 'урон от ловушки'; + + @override + String get hazardousTerrainDamage => 'урон от опасной местности'; + + @override + String get experienceAdded => 'добавлен опыт'; + + @override + String get goldCoinValue => 'ценность золотой монеты'; + + @override + String get levelLegendLabel => 'уровень'; + + @override + String get saveStateNote => + 'Приложение автоматически сохраняет прогресс после каждого действия. Эти сохранения для резервных копий или нескольких кампаний.'; + + @override + String clientConnectedTo(String address) { + return 'Клиент подключён к: $address'; + } + + @override + String clientError(String error) { + return 'Ошибка клиента: $error'; + } + + @override + String clientListenError(String error) { + return 'Ошибка прослушивания клиента: $error'; + } + + @override + String get lostConnectionToServer => 'Соединение с сервером потеряно'; + + @override + String get stateMismatch => + 'Ваше состояние было не актуальным, попробуйте снова.'; + + @override + String get serverUnresponsive => 'Сервер не отвечает. Клиент отключён.'; + + @override + String get clientDisconnected => 'клиент отключён'; + + @override + String get serverOffline => 'Сервер недоступен'; + + @override + String get clientLeft => 'Клиент вышел.'; + + @override + String get clientTooOld => + 'Устаревший клиент попытался подключиться. Обновите приложение.'; + + @override + String networkConnection(String status) { + return 'Сетевое соединение: $status'; + } + + @override + String get failedToGetWifiIp => 'Не удалось получить IP-адрес'; + + @override + String get badOmen => 'Дурное предзнаменование'; + + @override + String badOmensLeft(int count) { + return 'Осталось предзнаменований: $count'; + } + + @override + String get corrosiveSpew => 'Разъедающий выброс'; + + @override + String get empowersOnTop => 'Усиления сверху'; + + @override + String addMinusOneCard(String direction, int count) { + String _temp0 = intl.Intl.selectLogic(direction, { + 'added': 'Добавить карту -1 (добавлено: $count)', + 'removed': 'Добавить карту -1 (удалено: $count)', + 'other': 'Карта -1 ($count)', + }); + return '$_temp0'; + } + + @override + String get removeMinusOneCard => 'Убрать карту -1'; + + @override + String get removeMinusTwoCard => 'Убрать карту -2'; + + @override + String get minusTwoCardRemoved => 'Карта -2 убрана'; + + @override + String get removePlusZeroCard => 'Убрать карту +0'; + + @override + String get plusZeroCardRemoved => 'Карта +0 убрана'; + + @override + String get removeImbue => 'Убрать пропитку'; + + @override + String get imbue => 'Пропитать'; + + @override + String get advancedImbue => 'Расширенная пропитка'; + + @override + String get removeHailPerk => 'Убрать особенность Град'; + + @override + String get addHailPerk => 'Добавить особенность Град'; + + @override + String get removeCassandraPerk => 'Убрать\nособенность Кассандры'; + + @override + String get addCassandraPerk => 'Добавить\nособенность Кассандры'; + + @override + String get dontSaveRevealedCards => 'Не хранить\nоткрытые карты'; + + @override + String get saveRevealedCards => 'Хранить\nоткрытые карты'; + + @override + String removedCountLabel(int count) { + return 'Убрано: $count'; + } + + @override + String get removeDonation => 'Убрать\nпожертвование'; + + @override + String get donateSanctuary => 'Пожертвовать\nв святилище'; + + @override + String get removePartyCard => 'Убрать\nкарту группы:'; + + @override + String get addPartyCard => 'Добавить\nкарту группы:'; + + @override + String get perks => 'Особенности'; + + @override + String get revealCards => 'Открыть\nкарты:'; + + @override + String get revealAll => 'Все'; + + @override + String get drawExtraCard => 'Взять дополнительную карту'; + + @override + String get extraShuffle => 'Дополнительное перемешивание'; + + @override + String get inactivateMonster => 'Деактивировать\nмонстра'; + + @override + String get activateMonster => 'Активировать\nмонстра'; + + @override + String addEliteStandees(int count, String name) { + return 'Добавить $count элитных $name'; + } + + @override + String addNormalStandees(int count, String name) { + return 'Добавить $count обычных $name'; + } + + @override + String get characterLoot => 'Добыча персонажа'; + + @override + String addSpecialCard(int nr) { + return 'Добавить карту $nr'; + } + + @override + String removeSpecialCard(int nr) { + return 'Убрать карту $nr'; + } + + @override + String get enhanceCards => 'Улучшить карты'; + + @override + String get addLootCard => 'Добавить карту'; + + @override + String get returnToTop => 'Вернуть наверх'; + + @override + String get returnToBottom => 'Вернуть вниз'; + + @override + String characterLootTitle(String name) { + return 'Добыча $name:'; + } + + @override + String get setLootOwner => 'Владелец добычи:'; + + @override + String get lootNameCoin => 'монета'; + + @override + String get lootNameHide => 'шкура'; + + @override + String get lootNameLumber => 'древесина'; + + @override + String get lootNameMetal => 'металл'; + + @override + String get lootNameArrowvine => 'стрела-лоза'; + + @override + String get lootNameAxenut => 'топор-орех'; + + @override + String get lootNameCorpsecap => 'труп-шляпка'; + + @override + String get lootNameFlamefruit => 'огне-плод'; + + @override + String get lootNameRockroot => 'камень-корень'; + + @override + String get lootNameSnowthistle => 'снежный чертополох'; + + @override + String get lootAmount2For2 => '2 для 2 игроков'; + + @override + String get lootAmount2For23 => '2 для 2-3 игроков'; + + @override + String cmdActivateMonster(String name) { + return 'Активировать $name'; + } + + @override + String cmdDeactivateMonster(String name) { + return 'Деактивировать $name'; + } + + @override + String cmdAddCharacter(String id) { + return 'Добавить $id'; + } + + @override + String cmdAddCondition(String condition) { + return 'Добавить состояние: $condition'; + } + + @override + String cmdRemoveCondition(String condition) { + return 'Убрать состояние: $condition'; + } + + @override + String cmdAddPartyCard(String character, String type) { + return '$character добавить карту группы $type'; + } + + @override + String cmdRemovePartyCard(String character) { + return '$character убрать карту группы'; + } + + @override + String cmdAddFactionCard(String character) { + return '$character добавить карту фракции'; + } + + @override + String cmdRemoveFactionCard(String character) { + return '$character убрать карту фракции'; + } + + @override + String cmdAddLootCard(String type) { + return 'Добавить карту добычи $type'; + } + + @override + String cmdAddMonster(String name) { + return 'Добавить $name'; + } + + @override + String cmdAddSpecialLootCard(int nr) { + return 'Добавить особую карту добычи $nr'; + } + + @override + String cmdRemoveSpecialLootCard(int nr) { + return 'Убрать особую карту добычи $nr'; + } + + @override + String get cmdAddMinusOne => 'Добавить минус один'; + + @override + String get cmdRemoveMinusOne => 'Убрать минус один'; + + @override + String get cmdRemoveMinusTwo => 'Убрать минус два'; + + @override + String get cmdAddBackMinusTwo => 'Вернуть минус два'; + + @override + String get cmdRemovePlusZero => 'Убрать плюс ноль'; + + @override + String get cmdAddBackPlusZero => 'Вернуть плюс ноль'; + + @override + String cmdRevealModifierCards(int count) { + return 'Открыть $count карт модификаторов'; + } + + @override + String cmdCassandraLeaveRevealed(String deck) { + return 'Оставить открытые карты поверх колоды $deck'; + } + + @override + String cmdCassandraSpecialOff(String deck) { + return 'Особенность Кассандры отключена для колоды $deck'; + } + + @override + String get cmdImbueMonsterDeck => 'Пропитать колоду монстров'; + + @override + String get cmdAdvancedImbueMonsterDeck => + 'Расширенная пропитка колоды монстров'; + + @override + String get cmdRemoveImbueMonsterDeck => 'Убрать пропитку'; + + @override + String get cmdChangeName => 'Изменить имя персонажа'; + + @override + String get cmdAddNoteRow => 'Добавить строку заметки'; + + @override + String get cmdSetNoteRowText => 'Изменить заметку'; + + @override + String get cmdSetNoteRowColor => 'Изменить цвет заметки'; + + @override + String get cmdLinkNoteRow => 'Связать строку заметки'; + + @override + String get cmdRemoveNoteRow => 'Удалить строку заметки'; + + @override + String get cmdAddBless => 'Добавить благословение'; + + @override + String get cmdRemoveBless => 'Убрать благословение'; + + @override + String get cmdAddCurse => 'Добавить проклятие'; + + @override + String get cmdRemoveCurse => 'Убрать проклятие'; + + @override + String get cmdAddEmpower => 'Добавить усиление'; + + @override + String get cmdRemoveEmpower => 'Убрать усиление'; + + @override + String get cmdAddEnfeeble => 'Добавить ослабление'; + + @override + String get cmdRemoveEnfeeble => 'Убрать ослабление'; + + @override + String cmdIncreaseMaxHealth(String owner) { + return 'Увеличить макс. HP $owner'; + } + + @override + String cmdDecreaseMaxHealth(String owner) { + return 'Уменьшить макс. HP $owner'; + } + + @override + String get cmdChangeStat => 'Изменить характеристику'; + + @override + String cmdIncreaseXp(String figure, int amount) { + return 'Увеличить опыт $figure на $amount'; + } + + @override + String cmdDecreaseXp(String figure, int amount) { + return 'Уменьшить опыт $figure на $amount'; + } + + @override + String get cmdClearUnlockedClasses => 'Очистить разблокированные классы'; + + @override + String cmdDonateSanctuary(String character) { + return '$character пожертвовать в святилище'; + } + + @override + String cmdRemoveSanctuaryDonation(String character) { + return 'Убрать пожертвование $character'; + } + + @override + String get cmdDrawExtraAbilityCard => + 'Взять дополнительную карту способности'; + + @override + String get cmdDraw => 'Взять'; + + @override + String get cmdDrawLootCard => 'Взять карту добычи'; + + @override + String cmdDrawModifierCard(String name) { + return 'Взять карту модификатора $name'; + } + + @override + String get cmdRemoveLootEnhancement => 'Убрать улучшение добычи'; + + @override + String get cmdAddLootEnhancement => 'Добавить улучшение добычи'; + + @override + String get cmdHideAllyDeck => 'Скрыть колоду союзника'; + + @override + String get cmdShowAllyDeck => 'Показать колоду союзника'; + + @override + String get cmdIceWraithTurnNormal => 'Ледяной призрак переходит в обычный'; + + @override + String get cmdIceWraithTurnElite => 'Ледяной призрак переходит в элитный'; + + @override + String cmdImbueElement(String element) { + return 'Пропитать стихию $element'; + } + + @override + String cmdUseElement(String element) { + return 'Использовать стихию $element'; + } + + @override + String cmdLoadCharacter(String name) { + return 'Загрузить сохранённого персонажа: $name'; + } + + @override + String cmdLoadGame(String name) { + return 'Загрузить сохранённую игру: $name'; + } + + @override + String get cmdNextRound => 'Следующий раунд'; + + @override + String get cmdRemoveAmdCard => 'Убрать карту AMD'; + + @override + String cmdRemoveCard(String deck, int nr) { + return 'Убрать карту $deck №$nr'; + } + + @override + String get cmdRemoveAllCharacters => 'Убрать всех персонажей'; + + @override + String cmdRemoveCharacter(String id) { + return 'Убрать $id'; + } + + @override + String get cmdRemoveAllMonsters => 'Убрать всех монстров'; + + @override + String cmdRemoveMonster(String name) { + return 'Убрать $name'; + } + + @override + String get cmdReorderAbilityCards => 'Переупорядочить карты способностей'; + + @override + String get cmdReorderList => 'Переупорядочить список'; + + @override + String get cmdReorderModifierCards => 'Переупорядочить карты модификаторов'; + + @override + String get cmdReturnLootCard => 'Вернуть карту добычи'; + + @override + String get cmdReturnModifierCard => 'Вернуть карту модификатора наверх'; + + @override + String get cmdReturnRemovedAmdCard => 'Вернуть убранную карту AMD'; + + @override + String get cmdNoAllyDeckInOgGloom => + 'Нет колоды союзника в оригинальном Gloomhaven'; + + @override + String get cmdUseAllyDeckInOgGloom => + 'Использовать колоду союзника в оригинальном Gloomhaven'; + + @override + String cmdMarkAsSummon(String owner) { + return 'Отметить $owner как призванного'; + } + + @override + String cmdRemoveSummonMark(String owner) { + return 'Убрать метку призыва у $owner'; + } + + @override + String get cmdAutoLevelOn => 'Включить автоматическое обновление уровня'; + + @override + String get cmdAutoLevelOff => 'Выключить автоматическое обновление уровня'; + + @override + String cmdSetCampaign(String campaign) { + return 'Задать кампанию $campaign'; + } + + @override + String cmdSetCharacterLevel(String character) { + return 'Задать уровень $character'; + } + + @override + String cmdSetDifficulty(String difficulty) { + return 'Задать сложность $difficulty'; + } + + @override + String cmdSetInitiative(String character) { + return 'Задать инициативу $character'; + } + + @override + String cmdSetCharacterNote(String character) { + return 'Задать заметку для $character'; + } + + @override + String get characterNoteTitle => 'Заметка'; + + @override + String get characterNoteHint => 'Добавить заметку…'; + + @override + String get characterNoteQuickAdd => 'Быстрая заметка'; + + @override + String cmdSetMonsterLevel(String monster) { + return 'Задать уровень $monster'; + } + + @override + String get cmdSetLootOwner => 'Задать владельца добычи'; + + @override + String get cmdSetScenario => 'Задать сценарий'; + + @override + String get cmdSetSoloOn => 'Включить рекомендацию уровня для соло'; + + @override + String get cmdSetSoloOff => 'Выключить рекомендацию уровня для соло'; + + @override + String get cmdExtraAbilityShuffle => + 'Дополнительное перемешивание колоды способностей'; + + @override + String get cmdExtraAmdShuffle => 'Дополнительное перемешивание колоды AMD'; + + @override + String get cmdDrawnAbilityShuffle => + 'Перемешивание взятой колоды способностей'; + + @override + String get cmdDontTrackStandees => 'Не отслеживать фишки'; + + @override + String get cmdTrackStandees => 'Отслеживать фишки'; + + @override + String cmdTurnDone(String id) { + return 'Ход $id завершён'; + } + + @override + String cmdAddPerk(String character, int index) { + return 'Добавить особенность $index персонажа \'$character\''; + } + + @override + String cmdRemovePerk(String character, int index) { + return 'Убрать особенность $index персонажа \'$character\''; + } + + @override + String cmdUnlock(String id) { + return 'Разблокировать $id'; + } + + @override + String cmdLock(String id) { + return 'Заблокировать $id'; + } + + @override + String get cmdSetLevel => 'Задать уровень'; + + @override + String get cmdAddSection => 'Добавить секцию'; + + @override + String cmdAddStandee(String name, int nr) { + return 'Добавить $name $nr'; + } + + @override + String get cmdDrawMonsterModifierCard => 'Взять карту модификатора монстра'; + + @override + String cmdIncreaseHealth(String figure, int amount) { + return 'Увеличить HP $figure на $amount'; + } + + @override + String cmdKill(String owner) { + return 'Устранить $owner'; + } + + @override + String cmdDecreaseHealth(String owner, int amount) { + return 'Уменьшить HP $owner на $amount'; + } + + @override + String cmdUseFhPerks(String character) { + return '$character использует особенности Frosthaven'; + } + + @override + String cmdDontUseFhPerks(String character) { + return '$character не использует особенности Frosthaven'; + } + + @override + String get cmdRemoveNoCharacters => 'Персонажи не убраны'; + + @override + String get cmdRemoveNoMonsters => 'Монстры не убраны'; +} diff --git a/server/lib/core/l10n/app_localizations_th.dart b/server/lib/core/l10n/app_localizations_th.dart new file mode 100644 index 0000000..ca4c0d5 --- /dev/null +++ b/server/lib/core/l10n/app_localizations_th.dart @@ -0,0 +1,1156 @@ +// ignore: unused_import +import 'package:intl/intl.dart' as intl; +import 'app_localizations.dart'; + +// ignore_for_file: type=lint + +/// The translations for Thai (`th`). +class AppLocalizationsTh extends AppLocalizations { + AppLocalizationsTh([String locale = 'th']) : super(locale); + + @override + String get menuSetScenario => 'ตั้งค่าฉาก'; + + @override + String get menuAddCharacter => 'เพิ่มตัวละคร'; + + @override + String get menuRemoveCharacters => 'นำตัวละครออก'; + + @override + String get menuSetLevel => 'ตั้งค่าระดับ'; + + @override + String get menuLootDeck => 'เมนูสำรับการปล้นสะดม'; + + @override + String get menuAddMonsters => 'เพิ่มมอนสเตอร์'; + + @override + String get menuRemoveMonsters => 'นำมอนสเตอร์ออก'; + + @override + String get menuShowAllyDeck => 'แสดงสำรับตัวปรับแต่งพันธมิตร'; + + @override + String get menuHideAllyDeck => 'ซ่อนสำรับตัวปรับแต่งพันธมิตร'; + + @override + String get menuSettings => 'การตั้งค่า'; + + @override + String get menuDocumentation => 'เอกสาร'; + + @override + String get menuDonate => 'บริจาค'; + + @override + String get menuExit => 'ออก'; + + @override + String get menuAddSection => 'เพิ่มส่วน'; + + @override + String get menuAddRandomDungeonCard => 'เพิ่มการ์ดดันเจี้ยนแบบสุ่ม'; + + @override + String get menuActionLog => 'ดูบันทึกการกระทำ'; + + @override + String get actionLogTitle => '20 การกระทำล่าสุด'; + + @override + String get actionLogEmpty => 'ยังไม่มีการกระทำ'; + + @override + String get actionLogRollbackHint => 'แตะการกระทำเพื่อย้อนกลับไปยังจุดนั้น'; + + @override + String get actionLogRollbackTitle => 'ย้อนกลับ?'; + + @override + String actionLogRollbackBody(String action, int count) { + return 'ย้อนกลับไปที่ \"$action\" หรือไม่? การกระทำ $count รายการหลังจากนั้นจะถูกยกเลิก คุณสามารถทำซ้ำได้จนกว่าจะมีการเปลี่ยนแปลง'; + } + + @override + String get actionLogRollbackConfirm => 'ย้อนกลับ'; + + @override + String get menuAddNoteRow => 'เพิ่มแถวบันทึก'; + + @override + String get noteRowTitle => 'บันทึก'; + + @override + String get noteRowHint => 'ข้อความบันทึก…'; + + @override + String get noteRowColourLabel => 'สี'; + + @override + String get noteRowConnectLabel => 'เชื่อมกับ:'; + + @override + String get noteRowConnectNone => 'ไม่มี (บันทึกอิสระ)'; + + @override + String get noteRowConnectPlayer => 'ผู้เล่น'; + + @override + String get noteRowConnectMonster => 'มอนสเตอร์'; + + @override + String get noteRowWholeGroup => 'ทั้งกลุ่ม'; + + @override + String get noteRowAll => 'ทั้งหมด'; + + @override + String noteRowStandeeNr(int nr) { + return 'ตัวยืน $nr'; + } + + @override + String get noteRowAddFromMenu => 'เพิ่มบันทึก'; + + @override + String get noteRowDelete => 'ลบบันทึก'; + + @override + String get undo => 'เลิกทำ'; + + @override + String undoWithDescription(String description) { + return 'เลิกทำ: $description'; + } + + @override + String get redo => 'ทำซ้ำ'; + + @override + String redoWithDescription(String description) { + return 'ทำซ้ำ: $description'; + } + + @override + String versionLabel(String version) { + return 'เวอร์ชัน $version'; + } + + @override + String get connectedAsClient => 'เชื่อมต่อในฐานะไคลเอนต์แล้ว'; + + @override + String get connecting => 'กำลังเชื่อมต่อ…'; + + @override + String get cancelConnect => 'Cancel'; + + @override + String get connectionCancelled => 'Connection cancelled'; + + @override + String connectAsClientWithIp(String ip) { + return 'เชื่อมต่อในฐานะไคลเอนต์ ($ip)'; + } + + @override + String get connectAsClientLabel => 'เชื่อมต่อในฐานะไคลเอนต์'; + + @override + String stopServerWithIp(String ip) { + return 'หยุดเซิร์ฟเวอร์ $ip'; + } + + @override + String startHostServerWithIp(String ip) { + return 'เริ่มเซิร์ฟเวอร์ $ip'; + } + + @override + String get stopServerButton => 'หยุดเซิร์ฟเวอร์'; + + @override + String get startHostServerButton => 'เริ่มเซิร์ฟเวอร์โฮสต์'; + + @override + String get networkConnectLocal => 'เชื่อมต่ออุปกรณ์ผ่าน Wi-Fi ท้องถิ่น:'; + + @override + String get networkServerIpHint => 'ที่อยู่ IP เซิร์ฟเวอร์'; + + @override + String get networkPortHint => 'พอร์ต'; + + @override + String get settingsLanguage => 'ภาษา:'; + + @override + String get settingsDarkMode => 'โหมดมืด'; + + @override + String get settingsSoftNumpad => 'แป้นตัวเลขซอฟต์แวร์'; + + @override + String get settingsNoInit => 'ไม่ถามค่าริเริ่ม'; + + @override + String get settingsExpireConditions => 'หมดอายุสถานะ'; + + @override + String get settingsNoStandees => 'ไม่ติดตามตัวยืน'; + + @override + String get settingsAutoAddStandees => 'เพิ่มตัวยืนอัตโนมัติ'; + + @override + String get settingsAutoAddSpawns => 'เพิ่มการเรียกอัตโนมัติ'; + + @override + String get settingsRandomStandees => 'ตัวยืนแบบสุ่ม'; + + @override + String get settingsNoCalculations => 'ไม่คำนวณอัตโนมัติ'; + + @override + String get settingsHideLootDeck => 'ซ่อนสำรับการปล้นสะดม'; + + @override + String get settingsShimmer => 'ข้อความระยิบระยับบนการ์ดสถิติ'; + + @override + String get settingsPowerModeLabel => 'Power saving'; + + @override + String get powerModeNormal => 'Normal'; + + @override + String get powerModeDimWhenIdle => 'Dim when idle'; + + @override + String get settingsPowerModeInfoTitle => 'Power saving'; + + @override + String get settingsPowerModeInfo => + 'Three levels of battery saving, from none to most.\n\nNormal — the screen is held awake at full brightness for as long as the app is open. Nothing is dimmed and nothing sleeps. Best while you are actively playing.\n\nDim when idle — the screen is still held awake and the app never locks, but after 30 seconds without input the board dims. The board stays readable from across the table, and a single tap brings it straight back with nothing lost. Good for a game in progress that you glance at between turns.\n\nReduce power use — hands the screen back to your device, so it dims and turns off on its own schedule and you unlock to return. Also lowers drawing quality to save more: card and monster box shadows become hard-edged instead of softly blurred, icons are filtered more cheaply, and shimmering text effects are turned off. Best for infrequent use and low battery capacity devices.\n\nNothing about how the game works changes at any level — no tracking, syncing or rules behaviour is affected.'; + + @override + String get settingsReducePower => 'Reduce power use'; + + @override + String get settingsReducePowerInfoTitle => 'Reduce power use'; + + @override + String get settingsReducePowerInfo => + 'Saves battery by doing less drawing work, at the cost of some visual polish.\n\nWhat changes:\n\n• The screen is allowed to dim and turn off on its own. Normally this app keeps it awake the whole time it is open, which is by far the biggest drain on a phone or tablet.\n\n• Card and monster box shadows become hard-edged instead of softly blurred.\n\n• Icons are filtered more cheaply. You may notice slightly rougher edges on small images.\n\n• Shimmering text effects are turned off.\n\nNothing about how the game works changes — no tracking, syncing or rules behaviour is affected. You can turn this off again at any time.'; + + @override + String get settingsFhHazTerrainCalc => + 'คำนวณพื้นที่อันตราย Frosthaven ใน Gloomhaven ดั้งเดิม'; + + @override + String get settingsAllyDeckOGGloom => + 'สำรับตัวปรับแต่งพันธมิตรใน Gloomhaven ดั้งเดิม'; + + @override + String get settingsShowScenarioNames => 'แสดงชื่อฉาก'; + + @override + String get settingsShowBattleGoalReminder => 'แสดงตัวเตือนเป้าหมายการต่อสู้'; + + @override + String get settingsShowCustomContent => 'แสดงเนื้อหาที่กำหนดเอง'; + + @override + String get settingsShowSections => 'แสดงส่วนในหน้าจอหลัก'; + + @override + String get settingsShowReminders => 'แสดงตัวเตือนกฎพิเศษ'; + + @override + String get settingsShowAmdDeck => 'แสดงสำรับตัวปรับแต่งการโจมตี'; + + @override + String get settingsShowCharacterAmd => 'แสดงสำรับตัวปรับแต่งของตัวละคร'; + + @override + String get settingsHealthWheel => 'วงล้อ HP: ลากซ้าย-ขวาเพื่อเปลี่ยน'; + + @override + String get settingsFullscreen => 'เต็มหน้าจอ'; + + @override + String get settingsMainListScaling => 'ขนาดรายการหลัก:'; + + @override + String get settingsAppBarScaling => 'ขนาดแถบแอป:'; + + @override + String get settingsStyleLabel => 'สไตล์:'; + + @override + String get styleFrosthaven => 'Frosthaven'; + + @override + String get styleOriginal => 'ดั้งเดิม'; + + @override + String get settingsClearUnlocked => 'ล้างตัวละครและเนื้อหาที่ปลดล็อก'; + + @override + String get settingsUnlockSpecials => 'ปลดล็อกพิเศษ'; + + @override + String get settingsLoadSaveState => 'โหลด/บันทึกสถานะ'; + + @override + String get noResultsFound => 'ไม่พบผลลัพธ์'; + + @override + String get close => 'ปิด'; + + @override + String get retry => 'ลองใหม่'; + + @override + String get specialUnlocks => 'การปลดล็อกพิเศษ'; + + @override + String get loadSaveDeleteCharacters => 'โหลด บันทึก หรือลบตัวละคร'; + + @override + String get loadAddDeleteSaves => 'โหลด เพิ่ม หรือลบการบันทึก'; + + @override + String get addNewSave => 'บันทึกใหม่'; + + @override + String get addNewSaveLabel => 'บันทึกใหม่:'; + + @override + String get loadButton => 'โหลด'; + + @override + String get saveButton => 'บันทึก'; + + @override + String get deleteButton => 'ลบ'; + + @override + String get setSaveName => 'ชื่อการบันทึก:'; + + @override + String get loadOrSaveCharacters => 'โหลดหรือบันทึกตัวละคร'; + + @override + String get loadCharacter => 'โหลดตัวละคร:'; + + @override + String get removeAll => 'นำออกทั้งหมด'; + + @override + String get removeCardQuestion => 'นำการ์ดออก?'; + + @override + String get sendToBottom => 'ส่งไปด้านล่าง'; + + @override + String get shuffleUndrawnCards => 'สับการ์ดที่ยังไม่ได้จั่ว'; + + @override + String get returnToDiscardPile => 'คืนสู่กองทิ้ง'; + + @override + String get returnToDrawPile => 'คืนสู่สำรับ'; + + @override + String get addExtraLootCard => 'เพิ่มการ์ดการปล้นสะดมพิเศษ'; + + @override + String get addStandeeNr => 'เพิ่มตัวยืนหมายเลข'; + + @override + String get summonedLabel => 'ที่ถูกเรียก:'; + + @override + String get characterDecks => 'สำรับตัวละคร'; + + @override + String get shuffleAndDraw => 'สับ\nและจั่ว'; + + @override + String get draw => 'จั่ว'; + + @override + String get nextRound => ' รอบถัดไป'; + + @override + String get returnTopCard => 'คืนการ์ดด้านบน'; + + @override + String removeCardWithDetails(String title, int nr) { + return 'นำ $title ออก\n(การ์ดหมายเลข: $nr)'; + } + + @override + String get tapCardToAddToDeck => 'แตะการ์ดเพื่อเพิ่มในสำรับ'; + + @override + String get removeCardFromDeckQuestion => 'นำการ์ดออกจากสำรับ?'; + + @override + String get changeName => 'เปลี่ยนชื่อ:'; + + @override + String get showBosses => 'แสดงบอส'; + + @override + String get showScenarioSpecialMonsters => 'แสดงมอนสเตอร์พิเศษของฉาก'; + + @override + String get addAsAlly => 'เพิ่มเป็นพันธมิตร'; + + @override + String get addMonsterLabel => 'เพิ่มมอนสเตอร์'; + + @override + String get allCampaigns => 'แคมเปญทั้งหมด'; + + @override + String get showMonstersFrom => ' แสดงมอนสเตอร์จาก: '; + + @override + String setMonsterLevel(String name) { + return 'ระดับ $name'; + } + + @override + String setSummonHealth(String name) { + return 'HP สูงสุด $name'; + } + + @override + String get setScenarioLevel => 'ระดับฉาก'; + + @override + String enhancedLevel(String level) { + return 'เสริมแล้ว: $level'; + } + + @override + String get soloLabel => 'เดี่ยว:'; + + @override + String get automaticScenarioLevel => 'ระดับฉากอัตโนมัติ:'; + + @override + String get difficultyLabel => 'ความยาก:'; + + @override + String get lootCardEnhancements => 'การเสริมการ์ดการปล้นสะดม'; + + @override + String get addPerks => 'เพิ่มสิทธิพิเศษ'; + + @override + String get useFrosthavenPerks => 'ใช้สิทธิพิเศษ Frosthaven'; + + @override + String currentCampaign(String campaign) { + return 'แคมเปญปัจจุบัน: $campaign'; + } + + @override + String get addCharacterHint => 'เพิ่มตัวละคร (พิมพ์ชื่อสำหรับคลาสที่ซ่อน)'; + + @override + String get trapDamage => 'ความเสียหายกับดัก'; + + @override + String get hazardousTerrainDamage => 'ความเสียหายพื้นที่อันตราย'; + + @override + String get experienceAdded => 'เพิ่มประสบการณ์'; + + @override + String get goldCoinValue => 'มูลค่าเหรียญทอง'; + + @override + String get levelLegendLabel => 'ระดับ'; + + @override + String get saveStateNote => + 'แอปบันทึกอัตโนมัติหลังทุกการกระทำ การบันทึกเหล่านี้ใช้สำหรับสำรองข้อมูลหรือหลายแคมเปญ'; + + @override + String clientConnectedTo(String address) { + return 'ไคลเอนต์เชื่อมต่อกับ: $address'; + } + + @override + String clientError(String error) { + return 'ข้อผิดพลาดไคลเอนต์: $error'; + } + + @override + String clientListenError(String error) { + return 'ข้อผิดพลาดการฟังไคลเอนต์: $error'; + } + + @override + String get lostConnectionToServer => 'ขาดการเชื่อมต่อกับเซิร์ฟเวอร์'; + + @override + String get stateMismatch => 'สถานะของคุณไม่ทันสมัย กรุณาลองใหม่'; + + @override + String get serverUnresponsive => + 'เซิร์ฟเวอร์ไม่ตอบสนอง ตัดการเชื่อมต่อไคลเอนต์'; + + @override + String get clientDisconnected => 'ตัดการเชื่อมต่อไคลเอนต์'; + + @override + String get serverOffline => 'เซิร์ฟเวอร์ออฟไลน์'; + + @override + String get clientLeft => 'ไคลเอนต์ออกไปแล้ว'; + + @override + String get clientTooOld => + 'ไคลเอนต์เวอร์ชันเก่าพยายามเชื่อมต่อ กรุณาอัปเดตแอป'; + + @override + String networkConnection(String status) { + return 'การเชื่อมต่อเครือข่าย: $status'; + } + + @override + String get failedToGetWifiIp => 'ไม่สามารถรับที่อยู่ IP ได้'; + + @override + String get badOmen => 'ลางร้าย'; + + @override + String badOmensLeft(int count) { + return 'ลางร้ายที่เหลือ: $count'; + } + + @override + String get corrosiveSpew => 'การพ่นสารกัดกร่อน'; + + @override + String get empowersOnTop => 'การเสริมพลังอยู่ด้านบน'; + + @override + String addMinusOneCard(String direction, int count) { + String _temp0 = intl.Intl.selectLogic(direction, { + 'added': 'เพิ่มการ์ด -1 (เพิ่มแล้ว: $count)', + 'removed': 'เพิ่มการ์ด -1 (ลบออกแล้ว: $count)', + 'other': 'การ์ด -1 ($count)', + }); + return '$_temp0'; + } + + @override + String get removeMinusOneCard => 'นำการ์ด -1 ออก'; + + @override + String get removeMinusTwoCard => 'นำการ์ด -2 ออก'; + + @override + String get minusTwoCardRemoved => 'นำการ์ด -2 ออกแล้ว'; + + @override + String get removePlusZeroCard => 'นำการ์ด +0 ออก'; + + @override + String get plusZeroCardRemoved => 'นำการ์ด +0 ออกแล้ว'; + + @override + String get removeImbue => 'นำการซึมซับออก'; + + @override + String get imbue => 'ซึมซับ'; + + @override + String get advancedImbue => 'การซึมซับขั้นสูง'; + + @override + String get removeHailPerk => 'นำสิทธิพิเศษลูกเห็บออก'; + + @override + String get addHailPerk => 'เพิ่มสิทธิพิเศษลูกเห็บ'; + + @override + String get removeCassandraPerk => 'นำ\nสิทธิพิเศษแคสแซนดราออก'; + + @override + String get addCassandraPerk => 'เพิ่ม\nสิทธิพิเศษแคสแซนดรา'; + + @override + String get dontSaveRevealedCards => 'ไม่บันทึก\nการ์ดที่เปิดเผย'; + + @override + String get saveRevealedCards => 'บันทึก\nการ์ดที่เปิดเผย'; + + @override + String removedCountLabel(int count) { + return 'นำออกแล้ว: $count'; + } + + @override + String get removeDonation => 'นำ\nการบริจาคออก'; + + @override + String get donateSanctuary => 'บริจาคให้\nศาลเจ้า'; + + @override + String get removePartyCard => 'นำ\nการ์ดกลุ่มออก:'; + + @override + String get addPartyCard => 'เพิ่ม\nการ์ดกลุ่ม:'; + + @override + String get perks => 'สิทธิพิเศษ'; + + @override + String get revealCards => 'เปิดเผย\nการ์ด:'; + + @override + String get revealAll => 'ทั้งหมด'; + + @override + String get drawExtraCard => 'จั่วการ์ดพิเศษ'; + + @override + String get extraShuffle => 'สับพิเศษ'; + + @override + String get inactivateMonster => 'ปิดใช้งาน\nมอนสเตอร์'; + + @override + String get activateMonster => 'เปิดใช้งาน\nมอนสเตอร์'; + + @override + String addEliteStandees(int count, String name) { + return 'เพิ่ม $name ชั้นยอด $count ตัว'; + } + + @override + String addNormalStandees(int count, String name) { + return 'เพิ่ม $name ธรรมดา $count ตัว'; + } + + @override + String get characterLoot => 'การปล้นสะดมของตัวละคร'; + + @override + String addSpecialCard(int nr) { + return 'เพิ่มการ์ด $nr'; + } + + @override + String removeSpecialCard(int nr) { + return 'นำการ์ด $nr ออก'; + } + + @override + String get enhanceCards => 'เสริมการ์ด'; + + @override + String get addLootCard => 'เพิ่มการ์ด'; + + @override + String get returnToTop => 'คืนสู่ด้านบน'; + + @override + String get returnToBottom => 'คืนสู่ด้านล่าง'; + + @override + String characterLootTitle(String name) { + return 'การปล้นสะดมของ $name:'; + } + + @override + String get setLootOwner => 'เจ้าของการปล้นสะดม:'; + + @override + String get lootNameCoin => 'เหรียญ'; + + @override + String get lootNameHide => 'หนัง'; + + @override + String get lootNameLumber => 'ไม้'; + + @override + String get lootNameMetal => 'โลหะ'; + + @override + String get lootNameArrowvine => 'เถาลูกศร'; + + @override + String get lootNameAxenut => 'ถั่วขวาน'; + + @override + String get lootNameCorpsecap => 'เห็ดศพ'; + + @override + String get lootNameFlamefruit => 'ผลไม้เปลวเพลิง'; + + @override + String get lootNameRockroot => 'รากหิน'; + + @override + String get lootNameSnowthistle => 'หนามหิมะ'; + + @override + String get lootAmount2For2 => '2 สำหรับ 2 ผู้เล่น'; + + @override + String get lootAmount2For23 => '2 สำหรับ 2-3 ผู้เล่น'; + + @override + String cmdActivateMonster(String name) { + return 'เปิดใช้งาน $name'; + } + + @override + String cmdDeactivateMonster(String name) { + return 'ปิดใช้งาน $name'; + } + + @override + String cmdAddCharacter(String id) { + return 'เพิ่ม $id'; + } + + @override + String cmdAddCondition(String condition) { + return 'เพิ่มสถานะ: $condition'; + } + + @override + String cmdRemoveCondition(String condition) { + return 'นำสถานะออก: $condition'; + } + + @override + String cmdAddPartyCard(String character, String type) { + return '$character เพิ่มการ์ดกลุ่ม $type'; + } + + @override + String cmdRemovePartyCard(String character) { + return '$character นำการ์ดกลุ่มออก'; + } + + @override + String cmdAddFactionCard(String character) { + return '$character เพิ่มการ์ดฝ่าย'; + } + + @override + String cmdRemoveFactionCard(String character) { + return '$character นำการ์ดฝ่ายออก'; + } + + @override + String cmdAddLootCard(String type) { + return 'เพิ่มการ์ดการปล้นสะดม $type'; + } + + @override + String cmdAddMonster(String name) { + return 'เพิ่ม $name'; + } + + @override + String cmdAddSpecialLootCard(int nr) { + return 'เพิ่มการ์ดการปล้นสะดมพิเศษ $nr'; + } + + @override + String cmdRemoveSpecialLootCard(int nr) { + return 'นำการ์ดการปล้นสะดมพิเศษ $nr ออก'; + } + + @override + String get cmdAddMinusOne => 'เพิ่มลบหนึ่ง'; + + @override + String get cmdRemoveMinusOne => 'นำลบหนึ่งออก'; + + @override + String get cmdRemoveMinusTwo => 'นำลบสองออก'; + + @override + String get cmdAddBackMinusTwo => 'คืนลบสอง'; + + @override + String get cmdRemovePlusZero => 'นำบวกศูนย์ออก'; + + @override + String get cmdAddBackPlusZero => 'คืนบวกศูนย์'; + + @override + String cmdRevealModifierCards(int count) { + return 'เปิดเผยการ์ดปรับแต่ง $count ใบ'; + } + + @override + String cmdCassandraLeaveRevealed(String deck) { + return 'ทิ้งการ์ดที่เปิดเผยไว้บนสำรับ $deck'; + } + + @override + String cmdCassandraSpecialOff(String deck) { + return 'ปิดพิเศษแคสแซนดราสำหรับสำรับ $deck'; + } + + @override + String get cmdImbueMonsterDeck => 'ซึมซับสำรับมอนสเตอร์'; + + @override + String get cmdAdvancedImbueMonsterDeck => 'การซึมซับขั้นสูงของสำรับมอนสเตอร์'; + + @override + String get cmdRemoveImbueMonsterDeck => 'นำการซึมซับออก'; + + @override + String get cmdChangeName => 'เปลี่ยนชื่อตัวละคร'; + + @override + String get cmdAddNoteRow => 'เพิ่มแถวบันทึก'; + + @override + String get cmdSetNoteRowText => 'แก้ไขบันทึก'; + + @override + String get cmdSetNoteRowColor => 'เปลี่ยนสีบันทึก'; + + @override + String get cmdLinkNoteRow => 'เชื่อมแถวบันทึก'; + + @override + String get cmdRemoveNoteRow => 'ลบแถวบันทึก'; + + @override + String get cmdAddBless => 'เพิ่มพร'; + + @override + String get cmdRemoveBless => 'นำพรออก'; + + @override + String get cmdAddCurse => 'เพิ่มคำสาป'; + + @override + String get cmdRemoveCurse => 'นำคำสาปออก'; + + @override + String get cmdAddEmpower => 'เพิ่มการเสริมพลัง'; + + @override + String get cmdRemoveEmpower => 'นำการเสริมพลังออก'; + + @override + String get cmdAddEnfeeble => 'เพิ่มการอ่อนแอ'; + + @override + String get cmdRemoveEnfeeble => 'นำการอ่อนแอออก'; + + @override + String cmdIncreaseMaxHealth(String owner) { + return 'เพิ่ม HP สูงสุดของ $owner'; + } + + @override + String cmdDecreaseMaxHealth(String owner) { + return 'ลด HP สูงสุดของ $owner'; + } + + @override + String get cmdChangeStat => 'เปลี่ยนสถิติ'; + + @override + String cmdIncreaseXp(String figure, int amount) { + return 'เพิ่ม XP ของ $figure $amount'; + } + + @override + String cmdDecreaseXp(String figure, int amount) { + return 'ลด XP ของ $figure $amount'; + } + + @override + String get cmdClearUnlockedClasses => 'ล้างคลาสที่ปลดล็อก'; + + @override + String cmdDonateSanctuary(String character) { + return '$character บริจาคให้ศาลเจ้า'; + } + + @override + String cmdRemoveSanctuaryDonation(String character) { + return 'นำการบริจาคของ $character ออก'; + } + + @override + String get cmdDrawExtraAbilityCard => 'จั่วการ์ดความสามารถพิเศษ'; + + @override + String get cmdDraw => 'จั่ว'; + + @override + String get cmdDrawLootCard => 'จั่วการ์ดการปล้นสะดม'; + + @override + String cmdDrawModifierCard(String name) { + return 'จั่วการ์ดปรับแต่ง $name'; + } + + @override + String get cmdRemoveLootEnhancement => 'นำการเสริมการปล้นสะดมออก'; + + @override + String get cmdAddLootEnhancement => 'เพิ่มการเสริมการปล้นสะดม'; + + @override + String get cmdHideAllyDeck => 'ซ่อนสำรับพันธมิตร'; + + @override + String get cmdShowAllyDeck => 'แสดงสำรับพันธมิตร'; + + @override + String get cmdIceWraithTurnNormal => 'ผีน้ำแข็งเปลี่ยนเป็นธรรมดา'; + + @override + String get cmdIceWraithTurnElite => 'ผีน้ำแข็งเปลี่ยนเป็นชั้นยอด'; + + @override + String cmdImbueElement(String element) { + return 'ซึมซับธาตุ $element'; + } + + @override + String cmdUseElement(String element) { + return 'ใช้ธาตุ $element'; + } + + @override + String cmdLoadCharacter(String name) { + return 'โหลดตัวละครที่บันทึกไว้: $name'; + } + + @override + String cmdLoadGame(String name) { + return 'โหลดเกมที่บันทึกไว้: $name'; + } + + @override + String get cmdNextRound => 'รอบถัดไป'; + + @override + String get cmdRemoveAmdCard => 'นำการ์ด AMD ออก'; + + @override + String cmdRemoveCard(String deck, int nr) { + return 'นำการ์ด $deck หมายเลข $nr ออก'; + } + + @override + String get cmdRemoveAllCharacters => 'นำตัวละครทั้งหมดออก'; + + @override + String cmdRemoveCharacter(String id) { + return 'นำ $id ออก'; + } + + @override + String get cmdRemoveAllMonsters => 'นำมอนสเตอร์ทั้งหมดออก'; + + @override + String cmdRemoveMonster(String name) { + return 'นำ $name ออก'; + } + + @override + String get cmdReorderAbilityCards => 'จัดเรียงการ์ดความสามารถใหม่'; + + @override + String get cmdReorderList => 'จัดเรียงรายการใหม่'; + + @override + String get cmdReorderModifierCards => 'จัดเรียงการ์ดปรับแต่งใหม่'; + + @override + String get cmdReturnLootCard => 'คืนการ์ดการปล้นสะดม'; + + @override + String get cmdReturnModifierCard => 'คืนการ์ดปรับแต่งขึ้นด้านบน'; + + @override + String get cmdReturnRemovedAmdCard => 'คืนการ์ด AMD ที่นำออก'; + + @override + String get cmdNoAllyDeckInOgGloom => + 'ไม่มีสำรับพันธมิตรใน Gloomhaven ดั้งเดิม'; + + @override + String get cmdUseAllyDeckInOgGloom => + 'ใช้สำรับพันธมิตรใน Gloomhaven ดั้งเดิม'; + + @override + String cmdMarkAsSummon(String owner) { + return 'ทำเครื่องหมาย $owner เป็นสิ่งที่ถูกเรียก'; + } + + @override + String cmdRemoveSummonMark(String owner) { + return 'นำเครื่องหมายการเรียกของ $owner ออก'; + } + + @override + String get cmdAutoLevelOn => 'เปิดใช้งานการอัปเดตระดับอัตโนมัติ'; + + @override + String get cmdAutoLevelOff => 'ปิดใช้งานการอัปเดตระดับอัตโนมัติ'; + + @override + String cmdSetCampaign(String campaign) { + return 'ตั้งค่าแคมเปญ $campaign'; + } + + @override + String cmdSetCharacterLevel(String character) { + return 'ตั้งค่าระดับ $character'; + } + + @override + String cmdSetDifficulty(String difficulty) { + return 'ตั้งค่าความยาก $difficulty'; + } + + @override + String cmdSetInitiative(String character) { + return 'ตั้งค่าค่าริเริ่ม $character'; + } + + @override + String cmdSetCharacterNote(String character) { + return 'ตั้งค่าบันทึกสำหรับ $character'; + } + + @override + String get characterNoteTitle => 'บันทึก'; + + @override + String get characterNoteHint => 'เพิ่มบันทึก…'; + + @override + String get characterNoteQuickAdd => 'บันทึกด่วน'; + + @override + String cmdSetMonsterLevel(String monster) { + return 'ตั้งค่าระดับ $monster'; + } + + @override + String get cmdSetLootOwner => 'ตั้งค่าเจ้าของการปล้นสะดม'; + + @override + String get cmdSetScenario => 'ตั้งค่าฉาก'; + + @override + String get cmdSetSoloOn => 'เปิดใช้งานคำแนะนำระดับโซโล'; + + @override + String get cmdSetSoloOff => 'ปิดใช้งานคำแนะนำระดับโซโล'; + + @override + String get cmdExtraAbilityShuffle => 'สับสำรับความสามารถพิเศษ'; + + @override + String get cmdExtraAmdShuffle => 'สับสำรับ AMD พิเศษ'; + + @override + String get cmdDrawnAbilityShuffle => 'สับสำรับความสามารถที่จั่ว'; + + @override + String get cmdDontTrackStandees => 'ไม่ติดตามตัวยืน'; + + @override + String get cmdTrackStandees => 'ติดตามตัวยืน'; + + @override + String cmdTurnDone(String id) { + return 'เทิร์น $id เสร็จสิ้น'; + } + + @override + String cmdAddPerk(String character, int index) { + return 'เพิ่มสิทธิพิเศษ $index ของ \'$character\''; + } + + @override + String cmdRemovePerk(String character, int index) { + return 'นำสิทธิพิเศษ $index ของ \'$character\' ออก'; + } + + @override + String cmdUnlock(String id) { + return 'ปลดล็อก $id'; + } + + @override + String cmdLock(String id) { + return 'ล็อก $id'; + } + + @override + String get cmdSetLevel => 'ตั้งค่าระดับ'; + + @override + String get cmdAddSection => 'เพิ่มส่วน'; + + @override + String cmdAddStandee(String name, int nr) { + return 'เพิ่ม $name $nr'; + } + + @override + String get cmdDrawMonsterModifierCard => 'จั่วการ์ดปรับแต่งมอนสเตอร์'; + + @override + String cmdIncreaseHealth(String figure, int amount) { + return 'เพิ่ม HP ของ $figure $amount'; + } + + @override + String cmdKill(String owner) { + return 'กำจัด $owner'; + } + + @override + String cmdDecreaseHealth(String owner, int amount) { + return 'ลด HP ของ $owner $amount'; + } + + @override + String cmdUseFhPerks(String character) { + return '$character ใช้สิทธิพิเศษ Frosthaven'; + } + + @override + String cmdDontUseFhPerks(String character) { + return '$character ไม่ใช้สิทธิพิเศษ Frosthaven'; + } + + @override + String get cmdRemoveNoCharacters => 'ไม่ได้นำตัวละครออก'; + + @override + String get cmdRemoveNoMonsters => 'ไม่ได้นำมอนสเตอร์ออก'; +} diff --git a/server/lib/core/l10n/app_localizations_zh.dart b/server/lib/core/l10n/app_localizations_zh.dart new file mode 100644 index 0000000..4756f39 --- /dev/null +++ b/server/lib/core/l10n/app_localizations_zh.dart @@ -0,0 +1,2261 @@ +// ignore: unused_import +import 'package:intl/intl.dart' as intl; +import 'app_localizations.dart'; + +// ignore_for_file: type=lint + +/// The translations for Chinese (`zh`). +class AppLocalizationsZh extends AppLocalizations { + AppLocalizationsZh([String locale = 'zh']) : super(locale); + + @override + String get menuSetScenario => '设置场景'; + + @override + String get menuAddCharacter => '添加角色'; + + @override + String get menuRemoveCharacters => '移除角色'; + + @override + String get menuSetLevel => '设置等级'; + + @override + String get menuLootDeck => '战利品牌堆菜单'; + + @override + String get menuAddMonsters => '添加怪物'; + + @override + String get menuRemoveMonsters => '移除怪物'; + + @override + String get menuShowAllyDeck => '显示盟友修改牌堆'; + + @override + String get menuHideAllyDeck => '隐藏盟友修改牌堆'; + + @override + String get menuSettings => '设置'; + + @override + String get menuDocumentation => '文档'; + + @override + String get menuDonate => '捐赠'; + + @override + String get menuExit => '退出'; + + @override + String get menuAddSection => '添加章节'; + + @override + String get menuAddRandomDungeonCard => '添加随机地下城卡牌'; + + @override + String get menuActionLog => '查看操作记录'; + + @override + String get actionLogTitle => '最近 20 项操作'; + + @override + String get actionLogEmpty => '暂无操作'; + + @override + String get actionLogRollbackHint => '点按某个操作以回退到此处'; + + @override + String get actionLogRollbackTitle => '回退?'; + + @override + String actionLogRollbackBody(String action, int count) { + return '回退到\"$action\"?这将撤销之后的 $count 个操作。在你做出更改之前仍可重做。'; + } + + @override + String get actionLogRollbackConfirm => '回退'; + + @override + String get menuAddNoteRow => '添加备注行'; + + @override + String get noteRowTitle => '备注'; + + @override + String get noteRowHint => '备注内容…'; + + @override + String get noteRowColourLabel => '颜色'; + + @override + String get noteRowConnectLabel => '关联到:'; + + @override + String get noteRowConnectNone => '无(自由备注)'; + + @override + String get noteRowConnectPlayer => '玩家'; + + @override + String get noteRowConnectMonster => '怪物'; + + @override + String get noteRowWholeGroup => '整组'; + + @override + String get noteRowAll => '全部'; + + @override + String noteRowStandeeNr(int nr) { + return '立牌 $nr'; + } + + @override + String get noteRowAddFromMenu => '添加备注'; + + @override + String get noteRowDelete => '删除备注'; + + @override + String get undo => '撤销'; + + @override + String undoWithDescription(String description) { + return '撤销:$description'; + } + + @override + String get redo => '重做'; + + @override + String redoWithDescription(String description) { + return '重做:$description'; + } + + @override + String versionLabel(String version) { + return '版本 $version'; + } + + @override + String get connectedAsClient => '已作为客户端连接'; + + @override + String get connecting => '连接中…'; + + @override + String get cancelConnect => 'Cancel'; + + @override + String get connectionCancelled => 'Connection cancelled'; + + @override + String connectAsClientWithIp(String ip) { + return '作为客户端连接($ip)'; + } + + @override + String get connectAsClientLabel => '作为客户端连接'; + + @override + String stopServerWithIp(String ip) { + return '停止服务器 $ip'; + } + + @override + String startHostServerWithIp(String ip) { + return '启动服务器 $ip'; + } + + @override + String get stopServerButton => '停止服务器'; + + @override + String get startHostServerButton => '启动主机服务器'; + + @override + String get networkConnectLocal => '通过本地 Wi-Fi 连接设备:'; + + @override + String get networkServerIpHint => '服务器 IP 地址'; + + @override + String get networkPortHint => '端口'; + + @override + String get settingsLanguage => '语言:'; + + @override + String get settingsDarkMode => '深色模式'; + + @override + String get settingsSoftNumpad => '软数字键盘'; + + @override + String get settingsNoInit => '不询问先攻'; + + @override + String get settingsExpireConditions => '状态效果过期'; + + @override + String get settingsNoStandees => '不追踪立牌'; + + @override + String get settingsAutoAddStandees => '自动添加立牌'; + + @override + String get settingsAutoAddSpawns => '自动添加召唤物'; + + @override + String get settingsRandomStandees => '随机立牌'; + + @override + String get settingsNoCalculations => '无自动计算'; + + @override + String get settingsHideLootDeck => '隐藏战利品牌堆'; + + @override + String get settingsShimmer => '属性卡文字闪烁效果'; + + @override + String get settingsPowerModeLabel => 'Power saving'; + + @override + String get powerModeNormal => 'Normal'; + + @override + String get powerModeDimWhenIdle => 'Dim when idle'; + + @override + String get settingsPowerModeInfoTitle => 'Power saving'; + + @override + String get settingsPowerModeInfo => + 'Three levels of battery saving, from none to most.\n\nNormal — the screen is held awake at full brightness for as long as the app is open. Nothing is dimmed and nothing sleeps. Best while you are actively playing.\n\nDim when idle — the screen is still held awake and the app never locks, but after 30 seconds without input the board dims. The board stays readable from across the table, and a single tap brings it straight back with nothing lost. Good for a game in progress that you glance at between turns.\n\nReduce power use — hands the screen back to your device, so it dims and turns off on its own schedule and you unlock to return. Also lowers drawing quality to save more: card and monster box shadows become hard-edged instead of softly blurred, icons are filtered more cheaply, and shimmering text effects are turned off. Best for infrequent use and low battery capacity devices.\n\nNothing about how the game works changes at any level — no tracking, syncing or rules behaviour is affected.'; + + @override + String get settingsReducePower => 'Reduce power use'; + + @override + String get settingsReducePowerInfoTitle => 'Reduce power use'; + + @override + String get settingsReducePowerInfo => + 'Saves battery by doing less drawing work, at the cost of some visual polish.\n\nWhat changes:\n\n• The screen is allowed to dim and turn off on its own. Normally this app keeps it awake the whole time it is open, which is by far the biggest drain on a phone or tablet.\n\n• Card and monster box shadows become hard-edged instead of softly blurred.\n\n• Icons are filtered more cheaply. You may notice slightly rougher edges on small images.\n\n• Shimmering text effects are turned off.\n\nNothing about how the game works changes — no tracking, syncing or rules behaviour is affected. You can turn this off again at any time.'; + + @override + String get settingsFhHazTerrainCalc => '原版Gloomhaven中使用Frosthaven危险地形计算'; + + @override + String get settingsAllyDeckOGGloom => '原版Gloomhaven中的盟友修改牌堆'; + + @override + String get settingsShowScenarioNames => '显示场景名称'; + + @override + String get settingsShowBattleGoalReminder => '显示战斗目标提醒'; + + @override + String get settingsShowCustomContent => '显示自定义内容'; + + @override + String get settingsShowSections => '在主界面显示章节'; + + @override + String get settingsShowReminders => '显示特殊规则提醒'; + + @override + String get settingsShowAmdDeck => '显示攻击修改牌堆'; + + @override + String get settingsShowCharacterAmd => '显示角色修改牌堆'; + + @override + String get settingsHealthWheel => '生命值滚轮:左右拖动更改'; + + @override + String get settingsFullscreen => '全屏'; + + @override + String get settingsMainListScaling => '主列表缩放:'; + + @override + String get settingsAppBarScaling => '应用栏缩放:'; + + @override + String get settingsStyleLabel => '风格:'; + + @override + String get styleFrosthaven => 'Frosthaven'; + + @override + String get styleOriginal => '原版'; + + @override + String get settingsClearUnlocked => '清除已解锁角色和内容'; + + @override + String get settingsUnlockSpecials => '解锁特殊内容'; + + @override + String get settingsLoadSaveState => '加载/保存状态'; + + @override + String get noResultsFound => '无结果'; + + @override + String get close => '关闭'; + + @override + String get retry => '重试'; + + @override + String get specialUnlocks => '特殊解锁'; + + @override + String get loadSaveDeleteCharacters => '加载、保存或删除角色。'; + + @override + String get loadAddDeleteSaves => '加载、添加或删除存档。'; + + @override + String get addNewSave => '新存档'; + + @override + String get addNewSaveLabel => '新存档:'; + + @override + String get loadButton => '加载'; + + @override + String get saveButton => '保存'; + + @override + String get deleteButton => '删除'; + + @override + String get setSaveName => '存档名称:'; + + @override + String get loadOrSaveCharacters => '加载或保存角色'; + + @override + String get loadCharacter => '加载角色:'; + + @override + String get removeAll => '全部移除'; + + @override + String get removeCardQuestion => '移除卡牌?'; + + @override + String get sendToBottom => '发送到底部'; + + @override + String get shuffleUndrawnCards => '洗混未抽卡牌'; + + @override + String get returnToDiscardPile => '返回弃牌堆'; + + @override + String get returnToDrawPile => '返回牌堆'; + + @override + String get addExtraLootCard => '添加额外战利品卡牌'; + + @override + String get addStandeeNr => '添加立牌编号'; + + @override + String get summonedLabel => '已召唤:'; + + @override + String get characterDecks => '角色牌堆'; + + @override + String get shuffleAndDraw => '洗牌\n并抽牌'; + + @override + String get draw => '抽牌'; + + @override + String get nextRound => ' 下一回合'; + + @override + String get returnTopCard => '返回顶部卡牌'; + + @override + String removeCardWithDetails(String title, int nr) { + return '移除 $title\n(卡牌编号:$nr)'; + } + + @override + String get tapCardToAddToDeck => '点击卡牌添加到牌堆'; + + @override + String get removeCardFromDeckQuestion => '从牌堆移除卡牌?'; + + @override + String get changeName => '更改名称:'; + + @override + String get showBosses => '显示首领'; + + @override + String get showScenarioSpecialMonsters => '显示场景特殊怪物'; + + @override + String get addAsAlly => '添加为盟友'; + + @override + String get addMonsterLabel => '添加怪物'; + + @override + String get allCampaigns => '所有战役'; + + @override + String get showMonstersFrom => ' 显示怪物来自: '; + + @override + String setMonsterLevel(String name) { + return '$name 等级'; + } + + @override + String setSummonHealth(String name) { + return '$name 最大生命值'; + } + + @override + String get setScenarioLevel => '场景等级'; + + @override + String enhancedLevel(String level) { + return '已强化:$level'; + } + + @override + String get soloLabel => '单人:'; + + @override + String get automaticScenarioLevel => '自动场景等级:'; + + @override + String get difficultyLabel => '难度:'; + + @override + String get lootCardEnhancements => '战利品卡牌强化'; + + @override + String get addPerks => '添加特权'; + + @override + String get useFrosthavenPerks => '使用Frosthaven特权'; + + @override + String currentCampaign(String campaign) { + return '当前战役:$campaign'; + } + + @override + String get addCharacterHint => '添加角色(输入名称以查看隐藏职业)'; + + @override + String get trapDamage => '陷阱伤害'; + + @override + String get hazardousTerrainDamage => '危险地形伤害'; + + @override + String get experienceAdded => '已添加经验值'; + + @override + String get goldCoinValue => '金币价值'; + + @override + String get levelLegendLabel => '等级'; + + @override + String get saveStateNote => '应用在每次操作后自动保存。这些存档用于备份或多个战役。'; + + @override + String clientConnectedTo(String address) { + return '客户端已连接至:$address'; + } + + @override + String clientError(String error) { + return '客户端错误:$error'; + } + + @override + String clientListenError(String error) { + return '客户端监听错误:$error'; + } + + @override + String get lostConnectionToServer => '已失去与服务器的连接'; + + @override + String get stateMismatch => '您的状态不是最新的,请重试。'; + + @override + String get serverUnresponsive => '服务器无响应。客户端已断开。'; + + @override + String get clientDisconnected => '客户端已断开'; + + @override + String get serverOffline => '服务器离线'; + + @override + String get clientLeft => '客户端已离开。'; + + @override + String get clientTooOld => '旧版客户端尝试连接。请更新应用。'; + + @override + String networkConnection(String status) { + return '网络连接:$status'; + } + + @override + String get failedToGetWifiIp => '无法获取IP地址'; + + @override + String get badOmen => '凶兆'; + + @override + String badOmensLeft(int count) { + return '剩余凶兆:$count'; + } + + @override + String get corrosiveSpew => '腐蚀喷射'; + + @override + String get empowersOnTop => '强化卡在顶部'; + + @override + String addMinusOneCard(String direction, int count) { + String _temp0 = intl.Intl.selectLogic(direction, { + 'added': '添加-1卡牌(已添加:$count)', + 'removed': '添加-1卡牌(已移除:$count)', + 'other': '-1卡牌($count)', + }); + return '$_temp0'; + } + + @override + String get removeMinusOneCard => '移除-1卡牌'; + + @override + String get removeMinusTwoCard => '移除-2卡牌'; + + @override + String get minusTwoCardRemoved => '-2卡牌已移除'; + + @override + String get removePlusZeroCard => '移除+0卡牌'; + + @override + String get plusZeroCardRemoved => '+0卡牌已移除'; + + @override + String get removeImbue => '移除注魔'; + + @override + String get imbue => '注魔'; + + @override + String get advancedImbue => '高级注魔'; + + @override + String get removeHailPerk => '移除冰雹特权'; + + @override + String get addHailPerk => '添加冰雹特权'; + + @override + String get removeCassandraPerk => '移除\n卡桑德拉特权'; + + @override + String get addCassandraPerk => '添加\n卡桑德拉特权'; + + @override + String get dontSaveRevealedCards => '不保留\n已揭示卡牌'; + + @override + String get saveRevealedCards => '保留\n已揭示卡牌'; + + @override + String removedCountLabel(int count) { + return '已移除:$count'; + } + + @override + String get removeDonation => '移除\n捐赠'; + + @override + String get donateSanctuary => '捐赠给\n圣所'; + + @override + String get removePartyCard => '移除\n队伍卡牌:'; + + @override + String get addPartyCard => '添加\n队伍卡牌:'; + + @override + String get perks => '特权'; + + @override + String get revealCards => '揭示\n卡牌:'; + + @override + String get revealAll => '全部'; + + @override + String get drawExtraCard => '抽取额外卡牌'; + + @override + String get extraShuffle => '额外洗牌'; + + @override + String get inactivateMonster => '停用\n怪物'; + + @override + String get activateMonster => '激活\n怪物'; + + @override + String addEliteStandees(int count, String name) { + return '添加 $count 个精英 $name'; + } + + @override + String addNormalStandees(int count, String name) { + return '添加 $count 个普通 $name'; + } + + @override + String get characterLoot => '角色战利品'; + + @override + String addSpecialCard(int nr) { + return '添加 $nr 号卡牌'; + } + + @override + String removeSpecialCard(int nr) { + return '移除 $nr 号卡牌'; + } + + @override + String get enhanceCards => '强化卡牌'; + + @override + String get addLootCard => '添加卡牌'; + + @override + String get returnToTop => '返回顶部'; + + @override + String get returnToBottom => '返回底部'; + + @override + String characterLootTitle(String name) { + return '$name 的战利品:'; + } + + @override + String get setLootOwner => '战利品所有者:'; + + @override + String get lootNameCoin => '金币'; + + @override + String get lootNameHide => '皮革'; + + @override + String get lootNameLumber => '木材'; + + @override + String get lootNameMetal => '金属'; + + @override + String get lootNameArrowvine => '箭藤'; + + @override + String get lootNameAxenut => '斧坚果'; + + @override + String get lootNameCorpsecap => '尸盖菇'; + + @override + String get lootNameFlamefruit => '火焰果'; + + @override + String get lootNameRockroot => '岩根'; + + @override + String get lootNameSnowthistle => '雪蓟'; + + @override + String get lootAmount2For2 => '2人游戏2个'; + + @override + String get lootAmount2For23 => '2-3人游戏2个'; + + @override + String cmdActivateMonster(String name) { + return '激活 $name'; + } + + @override + String cmdDeactivateMonster(String name) { + return '停用 $name'; + } + + @override + String cmdAddCharacter(String id) { + return '添加 $id'; + } + + @override + String cmdAddCondition(String condition) { + return '添加状态:$condition'; + } + + @override + String cmdRemoveCondition(String condition) { + return '移除状态:$condition'; + } + + @override + String cmdAddPartyCard(String character, String type) { + return '$character 添加队伍卡牌 $type'; + } + + @override + String cmdRemovePartyCard(String character) { + return '$character 移除队伍卡牌'; + } + + @override + String cmdAddFactionCard(String character) { + return '$character 添加派系卡牌'; + } + + @override + String cmdRemoveFactionCard(String character) { + return '$character 移除派系卡牌'; + } + + @override + String cmdAddLootCard(String type) { + return '添加战利品卡牌 $type'; + } + + @override + String cmdAddMonster(String name) { + return '添加 $name'; + } + + @override + String cmdAddSpecialLootCard(int nr) { + return '添加特殊战利品卡牌 $nr'; + } + + @override + String cmdRemoveSpecialLootCard(int nr) { + return '移除特殊战利品卡牌 $nr'; + } + + @override + String get cmdAddMinusOne => '添加负一'; + + @override + String get cmdRemoveMinusOne => '移除负一'; + + @override + String get cmdRemoveMinusTwo => '移除负二'; + + @override + String get cmdAddBackMinusTwo => '归还负二'; + + @override + String get cmdRemovePlusZero => '移除正零'; + + @override + String get cmdAddBackPlusZero => '归还正零'; + + @override + String cmdRevealModifierCards(int count) { + return '揭示 $count 张修改卡牌'; + } + + @override + String cmdCassandraLeaveRevealed(String deck) { + return '在 $deck 牌堆顶保留已揭示卡牌'; + } + + @override + String cmdCassandraSpecialOff(String deck) { + return '$deck 牌堆的卡桑德拉特殊效果已关闭'; + } + + @override + String get cmdImbueMonsterDeck => '注魔怪物牌堆'; + + @override + String get cmdAdvancedImbueMonsterDeck => '高级注魔怪物牌堆'; + + @override + String get cmdRemoveImbueMonsterDeck => '移除注魔'; + + @override + String get cmdChangeName => '更改角色名称'; + + @override + String get cmdAddNoteRow => '添加备注行'; + + @override + String get cmdSetNoteRowText => '编辑备注'; + + @override + String get cmdSetNoteRowColor => '更改备注颜色'; + + @override + String get cmdLinkNoteRow => '关联备注行'; + + @override + String get cmdRemoveNoteRow => '移除备注行'; + + @override + String get cmdAddBless => '添加祝福'; + + @override + String get cmdRemoveBless => '移除祝福'; + + @override + String get cmdAddCurse => '添加诅咒'; + + @override + String get cmdRemoveCurse => '移除诅咒'; + + @override + String get cmdAddEmpower => '添加强化'; + + @override + String get cmdRemoveEmpower => '移除强化'; + + @override + String get cmdAddEnfeeble => '添加削弱'; + + @override + String get cmdRemoveEnfeeble => '移除削弱'; + + @override + String cmdIncreaseMaxHealth(String owner) { + return '增加 $owner 最大生命值'; + } + + @override + String cmdDecreaseMaxHealth(String owner) { + return '减少 $owner 最大生命值'; + } + + @override + String get cmdChangeStat => '修改属性'; + + @override + String cmdIncreaseXp(String figure, int amount) { + return '增加 $figure 经验值 $amount'; + } + + @override + String cmdDecreaseXp(String figure, int amount) { + return '减少 $figure 经验值 $amount'; + } + + @override + String get cmdClearUnlockedClasses => '清除已解锁职业'; + + @override + String cmdDonateSanctuary(String character) { + return '$character 向圣所捐赠'; + } + + @override + String cmdRemoveSanctuaryDonation(String character) { + return '移除 $character 的捐赠'; + } + + @override + String get cmdDrawExtraAbilityCard => '抽取额外技能卡牌'; + + @override + String get cmdDraw => '抽牌'; + + @override + String get cmdDrawLootCard => '抽取战利品卡牌'; + + @override + String cmdDrawModifierCard(String name) { + return '抽取 $name 修改卡牌'; + } + + @override + String get cmdRemoveLootEnhancement => '移除战利品强化'; + + @override + String get cmdAddLootEnhancement => '添加战利品强化'; + + @override + String get cmdHideAllyDeck => '隐藏盟友牌堆'; + + @override + String get cmdShowAllyDeck => '显示盟友牌堆'; + + @override + String get cmdIceWraithTurnNormal => '冰幽灵转为普通'; + + @override + String get cmdIceWraithTurnElite => '冰幽灵转为精英'; + + @override + String cmdImbueElement(String element) { + return '注魔元素 $element'; + } + + @override + String cmdUseElement(String element) { + return '使用元素 $element'; + } + + @override + String cmdLoadCharacter(String name) { + return '加载已保存角色:$name'; + } + + @override + String cmdLoadGame(String name) { + return '加载已保存游戏:$name'; + } + + @override + String get cmdNextRound => '下一回合'; + + @override + String get cmdRemoveAmdCard => '移除AMD卡牌'; + + @override + String cmdRemoveCard(String deck, int nr) { + return '移除 $deck $nr 号卡牌'; + } + + @override + String get cmdRemoveAllCharacters => '移除所有角色'; + + @override + String cmdRemoveCharacter(String id) { + return '移除 $id'; + } + + @override + String get cmdRemoveAllMonsters => '移除所有怪物'; + + @override + String cmdRemoveMonster(String name) { + return '移除 $name'; + } + + @override + String get cmdReorderAbilityCards => '重新排列技能卡牌'; + + @override + String get cmdReorderList => '重新排列列表'; + + @override + String get cmdReorderModifierCards => '重新排列修改卡牌'; + + @override + String get cmdReturnLootCard => '归还战利品卡牌'; + + @override + String get cmdReturnModifierCard => '将修改卡牌归还到顶部'; + + @override + String get cmdReturnRemovedAmdCard => '归还已移除AMD卡牌'; + + @override + String get cmdNoAllyDeckInOgGloom => '原版Gloomhaven无盟友牌堆'; + + @override + String get cmdUseAllyDeckInOgGloom => '在原版Gloomhaven中使用盟友牌堆'; + + @override + String cmdMarkAsSummon(String owner) { + return '将 $owner 标记为召唤物'; + } + + @override + String cmdRemoveSummonMark(String owner) { + return '移除 $owner 的召唤标记'; + } + + @override + String get cmdAutoLevelOn => '启用自动等级更新'; + + @override + String get cmdAutoLevelOff => '禁用自动等级更新'; + + @override + String cmdSetCampaign(String campaign) { + return '设置战役 $campaign'; + } + + @override + String cmdSetCharacterLevel(String character) { + return '设置 $character 等级'; + } + + @override + String cmdSetDifficulty(String difficulty) { + return '设置难度为 $difficulty'; + } + + @override + String cmdSetInitiative(String character) { + return '设置 $character 先攻'; + } + + @override + String cmdSetCharacterNote(String character) { + return '为 $character 设置备注'; + } + + @override + String get characterNoteTitle => '备注'; + + @override + String get characterNoteHint => '添加备注…'; + + @override + String get characterNoteQuickAdd => '快速备注'; + + @override + String cmdSetMonsterLevel(String monster) { + return '设置 $monster 等级'; + } + + @override + String get cmdSetLootOwner => '设置战利品所有者'; + + @override + String get cmdSetScenario => '设置场景'; + + @override + String get cmdSetSoloOn => '启用单人等级推荐'; + + @override + String get cmdSetSoloOff => '禁用单人等级推荐'; + + @override + String get cmdExtraAbilityShuffle => '额外洗技能牌堆'; + + @override + String get cmdExtraAmdShuffle => '额外洗AMD牌堆'; + + @override + String get cmdDrawnAbilityShuffle => '洗已抽技能牌堆'; + + @override + String get cmdDontTrackStandees => '不追踪立牌'; + + @override + String get cmdTrackStandees => '追踪立牌'; + + @override + String cmdTurnDone(String id) { + return '$id 回合结束'; + } + + @override + String cmdAddPerk(String character, int index) { + return '添加 \'$character\' 的第 $index 个特权'; + } + + @override + String cmdRemovePerk(String character, int index) { + return '移除 \'$character\' 的第 $index 个特权'; + } + + @override + String cmdUnlock(String id) { + return '解锁 $id'; + } + + @override + String cmdLock(String id) { + return '锁定 $id'; + } + + @override + String get cmdSetLevel => '设置等级'; + + @override + String get cmdAddSection => '添加章节'; + + @override + String cmdAddStandee(String name, int nr) { + return '添加 $name $nr'; + } + + @override + String get cmdDrawMonsterModifierCard => '抽取怪物修改卡牌'; + + @override + String cmdIncreaseHealth(String figure, int amount) { + return '增加 $figure 生命值 $amount'; + } + + @override + String cmdKill(String owner) { + return '消灭 $owner'; + } + + @override + String cmdDecreaseHealth(String owner, int amount) { + return '减少 $owner 生命值 $amount'; + } + + @override + String cmdUseFhPerks(String character) { + return '$character 使用Frosthaven特权'; + } + + @override + String cmdDontUseFhPerks(String character) { + return '$character 不使用Frosthaven特权'; + } + + @override + String get cmdRemoveNoCharacters => '未移除任何角色'; + + @override + String get cmdRemoveNoMonsters => '未移除任何怪物'; +} + +/// The translations for Chinese, using the Han script (`zh_Hant`). +class AppLocalizationsZhHant extends AppLocalizationsZh { + AppLocalizationsZhHant() : super('zh_Hant'); + + @override + String get menuSetScenario => '設定場景'; + + @override + String get menuAddCharacter => '新增角色'; + + @override + String get menuRemoveCharacters => '移除角色'; + + @override + String get menuSetLevel => '設定等級'; + + @override + String get menuLootDeck => '戰利品牌堆選單'; + + @override + String get menuAddMonsters => '新增怪物'; + + @override + String get menuRemoveMonsters => '移除怪物'; + + @override + String get menuShowAllyDeck => '顯示盟友修改牌堆'; + + @override + String get menuHideAllyDeck => '隱藏盟友修改牌堆'; + + @override + String get menuSettings => '設定'; + + @override + String get menuDocumentation => '說明文件'; + + @override + String get menuDonate => '捐贈'; + + @override + String get menuExit => '退出'; + + @override + String get menuAddSection => '新增章節'; + + @override + String get menuAddRandomDungeonCard => '新增隨機地下城卡牌'; + + @override + String get menuActionLog => '查看操作紀錄'; + + @override + String get actionLogTitle => '最近 20 項操作'; + + @override + String get actionLogEmpty => '尚無操作'; + + @override + String get actionLogRollbackHint => '點按某個操作以回退到此處'; + + @override + String get actionLogRollbackTitle => '回退?'; + + @override + String actionLogRollbackBody(String action, int count) { + return '回退到\"$action\"?這將撤銷之後的 $count 個操作。在你做出更改之前仍可重做。'; + } + + @override + String get actionLogRollbackConfirm => '回退'; + + @override + String get menuAddNoteRow => '新增備註列'; + + @override + String get noteRowTitle => '備註'; + + @override + String get noteRowHint => '備註內容…'; + + @override + String get noteRowColourLabel => '顏色'; + + @override + String get noteRowConnectLabel => '連結至:'; + + @override + String get noteRowConnectNone => '無(自由備註)'; + + @override + String get noteRowConnectPlayer => '玩家'; + + @override + String get noteRowConnectMonster => '怪物'; + + @override + String get noteRowWholeGroup => '整組'; + + @override + String get noteRowAll => '全部'; + + @override + String noteRowStandeeNr(int nr) { + return '立牌 $nr'; + } + + @override + String get noteRowAddFromMenu => '新增備註'; + + @override + String get noteRowDelete => '刪除備註'; + + @override + String get undo => '撤銷'; + + @override + String undoWithDescription(String description) { + return '撤銷:$description'; + } + + @override + String get redo => '重做'; + + @override + String redoWithDescription(String description) { + return '重做:$description'; + } + + @override + String versionLabel(String version) { + return '版本 $version'; + } + + @override + String get connectedAsClient => '已作為客戶端連線'; + + @override + String get connecting => '連線中…'; + + @override + String connectAsClientWithIp(String ip) { + return '作為客戶端連線($ip)'; + } + + @override + String get connectAsClientLabel => '作為客戶端連線'; + + @override + String stopServerWithIp(String ip) { + return '停止伺服器 $ip'; + } + + @override + String startHostServerWithIp(String ip) { + return '啟動伺服器 $ip'; + } + + @override + String get stopServerButton => '停止伺服器'; + + @override + String get startHostServerButton => '啟動主機伺服器'; + + @override + String get networkConnectLocal => '透過本地 Wi-Fi 連接裝置:'; + + @override + String get networkServerIpHint => '伺服器 IP 位址'; + + @override + String get networkPortHint => '連接埠'; + + @override + String get settingsLanguage => '語言:'; + + @override + String get settingsDarkMode => '深色模式'; + + @override + String get settingsSoftNumpad => '軟體數字鍵盤'; + + @override + String get settingsNoInit => '不詢問先攻'; + + @override + String get settingsExpireConditions => '狀態效果到期'; + + @override + String get settingsNoStandees => '不追蹤立牌'; + + @override + String get settingsAutoAddStandees => '自動新增立牌'; + + @override + String get settingsAutoAddSpawns => '自動新增召喚物'; + + @override + String get settingsRandomStandees => '隨機立牌'; + + @override + String get settingsNoCalculations => '無自動計算'; + + @override + String get settingsHideLootDeck => '隱藏戰利品牌堆'; + + @override + String get settingsShimmer => '屬性卡文字閃爍效果'; + + @override + String get settingsFhHazTerrainCalc => '原版Gloomhaven中使用Frosthaven危險地形計算'; + + @override + String get settingsAllyDeckOGGloom => '原版Gloomhaven中的盟友修改牌堆'; + + @override + String get settingsShowScenarioNames => '顯示場景名稱'; + + @override + String get settingsShowBattleGoalReminder => '顯示戰鬥目標提醒'; + + @override + String get settingsShowCustomContent => '顯示自訂內容'; + + @override + String get settingsShowSections => '在主介面顯示章節'; + + @override + String get settingsShowReminders => '顯示特殊規則提醒'; + + @override + String get settingsShowAmdDeck => '顯示攻擊修改牌堆'; + + @override + String get settingsShowCharacterAmd => '顯示角色修改牌堆'; + + @override + String get settingsHealthWheel => '生命值滾輪:左右拖動更改'; + + @override + String get settingsFullscreen => '全螢幕'; + + @override + String get settingsMainListScaling => '主清單縮放:'; + + @override + String get settingsAppBarScaling => '應用程式列縮放:'; + + @override + String get settingsStyleLabel => '風格:'; + + @override + String get styleFrosthaven => 'Frosthaven'; + + @override + String get styleOriginal => '原版'; + + @override + String get settingsClearUnlocked => '清除已解鎖角色和內容'; + + @override + String get settingsUnlockSpecials => '解鎖特殊內容'; + + @override + String get settingsLoadSaveState => '載入/儲存狀態'; + + @override + String get noResultsFound => '無結果'; + + @override + String get close => '關閉'; + + @override + String get retry => '重試'; + + @override + String get specialUnlocks => '特殊解鎖'; + + @override + String get loadSaveDeleteCharacters => '載入、儲存或刪除角色。'; + + @override + String get loadAddDeleteSaves => '載入、新增或刪除存檔。'; + + @override + String get addNewSave => '新存檔'; + + @override + String get addNewSaveLabel => '新存檔:'; + + @override + String get loadButton => '載入'; + + @override + String get saveButton => '儲存'; + + @override + String get deleteButton => '刪除'; + + @override + String get setSaveName => '存檔名稱:'; + + @override + String get loadOrSaveCharacters => '載入或儲存角色'; + + @override + String get loadCharacter => '載入角色:'; + + @override + String get removeAll => '全部移除'; + + @override + String get removeCardQuestion => '移除卡牌?'; + + @override + String get sendToBottom => '傳送到底部'; + + @override + String get shuffleUndrawnCards => '洗混未抽卡牌'; + + @override + String get returnToDiscardPile => '返回棄牌堆'; + + @override + String get returnToDrawPile => '返回牌堆'; + + @override + String get addExtraLootCard => '新增額外戰利品卡牌'; + + @override + String get addStandeeNr => '新增立牌編號'; + + @override + String get summonedLabel => '已召喚:'; + + @override + String get characterDecks => '角色牌堆'; + + @override + String get shuffleAndDraw => '洗牌\n並抽牌'; + + @override + String get draw => '抽牌'; + + @override + String get nextRound => ' 下一回合'; + + @override + String get returnTopCard => '返回頂部卡牌'; + + @override + String removeCardWithDetails(String title, int nr) { + return '移除 $title\n(卡牌編號:$nr)'; + } + + @override + String get tapCardToAddToDeck => '點擊卡牌新增到牌堆'; + + @override + String get removeCardFromDeckQuestion => '從牌堆移除卡牌?'; + + @override + String get changeName => '更改名稱:'; + + @override + String get showBosses => '顯示首領'; + + @override + String get showScenarioSpecialMonsters => '顯示場景特殊怪物'; + + @override + String get addAsAlly => '新增為盟友'; + + @override + String get addMonsterLabel => '新增怪物'; + + @override + String get allCampaigns => '所有戰役'; + + @override + String get showMonstersFrom => ' 顯示怪物來自: '; + + @override + String setMonsterLevel(String name) { + return '$name 等級'; + } + + @override + String setSummonHealth(String name) { + return '$name 最大生命值'; + } + + @override + String get setScenarioLevel => '場景等級'; + + @override + String enhancedLevel(String level) { + return '已強化:$level'; + } + + @override + String get soloLabel => '單人:'; + + @override + String get automaticScenarioLevel => '自動場景等級:'; + + @override + String get difficultyLabel => '難度:'; + + @override + String get lootCardEnhancements => '戰利品卡牌強化'; + + @override + String get addPerks => '新增特權'; + + @override + String get useFrosthavenPerks => '使用Frosthaven特權'; + + @override + String currentCampaign(String campaign) { + return '目前戰役:$campaign'; + } + + @override + String get addCharacterHint => '新增角色(輸入名稱以查看隱藏職業)'; + + @override + String get trapDamage => '陷阱傷害'; + + @override + String get hazardousTerrainDamage => '危險地形傷害'; + + @override + String get experienceAdded => '已新增經驗值'; + + @override + String get goldCoinValue => '金幣價值'; + + @override + String get levelLegendLabel => '等級'; + + @override + String get saveStateNote => '應用程式在每次操作後自動儲存。這些存檔用於備份或多個戰役。'; + + @override + String clientConnectedTo(String address) { + return '客戶端已連線至:$address'; + } + + @override + String clientError(String error) { + return '客戶端錯誤:$error'; + } + + @override + String clientListenError(String error) { + return '客戶端監聽錯誤:$error'; + } + + @override + String get lostConnectionToServer => '已失去與伺服器的連線'; + + @override + String get stateMismatch => '您的狀態不是最新的,請重試。'; + + @override + String get serverUnresponsive => '伺服器無回應。客戶端已中斷連線。'; + + @override + String get clientDisconnected => '客戶端已中斷連線'; + + @override + String get serverOffline => '伺服器離線'; + + @override + String get clientLeft => '客戶端已離開。'; + + @override + String get clientTooOld => '舊版客戶端嘗試連線。請更新應用程式。'; + + @override + String networkConnection(String status) { + return '網路連線:$status'; + } + + @override + String get failedToGetWifiIp => '無法取得IP位址'; + + @override + String get badOmen => '凶兆'; + + @override + String badOmensLeft(int count) { + return '剩餘凶兆:$count'; + } + + @override + String get corrosiveSpew => '腐蝕噴射'; + + @override + String get empowersOnTop => '強化卡在頂部'; + + @override + String addMinusOneCard(String direction, int count) { + String _temp0 = intl.Intl.selectLogic(direction, { + 'added': '新增-1卡牌(已新增:$count)', + 'removed': '新增-1卡牌(已移除:$count)', + 'other': '-1卡牌($count)', + }); + return '$_temp0'; + } + + @override + String get removeMinusOneCard => '移除-1卡牌'; + + @override + String get removeMinusTwoCard => '移除-2卡牌'; + + @override + String get minusTwoCardRemoved => '-2卡牌已移除'; + + @override + String get removePlusZeroCard => '移除+0卡牌'; + + @override + String get plusZeroCardRemoved => '+0卡牌已移除'; + + @override + String get removeImbue => '移除注魔'; + + @override + String get imbue => '注魔'; + + @override + String get advancedImbue => '高級注魔'; + + @override + String get removeHailPerk => '移除冰雹特權'; + + @override + String get addHailPerk => '新增冰雹特權'; + + @override + String get removeCassandraPerk => '移除\n卡珊卓特權'; + + @override + String get addCassandraPerk => '新增\n卡珊卓特權'; + + @override + String get dontSaveRevealedCards => '不保留\n已揭示卡牌'; + + @override + String get saveRevealedCards => '保留\n已揭示卡牌'; + + @override + String removedCountLabel(int count) { + return '已移除:$count'; + } + + @override + String get removeDonation => '移除\n捐贈'; + + @override + String get donateSanctuary => '捐贈給\n聖所'; + + @override + String get removePartyCard => '移除\n隊伍卡牌:'; + + @override + String get addPartyCard => '新增\n隊伍卡牌:'; + + @override + String get perks => '特權'; + + @override + String get revealCards => '揭示\n卡牌:'; + + @override + String get revealAll => '全部'; + + @override + String get drawExtraCard => '抽取額外卡牌'; + + @override + String get extraShuffle => '額外洗牌'; + + @override + String get inactivateMonster => '停用\n怪物'; + + @override + String get activateMonster => '啟動\n怪物'; + + @override + String addEliteStandees(int count, String name) { + return '新增 $count 個精英 $name'; + } + + @override + String addNormalStandees(int count, String name) { + return '新增 $count 個普通 $name'; + } + + @override + String get characterLoot => '角色戰利品'; + + @override + String addSpecialCard(int nr) { + return '新增 $nr 號卡牌'; + } + + @override + String removeSpecialCard(int nr) { + return '移除 $nr 號卡牌'; + } + + @override + String get enhanceCards => '強化卡牌'; + + @override + String get addLootCard => '新增卡牌'; + + @override + String get returnToTop => '返回頂部'; + + @override + String get returnToBottom => '返回底部'; + + @override + String characterLootTitle(String name) { + return '$name 的戰利品:'; + } + + @override + String get setLootOwner => '戰利品所有者:'; + + @override + String get lootNameCoin => '金幣'; + + @override + String get lootNameHide => '皮革'; + + @override + String get lootNameLumber => '木材'; + + @override + String get lootNameMetal => '金屬'; + + @override + String get lootNameArrowvine => '箭藤'; + + @override + String get lootNameAxenut => '斧堅果'; + + @override + String get lootNameCorpsecap => '屍蓋菇'; + + @override + String get lootNameFlamefruit => '火焰果'; + + @override + String get lootNameRockroot => '岩根'; + + @override + String get lootNameSnowthistle => '雪薊'; + + @override + String get lootAmount2For2 => '2人遊戲2個'; + + @override + String get lootAmount2For23 => '2-3人遊戲2個'; + + @override + String cmdActivateMonster(String name) { + return '啟動 $name'; + } + + @override + String cmdDeactivateMonster(String name) { + return '停用 $name'; + } + + @override + String cmdAddCharacter(String id) { + return '新增 $id'; + } + + @override + String cmdAddCondition(String condition) { + return '新增狀態:$condition'; + } + + @override + String cmdRemoveCondition(String condition) { + return '移除狀態:$condition'; + } + + @override + String cmdAddPartyCard(String character, String type) { + return '$character 新增隊伍卡牌 $type'; + } + + @override + String cmdRemovePartyCard(String character) { + return '$character 移除隊伍卡牌'; + } + + @override + String cmdAddFactionCard(String character) { + return '$character 新增派系卡牌'; + } + + @override + String cmdRemoveFactionCard(String character) { + return '$character 移除派系卡牌'; + } + + @override + String cmdAddLootCard(String type) { + return '新增戰利品卡牌 $type'; + } + + @override + String cmdAddMonster(String name) { + return '新增 $name'; + } + + @override + String cmdAddSpecialLootCard(int nr) { + return '新增特殊戰利品卡牌 $nr'; + } + + @override + String cmdRemoveSpecialLootCard(int nr) { + return '移除特殊戰利品卡牌 $nr'; + } + + @override + String get cmdAddMinusOne => '新增負一'; + + @override + String get cmdRemoveMinusOne => '移除負一'; + + @override + String get cmdRemoveMinusTwo => '移除負二'; + + @override + String get cmdAddBackMinusTwo => '歸還負二'; + + @override + String get cmdRemovePlusZero => '移除正零'; + + @override + String get cmdAddBackPlusZero => '歸還正零'; + + @override + String cmdRevealModifierCards(int count) { + return '揭示 $count 張修改卡牌'; + } + + @override + String cmdCassandraLeaveRevealed(String deck) { + return '在 $deck 牌堆頂保留已揭示卡牌'; + } + + @override + String cmdCassandraSpecialOff(String deck) { + return '$deck 牌堆的卡珊卓特殊效果已關閉'; + } + + @override + String get cmdImbueMonsterDeck => '注魔怪物牌堆'; + + @override + String get cmdAdvancedImbueMonsterDeck => '高級注魔怪物牌堆'; + + @override + String get cmdRemoveImbueMonsterDeck => '移除注魔'; + + @override + String get cmdChangeName => '更改角色名稱'; + + @override + String get cmdAddNoteRow => '新增備註列'; + + @override + String get cmdSetNoteRowText => '編輯備註'; + + @override + String get cmdSetNoteRowColor => '更改備註顏色'; + + @override + String get cmdLinkNoteRow => '連結備註列'; + + @override + String get cmdRemoveNoteRow => '移除備註列'; + + @override + String get cmdAddBless => '新增祝福'; + + @override + String get cmdRemoveBless => '移除祝福'; + + @override + String get cmdAddCurse => '新增詛咒'; + + @override + String get cmdRemoveCurse => '移除詛咒'; + + @override + String get cmdAddEmpower => '新增強化'; + + @override + String get cmdRemoveEmpower => '移除強化'; + + @override + String get cmdAddEnfeeble => '新增削弱'; + + @override + String get cmdRemoveEnfeeble => '移除削弱'; + + @override + String cmdIncreaseMaxHealth(String owner) { + return '增加 $owner 最大生命值'; + } + + @override + String cmdDecreaseMaxHealth(String owner) { + return '減少 $owner 最大生命值'; + } + + @override + String get cmdChangeStat => '修改屬性'; + + @override + String cmdIncreaseXp(String figure, int amount) { + return '增加 $figure 經驗值 $amount'; + } + + @override + String cmdDecreaseXp(String figure, int amount) { + return '減少 $figure 經驗值 $amount'; + } + + @override + String get cmdClearUnlockedClasses => '清除已解鎖職業'; + + @override + String cmdDonateSanctuary(String character) { + return '$character 向聖所捐贈'; + } + + @override + String cmdRemoveSanctuaryDonation(String character) { + return '移除 $character 的捐贈'; + } + + @override + String get cmdDrawExtraAbilityCard => '抽取額外技能卡牌'; + + @override + String get cmdDraw => '抽牌'; + + @override + String get cmdDrawLootCard => '抽取戰利品卡牌'; + + @override + String cmdDrawModifierCard(String name) { + return '抽取 $name 修改卡牌'; + } + + @override + String get cmdRemoveLootEnhancement => '移除戰利品強化'; + + @override + String get cmdAddLootEnhancement => '新增戰利品強化'; + + @override + String get cmdHideAllyDeck => '隱藏盟友牌堆'; + + @override + String get cmdShowAllyDeck => '顯示盟友牌堆'; + + @override + String get cmdIceWraithTurnNormal => '冰幽靈轉為普通'; + + @override + String get cmdIceWraithTurnElite => '冰幽靈轉為精英'; + + @override + String cmdImbueElement(String element) { + return '注魔元素 $element'; + } + + @override + String cmdUseElement(String element) { + return '使用元素 $element'; + } + + @override + String cmdLoadCharacter(String name) { + return '載入已儲存角色:$name'; + } + + @override + String cmdLoadGame(String name) { + return '載入已儲存遊戲:$name'; + } + + @override + String get cmdNextRound => '下一回合'; + + @override + String get cmdRemoveAmdCard => '移除AMD卡牌'; + + @override + String cmdRemoveCard(String deck, int nr) { + return '移除 $deck $nr 號卡牌'; + } + + @override + String get cmdRemoveAllCharacters => '移除所有角色'; + + @override + String cmdRemoveCharacter(String id) { + return '移除 $id'; + } + + @override + String get cmdRemoveAllMonsters => '移除所有怪物'; + + @override + String cmdRemoveMonster(String name) { + return '移除 $name'; + } + + @override + String get cmdReorderAbilityCards => '重新排列技能卡牌'; + + @override + String get cmdReorderList => '重新排列清單'; + + @override + String get cmdReorderModifierCards => '重新排列修改卡牌'; + + @override + String get cmdReturnLootCard => '歸還戰利品卡牌'; + + @override + String get cmdReturnModifierCard => '將修改卡牌歸還到頂部'; + + @override + String get cmdReturnRemovedAmdCard => '歸還已移除AMD卡牌'; + + @override + String get cmdNoAllyDeckInOgGloom => '原版Gloomhaven無盟友牌堆'; + + @override + String get cmdUseAllyDeckInOgGloom => '在原版Gloomhaven中使用盟友牌堆'; + + @override + String cmdMarkAsSummon(String owner) { + return '將 $owner 標記為召喚物'; + } + + @override + String cmdRemoveSummonMark(String owner) { + return '移除 $owner 的召喚標記'; + } + + @override + String get cmdAutoLevelOn => '啟用自動等級更新'; + + @override + String get cmdAutoLevelOff => '停用自動等級更新'; + + @override + String cmdSetCampaign(String campaign) { + return '設定戰役 $campaign'; + } + + @override + String cmdSetCharacterLevel(String character) { + return '設定 $character 等級'; + } + + @override + String cmdSetDifficulty(String difficulty) { + return '設定難度為 $difficulty'; + } + + @override + String cmdSetInitiative(String character) { + return '設定 $character 先攻'; + } + + @override + String cmdSetCharacterNote(String character) { + return '為 $character 設定備註'; + } + + @override + String get characterNoteTitle => '備註'; + + @override + String get characterNoteHint => '新增備註…'; + + @override + String get characterNoteQuickAdd => '快速備註'; + + @override + String cmdSetMonsterLevel(String monster) { + return '設定 $monster 等級'; + } + + @override + String get cmdSetLootOwner => '設定戰利品所有者'; + + @override + String get cmdSetScenario => '設定場景'; + + @override + String get cmdSetSoloOn => '啟用單人等級推薦'; + + @override + String get cmdSetSoloOff => '停用單人等級推薦'; + + @override + String get cmdExtraAbilityShuffle => '額外洗技能牌堆'; + + @override + String get cmdExtraAmdShuffle => '額外洗AMD牌堆'; + + @override + String get cmdDrawnAbilityShuffle => '洗已抽技能牌堆'; + + @override + String get cmdDontTrackStandees => '不追蹤立牌'; + + @override + String get cmdTrackStandees => '追蹤立牌'; + + @override + String cmdTurnDone(String id) { + return '$id 回合結束'; + } + + @override + String cmdAddPerk(String character, int index) { + return '新增 \'$character\' 的第 $index 個特權'; + } + + @override + String cmdRemovePerk(String character, int index) { + return '移除 \'$character\' 的第 $index 個特權'; + } + + @override + String cmdUnlock(String id) { + return '解鎖 $id'; + } + + @override + String cmdLock(String id) { + return '鎖定 $id'; + } + + @override + String get cmdSetLevel => '設定等級'; + + @override + String get cmdAddSection => '新增章節'; + + @override + String cmdAddStandee(String name, int nr) { + return '新增 $name $nr'; + } + + @override + String get cmdDrawMonsterModifierCard => '抽取怪物修改卡牌'; + + @override + String cmdIncreaseHealth(String figure, int amount) { + return '增加 $figure 生命值 $amount'; + } + + @override + String cmdKill(String owner) { + return '消滅 $owner'; + } + + @override + String cmdDecreaseHealth(String owner, int amount) { + return '減少 $owner 生命值 $amount'; + } + + @override + String cmdUseFhPerks(String character) { + return '$character 使用Frosthaven特權'; + } + + @override + String cmdDontUseFhPerks(String character) { + return '$character 不使用Frosthaven特權'; + } + + @override + String get cmdRemoveNoCharacters => '未移除任何角色'; + + @override + String get cmdRemoveNoMonsters => '未移除任何怪物'; +} diff --git a/server/lib/core/line_builder/line_builder.dart b/server/lib/core/line_builder/line_builder.dart new file mode 100644 index 0000000..52883da --- /dev/null +++ b/server/lib/core/line_builder/line_builder.dart @@ -0,0 +1,63 @@ +/// Port of the pure-logic parts of the reference app's ability-line builder. +/// +/// The reference `LineBuilder` also builds Flutter widgets to render ability +/// lines (`createLines`, font metrics, shimmer animation). That rendering is +/// re-implemented by the web client in Phase 4 — only the token table and +/// element detection are kept here, along with the `debugColors` flag that +/// the ported game logic references. +class LineBuilder { + static const bool debugColors = false; + + static const Map<String, String> tokens = { + "attack": "Attack", + "move": "Move", + "teleport": "Teleport", + "range": "Range", + "heal": "Heal", + "target": "Target", + "shield": "Shield", + "loot": "Loot", + "retaliate": "Retaliate", + "jump": "Jump", + "stun": "STUN", + "wound": "WOUND", + "disarm": "DISARM", + "immobilize": "IMMOBILIZE", + "poison": "POISON", + "invisible": "INVISIBLE", + "strengthen": "STRENGTHEN", + "muddle": "MUDDLE", + "regenerate": "REGENERATE", + "ward": "WARD", + "impair": "IMPAIR", + "bane": "BANE", + "brittle": "BRITTLE", + "chill": "CHILL", + "infect": "INFECT", + "rupture": "RUPTURE", + "push": "PUSH", + "pull": "PULL", + "pierce": "PIERCE", + "curse": "CURSE", + "enfeeble": "ENFEEBLE", + "empower": "EMPOWER", + "bless": "BLESS", + "safeguard": "SAFEGUARD", + "flip": "ROLLING", + "damage": "damage", + "and": "and", + }; + + static bool isElement(String item) { + if (item.contains("air") || + item.contains("earth") || + item.contains("fire") || + item.contains("ice") || + item.contains("dark") || + item.contains("light") || + item == "any") { + return true; + } + return false; + } +} diff --git a/server/lib/core/line_builder/stat_applier.dart b/server/lib/core/line_builder/stat_applier.dart new file mode 100644 index 0000000..436e7ef --- /dev/null +++ b/server/lib/core/line_builder/stat_applier.dart @@ -0,0 +1,387 @@ +import 'package:collection/collection.dart'; + +import '../enums.dart'; +import '../models/monster.dart'; +import '../settings.dart'; +import '../stat_calculator.dart'; +import '../state/game_state.dart'; +import 'package:x_haven_server/core/service_locator.dart'; + +class StatApplier { + static const int _kLookback2 = 2; + static const int _kMinFormulaLength = 1; + static const int _kMinFormulaLengthLong = 2; + static const int _kTokenEndOffset = 2; + static const int _kRangeZero = 0; + static const int _kResultFloor = 0; + static List<String> applyMonsterStats( + final String lineInput, + String sizeToken, + Monster monster, + bool forceShowAll, [ + Settings? settings, + ]) { + bool showElite = false; + final noStandees = (settings ?? getIt<Settings>()).noStandees; + if ((noStandees && monster.isActive) || + monster.monsterInstances.firstWhereOrNull( + (element) => element.type == MonsterType.elite, + ) != + null) { + showElite = true; + } + bool showNormal = false; + if ((noStandees && monster.isActive) || + monster.monsterInstances.firstWhereOrNull( + (element) => element.type != MonsterType.elite, + ) != + null) { + showNormal = true; + } + if (forceShowAll) { + showElite = true; + showNormal = true; + } + String line = lineInput; + List<String> retVal = []; + + //get the data + final normalTokens = _getStatTokens(monster, false); + final eliteTokens = _getStatTokens(monster, true); + + RegExp regExpNumbers = RegExp(r'^[\d ()xCL/*+-]+$'); + //first pass fix values only + String lastToken = + ""; //turn this into move or attack or whatever, then apply correct monster stat + bool isInToken = false; + int tokenStartIndex = 0; + for (int i = 0; i < line.length; i++) { + if (line[i] == "%") { + if (!isInToken) { + isInToken = true; + tokenStartIndex = i + 1; + } else { + isInToken = false; + lastToken = line.substring(tokenStartIndex, i); + } + } + if (!isInToken && + (line[i] == '+' || + line[i] == '-' || + line[i] == 'C' || + line[i] == 'L') || + line[i] == + 'X' || //hax: X doesn't work in formula, but if a formula starts wit X it should bork. Hopefully there are no wild 'X's anywhere. + (line[i].contains(regExpNumbers) && + lastToken + .isEmpty) //plain numbers cant be calculated for tokens (e.g. attack 1 is not same as attack +1) + && + (i == 0 || + line[i - 1] == + ' ') //supposing there is always a leading whitespace to any formula + ) { + String formula = line[i]; + int startIndex = i; + int endIndex = i; + + for (int j = i + 1; j < lineInput.length; j++) { + String val = lineInput[j]; + if (val.contains(regExpNumbers) || val == "d") { + if (val != ' ') formula += val; + endIndex = j; + } else { + i = j; //skip ahead + if (lineInput[i - 1] == ' ') { + i = j - 1; //restore any skipped whitespace + endIndex = endIndex - 1; + } + //hack for when a formula is followed by " (..." + if (i > 0 && lineInput[i - 1] == '(') { + i = j - 1; //restore any skipped ( + endIndex = endIndex - 1; + formula = formula.substring(0, formula.length - 1); + if (i > _kMinFormulaLength && lineInput[i - _kLookback2] == ' ') { + i = j - 1; //restore any skipped whitespace + endIndex = endIndex - 1; + } + } + break; + } + } + if (formula.length > _kMinFormulaLength && lastToken.isNotEmpty || + formula.length > _kMinFormulaLengthLong) { + //this disallows a single digit or C,L. single C or L could be part of regular text + //for a formula to work (outside of plain C or L) it must either be modifying a token value or be 3+ chars long + + if (lastToken.isNotEmpty) { + retVal = _applyStatForToken( + formula, + line, + sizeToken, + startIndex, + endIndex, + monster, + showNormal, + showElite, + lastToken, + normalTokens, + eliteTokens, + ); + lastToken = ""; + if (retVal.isNotEmpty) { + return retVal; + } + } else { + int? result = StatCalculator.calculateFormula(formula); + if (result != null) { + if (result < 0) { + //just some nicety. probably never applies + result = 0; + } + line = line.replaceRange( + startIndex, + endIndex + 1, + result.toString(), + ); + } + } + } + } + } + + return [line]; + } + + static Map<String, int> _getStatTokens(Monster monster, bool isElite) { + final map = <String, int>{}; + MonsterStatsModel data; + final level = monster.type.levels[monster.level]; + final boss = level.boss; + final elite = level.elite; + final normal = level.normal; + if (boss != null) { + //is boss + if (isElite) { + return map; + } + data = boss; + } else { + final effectiveData = isElite ? elite : normal; + if (effectiveData == null) return map; + data = effectiveData; + } + for (String item in data.attributes) { + //remove size modifiers (only used for immobilize since it's so long it overflows.) + String sizeMod = (item.substring(0, 1)); + if (sizeMod == "^" || sizeMod == "*" && item.length > 1) { + item = item.substring(1); + } + if (item.substring(0, 1) == "%") { + //expects token to be first in line. is this ok? + //parse item and then parse number; + for (int i = 1; i < item.length; i++) { + if (item[i] == '%') { + String token = item.substring(1, i); + int number = 0; + if (i != item.length - 1) { + for (int j = i + _kTokenEndOffset; j < item.length; j++) { + if (item[j] == ' ' || j == item.length - 1) { + //need to find end of nr and ignore the rest + String nr = item.substring(i + 1, j + 1); + int? res = StatCalculator.calculateFormula(nr); + if (res != null) { + number = res; + } else { + // ignore: avoid_print + print( + "failed calculation for formula: $nr" + "for token: $token", + ); + } + break; + } + } + } + + if (token == "target" && number == 0) { + //target needs a nr + continue; + } + map[token] = number; + break; //only one token added per line + } + } + } + } + return map; + } + + static List<String> _applyStatForToken( + String formula, + String line, + String sizeModifier, + int startIndex, + int endIndex, + Monster monster, + bool showNormal, + bool showElite, + String lastToken, + Map<String, int> normalTokens, + Map<String, int> eliteTokens, + ) { + if (!showElite && !showNormal) { + return [line]; + } + + List<String> retVal = []; + List<String> tokens = []; + List<String> eTokens = []; + int normalValue = 0; + int eliteValue = 0; + bool skipCalculation = false; //in case un-calculable + final level = monster.type.levels[monster.level]; + MonsterStatsModel? normal = level.boss ?? level.normal; + MonsterStatsModel? elite = level.elite; + if (lastToken == "attack") { + if (normal == null) return []; + int? calc = StatCalculator.calculateFormula(normal.attack); + if (calc != null) { + normalValue = calc; + } else { + skipCalculation = true; + } + if (elite != null) { + calc = StatCalculator.calculateFormula(elite.attack); + if (calc != null) { + eliteValue = calc; + } + } + + RegExp regEx = RegExp( + r"(?=.*[a-z])", + ); //not sure why I do this. only letters? + for (final item in normalTokens.keys) { + if (regEx.hasMatch(item)) { + if (item != "shield" && + item != "retaliate" && + item != "range" && + item != "heal" && + item != "jump") { + tokens.add("%$item%"); + } + } + } + for (final item in eliteTokens.keys) { + if (regEx.hasMatch(item)) { + if (item != "shield" && + item != "retaliate" && + item != "range" && + item != "heal" && + item != "jump") { + eTokens.add("%$item%"); + } + } + } + } else if (lastToken == "range") { + if (normal?.range != _kRangeZero) { + normalValue = normal?.range ?? 0; + if (elite != null) { + eliteValue = elite.range; + } + } + } else if (lastToken == "move") { + normalValue = + StatCalculator.calculateFormula(normal?.move ?? StatValue.zero) ?? 0; + if (elite != null) { + eliteValue = StatCalculator.calculateFormula(elite.move) ?? 0; + } + } else if (lastToken == "shield") { + int? value = normalTokens["shield"]; + int? eValue = eliteTokens["shield"]; + if (elite != null && eValue != null) { + eliteValue = eValue; + } + if (normal != null && value != null) { + normalValue = value; + } + } else if (lastToken == "retaliate") { + int? value = normalTokens["retaliate"]; + int? eValue = eliteTokens["retaliate"]; + if (elite != null && eValue != null) { + eliteValue = eValue; + } + if (normal != null && value != null) { + normalValue = value; + } + } + + String normalResult = formula; + if (!skipCalculation) { + int? res = StatCalculator.calculateFormula("$formula+$normalValue"); + + if (res != null && res < 0) { + res = 0; //needed for blood tumor: has 0 move and a -1 move card + } + if (res == null) { + skipCalculation = true; + } else { + normalResult = res.toString(); + } + } + + String newStartOfLine = line.substring(0, startIndex); + if (showNormal) { + newStartOfLine += normalResult; + if (!skipCalculation) { + for (final item in tokens) { + newStartOfLine += "|$item"; + //add nr if applicable + String key = item.substring(1, item.length - 1); + int value = normalTokens[key] ?? 0; + if (value > 0) { + newStartOfLine += "$value"; + } + } + } + } + + //special case for incalculable and only elites (heed the pigs) + if (elite != null && skipCalculation && showElite && !showNormal) { + newStartOfLine += normalResult; + } + + if (elite != null && !skipCalculation && showElite) { + if (showNormal) { + newStartOfLine += "/"; + } + retVal.add(newStartOfLine); + + int eliteResult = + StatCalculator.calculateFormula("$formula+$eliteValue") ?? 0; + if (eliteResult < _kResultFloor) { + eliteResult = _kResultFloor; + } + String eliteString = "!$sizeModifier£$eliteResult"; + for (final item in eTokens) { + eliteString += "|$item"; + + //add nr if applicable + String key = item.substring(1, item.length - 1); + int value = eliteTokens[key]!; + if (value > 0) { + eliteString += "$value"; + } + } + retVal.add(eliteString); + } else { + retVal.add(newStartOfLine); + } + if (endIndex < line.length) { + String leftOver = + "!$sizeModifier${line.substring(endIndex + 1, line.length)}"; + + retVal.add(leftOver); + } + return retVal; + } +} diff --git a/server/lib/core/methods/character_methods.dart b/server/lib/core/methods/character_methods.dart new file mode 100644 index 0000000..9c2705a --- /dev/null +++ b/server/lib/core/methods/character_methods.dart @@ -0,0 +1,393 @@ +part of '../state/game_state.dart'; + +// ignore_for_file: library_private_types_in_public_api + +class CharacterMethods { + static const int _kHailPerkIndex = 17; + static const int _kPainConduitPerkIndex = 16; + static const int _kPainConduitHealthBonus = 5; + static const int _kObjectiveInitiative = 99; + // Special summon base stats + static const int _kBeastHealth = 8; + static const int _kBeastMultiplier = 2; + static const int _kDomeHealth = 3; + static const int _kGlacierHealth = 7; + static const int _kJesterHealth = 5; + static const int _kSpecialSummonMove = 3; + static const int _kSpecialSummonAttack = 2; + static const int _kSpecialSummonRange = 0; + static const int _kSpecialSummonStandeeNr = 0; + static const int _kSpecialSummonInitiative = -1; + + static void addPerk( + _StateModifier s, + Character character, + int index, { + GameState? gameState, + }) { + final gs = gameState ?? getIt<GameState>(); + final deck = character.characterState.modifierDeck; + final perksFH = character.characterClass.perksFH; + final useFHPerks = + character.characterState.useFHPerks && perksFH.isNotEmpty; + final perks = useFHPerks ? perksFH : character.characterClass.perks; + final perk = perks[index]; + for (final item in perk.remove) { + final amount = deck.drawPileSize; + deck.removeCard(s, item); + if (deck.drawPileSize == amount) { + //must be a perk card + + //find missing card from perk list + + for (int i = 0; i < perks.length; i++) { + //check if other perk added the card previously + final adds = perks[i].add; + if (adds.contains(item)) { + //remove that perk card + String second = ""; + if (adds.first != adds.last && item == adds.last) { + second = "-2"; //in case perk adds 2 different cards + } + deck.removeCard(s, "P$i$second"); + if (deck.drawPileSize != amount) { + //found and removed + break; + } + } + } + } + } + for (final item in perk.add) { + CardType type = CardType.add; + if (item.endsWith("/ns2")) { + //nightshroud hack + type = CardType.multiply; + } + final id = GameMethods.perkGfxIdToCardId(item, perk, index); + deck.addCard(s, id, type); + } + + final className = character.characterClass.name; + if (index == _kHailPerkIndex && className == "Hail") { + gs.modifierDeck.addHailSpecial(s); + } + if (index == _kPainConduitPerkIndex && className == "Pain Conduit") { + final level = character.characterState.level; + final healthByLevel = character.characterClass.healthByLevel; + if (level >= 1 && level <= healthByLevel.length) { + character.characterState._health = + healthByLevel[level - 1] + _kPainConduitHealthBonus; + character.characterState.setMaxHealth( + s, + character.characterState._health, + ); + } + } + } + + static void removePerk( + _StateModifier s, + Character character, + int index, { + GameState? gameState, + }) { + final gs = gameState ?? getIt<GameState>(); + final deck = character.characterState.modifierDeck; + final perksFH = character.characterClass.perksFH; + final useFHPerks = + character.characterState.useFHPerks && perksFH.isNotEmpty; + final perks = useFHPerks ? perksFH : character.characterClass.perks; + final perk = perks[index]; + for (final item in perk.remove) { + if (item.startsWith("perks/")) { + //find id of perk: bull: could be several... + for (int i = 0; i < perks.length; i++) { + if (character.characterState.perkList[i] && + perks[i].add.contains(item)) { + final id = GameMethods.perkGfxIdToCardId(item, perks[i], i); + deck.addCard(s, id, CardType.add); + break; + } + } + } else { + deck.addCard(s, item, CardType.add); + } + } + for (final item in perk.add) { + final id = GameMethods.perkGfxIdToCardId(item, perk, index); + deck.removeCard(s, id); + } + + final className = character.characterClass.name; + if (index == _kHailPerkIndex && className == "Hail") { + gs.modifierDeck.removeHailSpecial(s); + } + if (index == _kPainConduitPerkIndex && className == "Pain Conduit") { + final state = character.characterState; + final characterClass = character.characterClass; + final level = state.level; + if (level >= 1 && level <= characterClass.healthByLevel.length) { + final int health = characterClass.healthByLevel[level - 1]; + state.setMaxHealth(s, health); + state.setHealth(s, health); + } + } + } + + static void setCharacterLevel( + _StateModifier s, + int level, + String characterId, { + GameState? gameState, + }) { + final gs = gameState ?? getIt<GameState>(); + Character? character; + for (final item in gs.currentList) { + if (item.id == characterId && item is Character) { + character = item; + break; + } + } + if (character != null) { + final healthByLevel = character.characterClass.healthByLevel; + if (healthByLevel.length < level) { + level = healthByLevel.length; + } + character.characterState.setFigureLevel(s, level); + character.characterState.setHealth(s, healthByLevel[level - 1]); + + if (character.id == "Pain Conduit" && + character.characterState.perkList[_kPainConduitPerkIndex]) { + character.characterState.setHealth( + s, + healthByLevel[level - 1] + _kPainConduitHealthBonus, + ); + } + + character.characterState.setMaxHealth(s, character.characterState.health); + + //handle special summons + int health = 0; + int multiplier = 1; + String name = ""; + if (character.id == "Beast Tyrant" || character.id == "Wildfury") { + //create the bear summon + health = _kBeastHealth; + multiplier = _kBeastMultiplier; + name = "Beast"; + } + if (character.id == "D.O.M.E.") { + health = _kDomeHealth; + name = "Barrier"; + } + if (character.id == "Glacial Torrent") { + health = _kGlacierHealth; + name = "Glacier"; + } + if (character.id == "Jester Twins") { + //create the barrier as a summon + health = _kJesterHealth; + name = "Jester Twin"; + } + + final list = character.characterState.summonList; + if (list.isNotEmpty && list.first.name == name) { + int hp = health + character.characterState.level * multiplier; + list.first.setMaxHealth(s, hp); + list.first.setHealth(s, hp); + } + } + + ScenarioMethods.applyDifficulty(s); + } + + static void resetCharacter(_StateModifier s, Character item) { + item.characterState._initiative = 0; + final level = item.characterState.level; + item.characterState._health = item.characterClass.healthByLevel[level - 1]; + + if (item.characterClass.name == "Pain Conduit") { + if (item.characterState.perkList[_kPainConduitPerkIndex]) { + item.characterState._health += _kPainConduitHealthBonus; + } + } + + item.characterState._maxHealth = item.characterState.health; + item.characterState._xp = 0; + item.characterState._conditions.clear(); + item.characterState._chill = 0; + item.characterState._plague = 0; + item.characterState.modifierDeck._initDeck(); + //reapply perks + final perksSetList = item.characterState.perkList; + final perks = item.characterState.useFHPerks + ? item.characterClass.perksFH + : item.characterClass.perks; + for (int i = 0; i < perks.length; i++) { + if (perksSetList[i]) { + addPerk(s, item, i); + } + } + //handle special summons + final summonList = item.characterState._summonList; + summonList.clear(); + int health = 0; + int multiplier = 1; + String gfx = ""; + String name = ""; + if (item.id == "Beast Tyrant" || item.id == "Wildfury") { + //create the bear summon + health = _kBeastHealth; + multiplier = _kBeastMultiplier; + gfx = item.id == "Beast Tyrant" ? "beast" : "Beast v2"; + name = "Beast"; + } + if (item.id == "D.O.M.E.") { + health = _kDomeHealth; + gfx = "DOM barrier"; + name = "Barrier"; + } + if (item.id == "Glacial Torrent") { + health = _kGlacierHealth; + gfx = "GLA glacier"; + name = "Glacier"; + } + if (item.id == "Jester Twins") { + //create the barrier as a summon + health = _kJesterHealth; + gfx = "JES twin"; + name = "Jester Twin"; + } + + if (name.isNotEmpty) { + MonsterInstance summon = MonsterInstance.summon( + _kSpecialSummonStandeeNr, + MonsterType.summon, + name, + health + level * multiplier, + _kSpecialSummonMove, + _kSpecialSummonAttack, + _kSpecialSummonRange, + gfx, + _kSpecialSummonInitiative, + ); + summonList.add(summon); + } + item.characterState._notifySummonList(); + } + + static void removeCharacters( + _StateModifier s, + List<Character> characters, { + GameState? gameState, + }) { + List<ListItemData> newList = []; + final gs = gameState ?? getIt<GameState>(); + for (final item in gs.currentList) { + if (item is Character) { + bool remove = false; + for (final name in characters) { + if (item.characterState.display == name.characterState.display) { + remove = true; + break; + } + } + if (!remove) { + newList.add(item); + } + } else { + newList.add(item); + } + } + gs._currentList = newList; + RoundMethods.updateForSpecialRules(s); + gs._notifyCurrentList(); + } + + static Character? createCharacter( + _StateModifier _, + String id, + String? edition, + String? display, + int level, { + GameData? gameData, + }) { + Character? character; + List<CharacterClass> characters = []; + final gd = gameData ?? getIt<GameData>(); + final modelData = gd.modelData; + for (String key in modelData.keys) { + characters.addAll(modelData[key]?.characters ?? []); + } + for (CharacterClass characterClass in characters) { + if (characterClass.id == id && + (edition == null || edition == characterClass.edition)) { + final characterState = CharacterState(id); + characterState._level = level; + + if (GameMethods.isObjectiveOrEscort(characterClass)) { + characterState._initiative = _kObjectiveInitiative; + } + characterState._health = characterClass.healthByLevel[level - 1]; + characterState._maxHealth = characterState.health; + + if (display != null) { + characterState._display = display; + } else { + characterState._display = characterClass.name; + } + character = Character(characterState, characterClass); + + //handle special summons + final summonList = character.characterState._summonList; + summonList.clear(); + int health = 0; + int multiplier = 1; + String gfx = ""; + String name = ""; + if (character.id == "Beast Tyrant" || character.id == "Wildfury") { + //create the bear summon + health = _kBeastHealth; + multiplier = _kBeastMultiplier; + gfx = character.id == "Beast Tyrant" ? "beast" : "Beast v2"; + name = "Beast"; + } + if (character.id == "D.O.M.E.") { + health = _kDomeHealth; + gfx = "DOM barrier"; + name = "Barrier"; + } + if (character.id == "Glacial Torrent") { + health = _kGlacierHealth; + gfx = "GLA glacier"; + name = "Glacier"; + } + if (character.id == "Jester Twins") { + //create the barrier as a summon + health = _kJesterHealth; + gfx = "JES twin"; + name = "Jester Twin"; + } + + if (name.isNotEmpty) { + MonsterInstance summon = MonsterInstance.summon( + _kSpecialSummonStandeeNr, + MonsterType.summon, + name, + health + level * multiplier, + _kSpecialSummonMove, + _kSpecialSummonAttack, + _kSpecialSummonRange, + gfx, + _kSpecialSummonInitiative, + ); + summonList.add(summon); + } + + break; + } + } + return character; + } +} diff --git a/server/lib/core/methods/deck_methods.dart b/server/lib/core/methods/deck_methods.dart new file mode 100644 index 0000000..535324f --- /dev/null +++ b/server/lib/core/methods/deck_methods.dart @@ -0,0 +1,79 @@ +part of '../state/game_state.dart'; + +// ignore_for_file: library_private_types_in_public_api + +class DeckMethods { + static void drawAbilityCardFromInactiveDeck( + _StateModifier stateModifier, { + GameState? gameState, + }) { + final gs = gameState ?? getIt<GameState>(); + for (MonsterAbilityState deck in gs.currentAbilityDecks) { + for (final item in gs.currentList) { + if (item is Monster) { + if (item.type.deck == deck.name) { + if (item.isActive && + !GameMethods.isInactiveForRule(item.type.name)) { + if (deck.lastRoundDrawn != gs.totalRounds) { + //do not draw new card in case drawn already this round + deck.draw(stateModifier); + break; + } + } + } + } + } + } + } + + static void drawAbilityCards( + _StateModifier stateModifier, { + GameState? gameState, + }) { + final gs = gameState ?? getIt<GameState>(); + for (MonsterAbilityState deck in gs.currentAbilityDecks) { + for (final item in gs.currentList) { + if (item is Monster) { + if (item.type.deck == deck.name) { + bool specialInactive = GameMethods.isInactiveForRule( + item.type.name, + ); + if ((item.monsterInstances.isNotEmpty && !specialInactive) || + (item.isActive && !specialInactive)) { + deck.draw(stateModifier); + //only draw once from each deck + break; + } + } + } + } + } + } + + static void shuffleDecksIfNeeded(_StateModifier _, {GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + for (final deck in gs.currentAbilityDecks) { + if (deck.discardPileIsNotEmpty && deck.discardPileTop.shuffle || + deck.drawPileIsEmpty) { + deck._shuffle(); + } + } + } + + static void shuffleDecks(_StateModifier _, {GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + for (final deck in gs.currentAbilityDecks) { + deck._shuffle(); + } + } + + static void returnModifierCard( + _StateModifier s, + String name, { + GameState? gameState, + }) { + final gs = gameState ?? getIt<GameState>(); + final deck = GameMethods.getModifierDeck(name, gs); + deck.returnCardToDrawPile(s); + } +} diff --git a/server/lib/core/methods/element_methods.dart b/server/lib/core/methods/element_methods.dart new file mode 100644 index 0000000..5da97a3 --- /dev/null +++ b/server/lib/core/methods/element_methods.dart @@ -0,0 +1,59 @@ +part of '../state/game_state.dart'; + +// ignore_for_file: library_private_types_in_public_api + +class ElementMethods { + static void resetElements(_StateModifier _, {GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + for (final key in gs.elementState.keys) { + gs._elementState[key] = ElementState.inert; + } + } + + static void updateElements(_StateModifier _, {GameState? gameState}) { + //elementalist special: + bool elementalistPerk = false; + Character? elementalist = GameMethods.getCharacterByName("Elementalist"); + if (elementalist != null && elementalist.characterState.perkList[15]) { + if (elementalist.characterClass.edition == "Gloomhaven 2nd Edition") { + elementalistPerk = true; + } + } + + final gs = gameState ?? getIt<GameState>(); + for (final key in gs.elementState.keys) { + if (gs.elementState[key] == ElementState.full) { + if (!elementalistPerk || + key == Elements.light || + key == Elements.dark) { + gs._elementState[key] = ElementState.half; + } + } else if (gs.elementState[key] == ElementState.half) { + if (!elementalistPerk || + key == Elements.light || + key == Elements.dark) { + gs._elementState[key] = ElementState.inert; + } + } + } + } + + static void imbueElement( + _StateModifier _, + Elements element, + bool half, { + GameState? gameState, + }) { + final gs = gameState ?? getIt<GameState>(); + gs._elementState[element] = half ? ElementState.half : ElementState.full; + } + + static void useElement( + _StateModifier _, + Elements element, { + GameState? gameState, + }) { + final gs = gameState ?? getIt<GameState>(); + gs._elementState[element] = ElementState.inert; + } +} diff --git a/server/lib/core/methods/game_util_methods.dart b/server/lib/core/methods/game_util_methods.dart new file mode 100644 index 0000000..8c2220e --- /dev/null +++ b/server/lib/core/methods/game_util_methods.dart @@ -0,0 +1,11 @@ +part of '../state/game_state.dart'; + +// ignore_for_file: library_private_types_in_public_api + +class GameUtilMethods { + //note: while this changes the game state, it is a state used also by non game related instances. + static void setToastMessage(String message, {GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + gs._toastMessage = message; + } +} diff --git a/server/lib/core/methods/monster_methods.dart b/server/lib/core/methods/monster_methods.dart new file mode 100644 index 0000000..c0743b3 --- /dev/null +++ b/server/lib/core/methods/monster_methods.dart @@ -0,0 +1,403 @@ +part of '../state/game_state.dart'; + +// ignore_for_file: library_private_types_in_public_api + +class MonsterMethods { + static const int _kMinLevel = 0; + static const int _kMaxLevel = 7; + static const int _kMinCharacters = 2; + static const int _kMaxCharacters = 4; + static const int _kCharIndexOffset = 2; + static const int _kTrailingCommaLength = 2; + + static void showAllyDeck(_StateModifier _, {GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + gs._showAllyDeck = true; + } + + static void hideAllyDeck(_StateModifier _, {GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + gs._showAllyDeck = false; + } + + static Monster? createMonster( + _StateModifier _, + String name, + int? level, + bool isAlly, { + GameState? gameState, + GameData? gameData, + }) { + final gd = gameData ?? getIt<GameData>(); + Map<String, MonsterModel> monsters = {}; + final modelData = gd.modelData; + for (String key in modelData.keys) { + monsters.addAll(modelData[key]?.monsters ?? {}); + } + level ??= (gameState ?? getIt<GameState>()).level; + return Monster(name, level, isAlly); + } + + static void removeMonsters( + _StateModifier _, + List<Monster> items, { + GameState? gameState, + }) { + List<String> deckIds = []; + List<ListItemData> newList = []; + final gs = gameState ?? getIt<GameState>(); + for (final item in gs.currentList) { + if (item is Monster) { + bool remove = false; + for (final name in items) { + if (item.id == name.id) { + remove = true; + deckIds.add(item.type.deck); + } + } + if (!remove) { + newList.add(item); + } + } else { + newList.add(item); + } + } + + gs._currentList = newList; + + for (final deck in deckIds) { + bool removeDeck = true; + for (final item in gs.currentList) { + if (item is Monster) { + if (item.type.deck == deck) { + removeDeck = false; + } + } + } + + if (removeDeck) { + for (final item in gs.currentAbilityDecks) { + if (item.name == deck) { + gs._currentAbilityDecks.remove(item); + break; + } + } + } + } + + gs._notifyCurrentList(); + } + + static void executeAddStandee( + _StateModifier s, + final int nr, + final SummonData? summon, + final MonsterType type, + final String ownerId, + final bool addAsSummon, { + GameState? gameState, + }) { + final gs = gameState ?? getIt<GameState>(); + MonsterInstance instance; + Monster? monster; + if (summon == null) { + for (final item in gs.currentList) { + if (item.id == ownerId && item is Monster) { + monster = item; + monster._isActive = true; + break; + } + } + if (monster == null) return; + instance = MonsterInstance(nr, type, addAsSummon, monster); + } else { + instance = MonsterInstance.summon( + summon.standeeNr, + type, + summon.name, + summon.health, + summon.move, + summon.attack, + summon.range, + summon.gfx, + gs.round, + ); + } + + List<MonsterInstance> monsterList = []; + Character? character; + //find list + if (monster != null) { + monsterList = monster._monsterInstances; + } else { + for (final item in gs.currentList) { + if (item.id == ownerId) { + character = item as Character; + monsterList = character.characterState._summonList; + break; + } + } + } + + //make sure summons can not have same gfx and nr: + if (instance.standeeNr != 0 && summon != null) { + bool ok = false; + while (!ok) { + ok = true; + for (final item in monsterList) { + if (item.standeeNr == instance.standeeNr) { + if (item.gfx == instance.gfx) { + //can not have same gfx and nr + instance = MonsterInstance.summon( + instance.standeeNr + 1, + type, + summon.name, + summon.health, + summon.move, + summon.attack, + summon.range, + summon.gfx, + gs.round, + ); + ok = false; + } + } + } + } + } + + monsterList.add(instance); + if (monster != null) { + RoundMethods.sortMonsterInstances(s, monsterList); + monster._notifyMonsterInstances(); + } else { + character?.characterState._notifySummonList(); + } + if (monsterList.length == 1 && monster != null) { + //first added + final roundState = gs.roundState; + if (roundState == RoundState.chooseInitiative) { + RoundMethods.sortCharactersFirst(s); + } else if (roundState == RoundState.playTurns) { + DeckMethods.drawAbilityCardFromInactiveDeck(s); + RoundMethods.sortItemToPlace( + s, + monster.id, + GameMethods.getInitiative(monster), + ); //need to only sort this one item to place + } + } + } + + static void addStandee( + int? nr, + Monster data, + MonsterType type, + bool addAsSummon, { + GameState? gameState, + }) { + final gs = gameState ?? getIt<GameState>(); + if (nr != null) { + gs.action( + AddStandeeCommand(nr, null, data.id, type, addAsSummon, gameState: gs), + ); + } else { + //add first un added nr + for (int i = 1; i <= data.type.count; i++) { + bool added = false; + for (final item in data.monsterInstances) { + if (item.standeeNr == i) { + added = true; + break; + } + } + if (!added) { + gs.action( + AddStandeeCommand( + i, + null, + data.id, + type, + addAsSummon, + gameState: gs, + ), + ); + return; + } + } + } + } + + static void addMonster( + _StateModifier s, + String monster, + List<SpecialRule> specialRules, { + GameState? gameState, + }) { + int levelAdjust = 0; + Set<String> alliedMonsters = {}; + for (final rule in specialRules) { + if (rule.name == monster || rule.name == "Enemies") { + if (rule.type == "LevelAdjust") { + levelAdjust = rule.level; + } + } + if (rule.type == "Allies") { + for (String item in rule.list.cast<String>()) { + alliedMonsters.add(item); + } + } + } + + final gs = gameState ?? getIt<GameState>(); + bool add = true; + for (final item in gs.currentList) { + //don't add duplicates + if (item.id == monster) { + add = false; + break; + } + } + if (add) { + bool isAlly = false; + if (alliedMonsters.contains(monster)) { + isAlly = true; + } + + final munster = createMonster( + s, + monster, + (gs.level + levelAdjust).clamp(_kMinLevel, _kMaxLevel), + isAlly, + ); + if (munster != null) { + gs._currentList.add(munster); + } + } + } + + static String autoAddStandees( + _StateModifier stateModifier, + List<RoomMonsterData> roomMonsterData, + String initMessage, { + GameState? gameState, + Settings? settings, + }) { + final gs = gameState ?? getIt<GameState>(); + //handle room data + int characterIndex = + GameMethods.getCurrentCharacterAmount().clamp( + _kMinCharacters, + _kMaxCharacters, + ) - + _kCharIndexOffset; + for (int i = 0; i < roomMonsterData.length; i++) { + final roomMonsters = roomMonsterData[i]; + addMonster(stateModifier, roomMonsters.name, gs._scenarioSpecialRules); + } + bool addSorted = gs.currentCampaign == "Buttons and Bugs"; + final s = settings ?? getIt<Settings>(); + if (!s.noStandees && s.autoAddStandees) { + if (s.randomStandees || addSorted) { + if (initMessage.isNotEmpty && !addSorted) { + initMessage += "\n"; + } + for (int i = 0; i < roomMonsterData.length; i++) { + List<int> normals = []; + List<int> elites = []; + final roomMonsters = roomMonsterData[i]; + Monster data = + gs.currentList.firstWhereOrNull( + (element) => element.id == roomMonsters.name, + ) + as Monster; + + int eliteAmount = roomMonsters.elite[characterIndex]; + int normalAmount = roomMonsters.normal[characterIndex]; + + bool isBoss = false; + if (data.type.levels.first.boss != null) { + isBoss = true; + } + + for (int i = 0; i < eliteAmount; i++) { + int randomNr = GameMethods.getRandomStandee(data); + if (randomNr != 0) { + elites.add(randomNr); + executeAddStandee( + stateModifier, + randomNr, + null, + MonsterType.elite, + data.id, + false, + ); + } + } + + for (int i = 0; i < normalAmount; i++) { + int randomNr = GameMethods.getRandomStandee(data); + if (addSorted) { + randomNr = GameMethods.getNextAvailableBnBStandee(data); + } + if (randomNr != 0) { + normals.add(randomNr); + executeAddStandee( + stateModifier, + randomNr, + null, + isBoss ? MonsterType.boss : MonsterType.normal, + data.id, + false, + ); + } + } + + if (!addSorted && (elites.isNotEmpty || normals.isNotEmpty)) { + elites.sort(); + normals.sort(); + if (i != 0) { + initMessage += "\n"; + } + initMessage += "${data.type.display} added - "; + + if (elites.isNotEmpty) { + initMessage += "Elite: "; + for (int i = 0; i < elites.length; i++) { + initMessage += "${elites[i]}, "; + if (i == elites.length - 1) { + initMessage = initMessage.substring( + 0, + initMessage.length - _kTrailingCommaLength, + ); + } + } + } + if (normals.isNotEmpty) { + if (!isBoss) { + if (elites.isNotEmpty) { + initMessage += ", "; + } + initMessage += "Normal: "; + } + for (int i = 0; i < normals.length; i++) { + initMessage += "${normals[i]}, "; + if (i == normals.length - 1) { + initMessage = initMessage.substring( + 0, + initMessage.length - _kTrailingCommaLength, + ); + } + } + } + } + } + } else { + if (roomMonsterData.isNotEmpty) { + gs.pendingAutoAddDialog = roomMonsterData; + } + } + } + return initMessage; + } +} diff --git a/server/lib/core/methods/round_methods.dart b/server/lib/core/methods/round_methods.dart new file mode 100644 index 0000000..4ad146d --- /dev/null +++ b/server/lib/core/methods/round_methods.dart @@ -0,0 +1,493 @@ +part of '../state/game_state.dart'; + +// ignore_for_file: library_private_types_in_public_api + +class RoundMethods { + static const int _kMaxLevel = 7; + static const int _kMinLevel = 0; + static void setRoundState( + _StateModifier _, + RoundState state, { + GameState? gameState, + }) { + final gs = gameState ?? getIt<GameState>(); + gs._roundState = state; + } + + static void setRound(_StateModifier _, int round, {GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + gs._round = round; + gs._totalRounds++; + } + + static void resetRound( + _StateModifier _, + int round, + bool resetTotal, { + GameState? gameState, + }) { + final gs = gameState ?? getIt<GameState>(); + gs._round = round; + if (resetTotal) { + gs._totalRounds = round; + } + } + + static void sortCharactersFirst(_StateModifier _, {GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + gs._currentList.sort(_compareForCharactersFirst); + // Sorting compares note rows as initiative 0, scattering them; re-glue any + // linked notes back under their target. Callers that notify via + // updateList.notify() (e.g. DrawCommand) bypass _notifyCurrentList, so the + // reflow must happen here rather than only in _notifyCurrentList. + gs._reflowNoteRows(); + } + + static int _compareForCharactersFirst(ListItemData a, ListItemData b) { + final deadResult = _compareDeadCharacters(a, b); + if (deadResult != null) return deadResult; + + final aIsChar = a is Character; + final bIsChar = b is Character; + if (aIsChar && bIsChar) return 0; + if (bIsChar) return 1; + if (aIsChar) return -1; + + // both are monsters — inactive at bottom + if (a is Monster && b is Monster) { + if (a.isActive && !b.isActive) return -1; + if (!a.isActive && b.isActive) return 1; + } + return -1; + } + + // Returns a sort result if either figure is a dead character (dead go last), + // or null if neither is dead and the caller should continue comparing. + static int? _compareDeadCharacters(ListItemData a, ListItemData b) { + final aIsDead = a is Character && a.characterState.health == 0; + final bIsDead = b is Character && b.characterState.health == 0; + if (!aIsDead && bIsDead) return -1; + if (aIsDead && !bIsDead) return 1; + if (aIsDead) return -1; // both dead characters + return null; + } + + static void sortItemToPlace( + _StateModifier _, + String id, + int initiative, { + GameState? gameState, + }) { + final gs = gameState ?? getIt<GameState>(); + final newList = gs.currentList.toList(); + ListItemData? item; + int currentTurnItemIndex = 0; + for (int i = 0; i < newList.length; i++) { + if (newList[i].turnState == TurnsState.current) { + currentTurnItemIndex = i; + } + if (newList[i].id == id) { + item = newList.removeAt(i); + } + } + if (item == null) { + return; + } + + int init = 0; + for (int i = 0; i < newList.length; i++) { + ListItemData currentItem = newList[i]; + int currentItemInitiative = GameMethods.getInitiative(currentItem); + if (currentItemInitiative > initiative && currentItemInitiative > init) { + if (i > currentTurnItemIndex) { + newList.insert(i, item); + gs._currentList = newList; + gs._notifyCurrentList(); + return; + } else { + //in case initiative is earlier than current turn, ignore anything current turn, and earlier and place later + int insertIndex = currentTurnItemIndex + 1; + for (int j = currentTurnItemIndex + 1; j < newList.length; j++) { + if (GameMethods.getInitiative(newList[j]) >= initiative) { + insertIndex = j; + break; + } + } + if (insertIndex > newList.length) { + newList.add(item); + } else { + newList.insert(insertIndex, item); + } + + gs._currentList = newList; + gs._notifyCurrentList(); + return; + } + } + init = + currentItemInitiative; //this check is for the case user has moved items around the order may be off + } + + newList.add(item); + gs._currentList = newList; + gs._notifyCurrentList(); + } + + static void sortByInitiative(_StateModifier _, {GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + gs._currentList.sort((a, b) { + final deadResult = _compareDeadCharacters(a, b); + if (deadResult != null) return deadResult; + + int aInitiative = 0; + int bInitiative = 0; + if (a is Character) { + aInitiative = a.characterState.initiative; + } else if (a is Monster) { + if (!a.isActive) { + if (b is Monster && !b.isActive) { + return -1; + } + return 1; //inactive at bottom + } + + //find the deck + for (final item in gs.currentAbilityDecks) { + if (item.name == a.type.deck && item.discardPileIsNotEmpty) { + aInitiative = item.discardPileTop.initiative; + } + } + } + if (b is Character) { + bInitiative = b.characterState.initiative; + } else if (b is Monster) { + if (!b.isActive) { + if (a is Monster && !a.isActive) { + return 1; + } + return -1; //inactive at bottom + } + //find the deck + for (final item in gs.currentAbilityDecks) { + if (item.name == b.type.deck && item.discardPileIsNotEmpty) { + bInitiative = item.discardPileTop.initiative; + } + } + } + return aInitiative.compareTo(bInitiative); + }); + // Re-glue linked note rows after the initiative sort (see sortCharactersFirst). + gs._reflowNoteRows(); + } + + static void sortMonsterInstances( + _StateModifier _, + List<MonsterInstance> instances, + ) { + instances.sort((a, b) { + if (a.type == MonsterType.elite && b.type != MonsterType.elite) { + return -1; + } + if (b.type == MonsterType.elite && a.type != MonsterType.elite) { + return 1; + } + return a.standeeNr.compareTo(b.standeeNr); + }); + } + + static void addToMainList( + _StateModifier _, + int? index, + ListItemData item, { + GameState? gameState, + }) { + final gs = gameState ?? getIt<GameState>(); + final newList = gs.currentList.toList(); + if (index != null) { + newList.insert(index, item); + } else { + newList.add(item); + } + gs._currentList = newList; + gs._notifyCurrentList(); + } + + static void reorderMainList( + _StateModifier _, + int newIndex, + int oldIndex, { + GameState? gameState, + }) { + final gs = gameState ?? getIt<GameState>(); + gs._currentList.insert(newIndex, gs._currentList.removeAt(oldIndex)); + gs._notifyCurrentList(); + } + + static void removeFromMainList( + _StateModifier _, + String id, { + GameState? gameState, + }) { + final gs = gameState ?? getIt<GameState>(); + gs._currentList = gs._currentList.where((item) => item.id != id).toList(); + gs._notifyCurrentList(); + } + + /// Deletes any note rows tied to a specific standee ([standeeNr] > 0) of the + /// monster [linkedId] — called when that standee is defeated so its note goes + /// with it. Notes for the whole group (standeeNr 0) are left alone. + static void removeNoteRowsForStandee( + _StateModifier _, + String linkedId, + int standeeNr, { + GameState? gameState, + }) { + if (standeeNr <= 0) return; + final gs = gameState ?? getIt<GameState>(); + final filtered = gs._currentList + .where( + (item) => + !(item is NoteRow && + item.linkedId == linkedId && + item.standeeNr == standeeNr), + ) + .toList(); + if (filtered.length != gs._currentList.length) { + gs._currentList = filtered; + gs._notifyCurrentList(); + } + } + + static void updateForSpecialRules( + _StateModifier _, { + GameState? gameState, + GameData? gameData, + }) { + final gs = gameState ?? getIt<GameState>(); + final gd = gameData ?? getIt<GameData>(); + List<SpecialRule>? rules = + gd.modelData[gs.currentCampaign]?.scenarios[gs.scenario]?.specialRules; + if (rules != null) { + for (SpecialRule rule in rules) { + if (rule.type == "Objective" || rule.type == "Escort") { + Character? character = + gs.currentList.firstWhereOrNull( + (element) => element.id == rule.name, + ) + as Character?; + if (character != null) { + int? newHealth = StatCalculator.calculateFormula( + rule.health.toString(), + ); + if (newHealth != character.characterState.maxHealth && + newHealth != null) { + character.characterState._maxHealth = newHealth; + character.characterState._health = newHealth; + } + } + } else if (rule.type == "LevelAdjust") { + Monster? monster = + gs.currentList.firstWhereOrNull( + (element) => element.id == rule.name, + ) + as Monster?; + if (monster != null) { + if (gs.level == monster.level) { + int newLevel = (monster.level + rule.level).clamp( + _kMinLevel, + _kMaxLevel, + ); + monster._level = newLevel; + for (MonsterInstance instance in monster._monsterInstances) { + instance._setLevel(monster); + } + } + } + } + } + } + } + + static void clearTurnStateConditions( + _StateModifier _, + FigureState figure, + bool clearLastTurnToo, + ) { + if (!clearLastTurnToo) { + figure._conditionsAddedPreviousTurn.clear(); + figure._conditionsAddedPreviousTurn.addAll( + figure.conditionsAddedThisTurn.toSet(), + ); + } else { + figure._conditionsAddedPreviousTurn.clear(); + } + + figure._conditionsAddedThisTurn.clear(); + + figure._chill = figure.conditions.where((a) => a == Condition.chill).length; + } + + static void clearTurnState( + _StateModifier stateModifier, + bool clearLastTurnToo, { + GameState? gameState, + }) { + final gs = gameState ?? getIt<GameState>(); + for (final item in gs._currentList) { + item._turnState = TurnsState.notDone; + if (item is Character) { + clearTurnStateConditions( + stateModifier, + item.characterState, + clearLastTurnToo, + ); + for (final instance in item.characterState._summonList) { + clearTurnStateConditions(stateModifier, instance, clearLastTurnToo); + } + } else if (item is Monster) { + for (final instance in item._monsterInstances) { + clearTurnStateConditions(stateModifier, instance, clearLastTurnToo); + } + } + } + } + + static void removeExpiringConditions( + _StateModifier _, + FigureState figure, { + Settings? settings, + }) { + if ((settings ?? getIt<Settings>()).expireConditions) { + final conditions = figure._conditions; + + //handle chill separately + int nrOfChills = figure.conditions + .where((a) => a == Condition.chill) + .length; + if (nrOfChills > 0) { + //remove one if not added this turn + if (!figure.conditionsAddedThisTurn.contains(Condition.chill) || + nrOfChills > + 1 //this is a cop out: you can add more than one chill in a round, but since we store only if a condition has been added this turn, and not the amount, we have no way to tell + ) { + conditions.remove(Condition.chill); + figure._conditionsAddedPreviousTurn.add(Condition.chill); + } + } + + figure._chill = figure.conditions + .where((a) => a == Condition.chill) + .length; + + for (int i = conditions.length - 1; i >= 0; i--) { + Condition item = conditions[i]; + if (GameMethods.canExpire(item)) { + if (item != Condition.chill) { + if (!figure.conditionsAddedThisTurn.contains(item)) { + conditions.removeAt(i); + figure._conditionsAddedPreviousTurn.add(item); + } + } + } + } + } + } + + static void removeExpiringConditionsFromListItem( + _StateModifier s, + ListItemData item, + ) { + if (item is Character) { + removeExpiringConditions(s, item.characterState); + for (final summon in item.characterState._summonList) { + removeExpiringConditions(s, summon); + } + } else if (item is Monster) { + for (final instance in item._monsterInstances) { + removeExpiringConditions(s, instance); + } + } + } + + static void reapplyConditions(_StateModifier _, FigureState figure) { + for (final condition in figure.conditionsAddedPreviousTurn) { + final conditions = figure._conditions; + if (!conditions.contains(condition) || condition == Condition.chill) { + conditions.add(condition); + figure._conditionsAddedThisTurn.remove(condition); + } + if (condition == Condition.chill) { + figure._chill = figure.conditions + .where((a) => a == Condition.chill) + .length; + } + } + } + + static void reapplyConditionsFromListItem( + _StateModifier s, + ListItemData item, + ) { + if (item is Character) { + reapplyConditions(s, item.characterState); + for (final summon in item.characterState.summonList) { + reapplyConditions(s, summon); + } + } else if (item is Monster) { + for (final instance in item._monsterInstances) { + reapplyConditions(s, instance); + } + } + } + + //1 if item WAS done OR not done, then set it to current, all before to done, and all after to not done + //2 if item was current: set item to done, all before to done, next to current and rest to not done + static void setTurnDone(_StateModifier s, int index, {GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + //set all before to done. + for (int i = 0; i < index; i++) { + if (gs.currentList[i].turnState != TurnsState.done) { + gs.currentList[i]._turnState = TurnsState.done; + removeExpiringConditionsFromListItem(s, gs.currentList[i]); + } + } + //if on index is NOT current then set to current else set to done + int newIndex = index + 1; + if (gs.currentList[index].turnState == TurnsState.current) { + gs.currentList[index]._turnState = TurnsState.done; + removeExpiringConditionsFromListItem(s, gs.currentList[index]); + //remove expiring conditions + } else { + newIndex = index; + } + + //get next active item and set to current + for (; newIndex < gs.currentList.length; newIndex++) { + ListItemData data = gs.currentList[newIndex]; + if (data is Monster) { + if (data.isActive && !GameMethods.isInactiveForRule(data.type.name)) { + if (data.turnState == TurnsState.done) { + reapplyConditionsFromListItem(s, data); + } + data._turnState = TurnsState.current; + break; + } + } else if (data is Character) { + if (data.characterState.health > 0) { + if (data.turnState == TurnsState.done) { + reapplyConditionsFromListItem(s, data); + } + data._turnState = TurnsState.current; + break; + } + } + } + //set rest to not done + for (int i = newIndex + 1; i < gs.currentList.length; i++) { + if (gs.currentList[i].turnState == TurnsState.done) { + reapplyConditionsFromListItem(s, gs.currentList[i]); + } + gs.currentList[i]._turnState = TurnsState.notDone; + } + } +} diff --git a/server/lib/core/methods/scenario_methods.dart b/server/lib/core/methods/scenario_methods.dart new file mode 100644 index 0000000..257d076 --- /dev/null +++ b/server/lib/core/methods/scenario_methods.dart @@ -0,0 +1,530 @@ +part of '../state/game_state.dart'; + +// ignore_for_file: library_private_types_in_public_api + +class ScenarioMethods { + static const int _kMinLevel = 0; + static const int _kMaxLevel = 7; + static const int _kRound1 = 1; + static const int _kTimerAlways = -1; + static const int _kRandomSectionCount = 3; + + static void setCampaign( + _StateModifier _, + String campaign, { + GameState? gameState, + }) { + final gs = gameState ?? getIt<GameState>(); + gs._currentCampaign = campaign; + } + + static void setSolo(_StateModifier _, bool solo, {GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + gs._solo = solo; + } + + static void unlockClass( + _StateModifier _, + String name, { + GameState? gameState, + }) { + final gs = gameState ?? getIt<GameState>(); + gs._unlockedClasses.add(name); + gs._unlockedClassesVersion++; + } + + static void clearUnlockedClasses(_StateModifier _, {GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + gs._unlockedClasses = {}; + gs._unlockedClassesVersion++; + } + + static void clearUnlockedClass( + _StateModifier _, + String id, { + GameState? gameState, + }) { + final gs = gameState ?? getIt<GameState>(); + gs._unlockedClasses.remove(id); + gs._unlockedClassesVersion++; + } + + static void setLevel( + _StateModifier s, + int level, + String? monsterId, { + GameState? gameState, + }) { + assert(level >= _kMinLevel && level <= _kMaxLevel); + final gs = gameState ?? getIt<GameState>(); + if (monsterId == null) { + gs._level = level; + for (final item in gs.currentList) { + if (item is Monster) { + item.setLevel(s, level); + } + } + RoundMethods.updateForSpecialRules(s); + } else { + Monster? monster; + for (final item in gs.currentList) { + if (item.id == monsterId) { + monster = item as Monster; + } + } + monster?.setLevel(s, level); + } + } + + static void applyDifficulty(_StateModifier s, {GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + if (gs.autoScenarioLevel) { + int newLevel = GameMethods.getRecommendedLevel() + gs.difficulty; + if (newLevel > _kMaxLevel) { + newLevel = _kMaxLevel; + } + setLevel(s, newLevel, null); + } + } + + static void _resetForNewScenario( + _StateModifier s, + String scenario, + GameState gs, + GameData gd, + ) { + RoundMethods.resetRound(s, 1, true); + gs._showAllyDeck = false; + gs._currentAbilityDecks.clear(); + gs._scenarioSpecialRules.clear(); + applyDifficulty(s); + + gs.modifierDeck._initDeck(); + gs.modifierDeckAllies._initDeck(); + gs._sanctuaryDeck._initDeck(); + + RoundMethods.setRoundState(s, RoundState.chooseInitiative); + gs._scenario = scenario; + gs._scenarioSectionsAdded = []; + + List<ListItemData> newList = []; + for (final item in gs.currentList) { + if (item is Character) { + if (!GameMethods.isObjectiveOrEscort(item.characterClass)) { + CharacterMethods.resetCharacter(s, item); + newList.add(item); + } + } + } + gs._currentList = newList; + + _initLootDeck(scenario, gs, gd); + + RoundMethods.clearTurnState(s, true); + gs._toastMessage = ""; + } + + static void _initLootDeck(String scenario, GameState gs, GameData gd) { + if (scenario != "custom") { + final campaignModel = gd.modelData[gs.currentCampaign]; + LootDeckModel? lootDeckModel = + campaignModel?.scenarios[scenario]?.lootDeck; + lootDeckModel != null + ? gs._lootDeck = LootDeck(lootDeckModel, gs.lootDeck) + : gs._lootDeck = LootDeck.from(gs.lootDeck); + } else { + if (gs.currentCampaign == "Frosthaven") { + LootDeckModel? lootDeckModel = const LootDeckModel( + 2, + 2, + 2, + 12, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + ); + gs._lootDeck = LootDeck(lootDeckModel, gs.lootDeck); + } else { + gs._lootDeck = LootDeck.from(gs.lootDeck); + } + } + } + + static ({ + List<String> monsters, + List<SpecialRule> specialRules, + List<RoomMonsterData> roomMonsterData, + List<String> subSections, + String initMessage, + }) + _loadData( + bool section, + String scenario, + GameState gs, + GameData gd, + Settings? settings, + ) { + List<String> monsters = []; + List<SpecialRule> specialRules = []; + List<RoomMonsterData> roomMonsterData = []; + List<String> subSections = []; + String initMessage = ""; + + if (section) { + final sectionData = gd + .modelData[gs.currentCampaign] + ?.scenarios[gs.scenario] + ?.sections + .firstWhereOrNull((element) => element.name == scenario); + if (sectionData != null) { + monsters = sectionData.monsters; + specialRules = sectionData.specialRules.toList(); + initMessage = sectionData.initMessage; + final monsterStandees = sectionData.monsterStandees; + roomMonsterData = monsterStandees != null + ? monsterStandees.toList() + : []; + } + } else { + if ((settings ?? getIt<Settings>()).showBattleGoalReminder && + gs.currentCampaign != "Buttons and Bugs") { + initMessage += "Remember to choose your Battle Goals."; + } + if (scenario != "custom") { + final scenarioData = + gd.modelData[gs.currentCampaign]?.scenarios[scenario]; + if (scenarioData != null) { + monsters = scenarioData.monsters; + specialRules = scenarioData.specialRules.toList(); + initMessage += + initMessage.isNotEmpty && scenarioData.initMessage.isNotEmpty + ? "\n\n${scenarioData.initMessage}" + : scenarioData.initMessage; + final monsterStandees = scenarioData.monsterStandees; + roomMonsterData = monsterStandees != null + ? monsterStandees.toList() + : []; + for (final item in scenarioData.sections) { + subSections.add(item.name); + } + } + } + } + + return ( + monsters: monsters, + specialRules: specialRules, + roomMonsterData: roomMonsterData, + subSections: subSections, + initMessage: initMessage, + ); + } + + // Returns false if setScenario should abort early (banner spear solo edge case). + static bool _applyBannerSpearHack(String scenario, GameState gs) { + if (!scenario.contains("Scouting Ambush")) return true; + final deck = gs.currentAbilityDecks.firstWhereOrNull( + (element) => element.name.contains("Scout"), + ); + if (deck == null) return false; + final drawPileList = deck._drawPile.getList(); + for (int i = 0; i < drawPileList.length; i++) { + if (drawPileList[i].title == "Rancid Arrow") { + deck._drawPile.add(deck._drawPile.removeAt(i)); + break; + } + } + return true; + } + + static String _processSpecialRules( + _StateModifier s, + List<SpecialRule> specialRules, + bool section, + GameState gs, + String initMessage, + Settings? settings, + ) { + for (final item in specialRules) { + if (item.type == "AllyDeck") { + gs._showAllyDeck = true; + } + if (item.type == "Objective") { + if (item.condition == "" || + StatCalculator.evaluateCondition(item.condition as Object)) { + Character? objective = CharacterMethods.createCharacter( + s, + "Objective", + null, + item.name, + gs.level + 1, + ); + final health = StatCalculator.calculateFormula( + item.health.toString(), + ); + if (health != null) { + objective?.characterState._maxHealth = health; + } + objective?.characterState._health = + objective.characterState.maxHealth; + objective?.characterState._initiative = item.init; + bool add = true; + for (final item2 in gs.currentList) { + if (item2 is Character && + (item2).characterState.display == item.name) { + add = false; + break; + } + } + if (add && objective != null) { + gs._currentList.add(objective); + } + } + } + if (item.type == "Escort") { + if (item.condition == "" || + StatCalculator.evaluateCondition(item.condition as Object)) { + final objective = CharacterMethods.createCharacter( + s, + "Escort", + null, + item.name, + gs.level + 1, + ); + if (objective != null) { + final maxHealth = StatCalculator.calculateFormula( + item.health.toString(), + ); + if (maxHealth != null) { + objective.characterState._maxHealth = maxHealth; + } + objective.characterState._health = + objective.characterState.maxHealth; + objective.characterState._initiative = item.init; + bool add = true; + for (final item2 in gs.currentList) { + if (item2 is Character && + (item2).characterState.display == item.name) { + add = false; + break; + } + } + if (add) { + gs._currentList.add(objective); + } + } + } + } + if (!section && item.type == "Timer" && item.startOfRound) { + for (int round in item.list.cast<int>()) { + if (round == _kRound1 || round == _kTimerAlways) { + initMessage += initMessage.isNotEmpty + ? "\n\n${item.note}" + : item.note; + } + } + } + if (item.type == "ResetRound") { + RoundMethods.resetRound(s, 1, false); + } + if (item.type == "Unlock") { + unlockClass(s, item.name); + initMessage += item.note; + } + } + return initMessage; + } + + static List<RoomMonsterData> _applyRound1Spawns( + List<RoomMonsterData> roomMonsterData, + List<SpecialRule> specialRules, + String scenario, + GameState gs, + GameData gd, + Settings? settings, + ) { + for (final rule in specialRules) { + if (rule.type != "Timer" || !rule.startOfRound) continue; + for (final round in rule.list.cast<int>()) { + if (round != _kRound1 && round != _kTimerAlways) continue; + if (!(settings ?? getIt<Settings>()).autoAddSpawns) continue; + if (rule.name.isEmpty) continue; + + final scenarioModel = + gd.modelData[gs.currentCampaign]?.scenarios[scenario]; + if (scenarioModel == null) continue; + + final spawnSection = scenarioModel.sections.firstWhereOrNull( + (element) => element.name.substring(1) == rule.name, + ); + final spawnStandees = spawnSection?.monsterStandees; + if (spawnStandees == null) continue; + + for (final spawnItem in spawnStandees) { + final existing = roomMonsterData.firstWhereOrNull( + (element) => element.name == spawnItem.name, + ); + if (existing != null) { + final merged = RoomMonsterData( + existing.name, + [ + existing.normal.first + spawnItem.normal.first, + existing.normal[1] + spawnItem.normal[1], + existing.normal[2] + spawnItem.normal[2], + ], + [ + existing.elite.first + spawnItem.elite.first, + existing.elite[1] + spawnItem.elite[1], + existing.elite[2] + spawnItem.elite[2], + ], + ); + for (int i = 0; i < roomMonsterData.length; i++) { + if (roomMonsterData[i].name == existing.name) { + roomMonsterData[i] = merged; + break; + } + } + } else { + roomMonsterData.add(spawnItem); + } + } + } + } + return roomMonsterData; + } + + static void _updateScenarioRules( + _StateModifier s, + bool section, + String scenario, + List<SpecialRule> specialRules, + List<String> subSections, + GameState gs, + ) { + if (!section) { + gs._scenarioSpecialRules = specialRules; + ElementMethods.resetElements(s); + RoundMethods.sortCharactersFirst(s); + } else { + if (specialRules.firstWhereOrNull( + (element) => element.type == "ResetRound", + ) != + null) { + gs._scenarioSpecialRules.removeWhere( + (oldItem) => oldItem.type == "Timer", + ); + } + for (final item in specialRules) { + if (item.type == "Timer") { + gs._scenarioSpecialRules.removeWhere((oldItem) { + if (oldItem.type == "Timer" && + item.startOfRound == oldItem.startOfRound) { + if (item.list.contains(-1) || oldItem.list.contains(-1)) { + return true; + } + final set2 = oldItem.list.toSet(); + return item.list.any(set2.contains); + } + return false; + }); + } + } + gs._scenarioSpecialRules.addAll(specialRules); + gs._scenarioSectionsAdded.add(scenario); + } + gs._scenarioSectionsVersion++; + + final randomRule = specialRules.firstWhereOrNull( + (element) => element.type == "RandomSections", + ); + if (randomRule != null) { + subSections.shuffle(); + final newRule = SpecialRule( + "RandomSections", + "", + 0, + 0, + 0, + "", + subSections.sublist(0, _kRandomSectionCount), + false, + "", + ); + specialRules.remove(randomRule); + specialRules.add(newRule); + } + } + + static void setScenario( + _StateModifier s, + String scenario, + bool section, { + GameState? gameState, + GameData? gameData, + Settings? settings, + }) { + final gs = gameState ?? getIt<GameState>(); + final gd = gameData ?? getIt<GameData>(); + + if (!section) { + _resetForNewScenario(s, scenario, gs, gd); + } + + final data = _loadData(section, scenario, gs, gd, settings); + + for (final monster in data.monsters) { + MonsterMethods.addMonster(s, monster, data.specialRules); + } + if (!section) { + DeckMethods.shuffleDecks(s); + } + + if (!_applyBannerSpearHack(scenario, gs)) return; + + final initMessage = _processSpecialRules( + s, + data.specialRules, + section, + gs, + data.initMessage, + settings, + ); + + final roomMonsterData = _applyRound1Spawns( + data.roomMonsterData, + data.specialRules, + scenario, + gs, + gd, + settings, + ); + + final finalInitMessage = MonsterMethods.autoAddStandees( + s, + roomMonsterData, + initMessage, + ); + + _updateScenarioRules( + s, + section, + scenario, + data.specialRules, + data.subSections, + gs, + ); + + gs._notifyCurrentList(); + + if (finalInitMessage.isNotEmpty && + (settings ?? getIt<Settings>()).showReminders) { + gs._toastMessage += finalInitMessage; + } else { + gs._toastMessage = ""; + } + } +} diff --git a/server/lib/core/models/campaign.dart b/server/lib/core/models/campaign.dart new file mode 100644 index 0000000..0a393d3 --- /dev/null +++ b/server/lib/core/models/campaign.dart @@ -0,0 +1,72 @@ +import 'dart:collection'; +import 'dart:core'; + +import 'package:collection/collection.dart'; +import 'package:x_haven_server/core/models/character_class.dart'; +import 'package:x_haven_server/core/models/monster.dart'; +import 'package:x_haven_server/core/models/monster_ability.dart'; +import 'package:x_haven_server/core/models/room.dart'; +import 'package:x_haven_server/core/models/scenario.dart'; + +class CampaignModel { + // ignore: prefer-match-file-name, file name reflects campaign data domain + const CampaignModel({ + required this.edition, + required this.monsterAbilities, + required this.monsters, + required this.characters, + required this.scenarios, + }); + final String edition; + final List<MonsterAbilityDeckModel> monsterAbilities; + final Map<String, MonsterModel> monsters; + final List<CharacterClass> characters; + final Map<String, ScenarioModel> scenarios; + + factory CampaignModel.fromJson( + Map<String, dynamic> data, + List<RoomsModel> roomsData, + ) { + // note the explicit cast to String + // this is required if robust lint rules are enabled + final edition = data['edition'] as String; + final monsterAbilities = (data['monsterAbilities'] as List<Object?>) + .cast<Map<String, dynamic>>(); + List<MonsterAbilityDeckModel> deckDataList = []; + for (final item in monsterAbilities) { + deckDataList.add(MonsterAbilityDeckModel.fromJson(item, edition)); + } + + Map<String, MonsterModel> monsterMap = HashMap(); + final monsters = data['monsters'] as Map<dynamic, dynamic>; + for (String key in monsters.keys) { + monsterMap[key] = MonsterModel.fromJson(monsters[key], key, edition); + } + + List<CharacterClass> characterDataList = []; + final classes = (data['classes'] as List<Object?>) + .cast<Map<String, dynamic>>(); + for (final item in classes) { + characterDataList.add(CharacterClass.fromJson(item)); + } + + Map<String, ScenarioModel> scenarioMap = HashMap(); + final scenarios = data['scenarios'] as Map<dynamic, dynamic>; + for (String key in scenarios.keys) { + //find right room if exists + + RoomsModel? rooms = roomsData.firstWhereOrNull( + (element) => element.scenarioName == key.substring(1).split(" ").first, + ); + scenarioMap[key] = ScenarioModel.fromJson(key, scenarios[key], rooms); + } + + return CampaignModel( + edition: edition, + monsterAbilities: deckDataList, + monsters: monsterMap, + characters: characterDataList, + scenarios: scenarioMap, + ); + } +} diff --git a/server/lib/core/models/character_class.dart b/server/lib/core/models/character_class.dart new file mode 100644 index 0000000..12f4285 --- /dev/null +++ b/server/lib/core/models/character_class.dart @@ -0,0 +1,128 @@ +import 'package:x_haven_server/core/models/color.dart'; +import 'package:x_haven_server/core/models/summon_model.dart'; + +class CharacterClass { + final String id; + final String name; + final String edition; + final List<int> healthByLevel; + final Color color; + final Color colorSecondary; + final bool hidden; + final List<SummonModel> summons; + final List<PerkModel> perks; + final List<PerkModel> perksFH; + + const CharacterClass( + this.id, + this.name, + this.healthByLevel, + this.edition, + this.color, + this.colorSecondary, + this.hidden, + this.summons, + this.perks, + this.perksFH, + ); + + factory CharacterClass.fromJson(Map<String, dynamic> data) { + final edition = data['edition'] as String; + final name = data['name'] as String; + String id = name; //default to name if no id + if (data.containsKey('id')) { + id = data['id'] as String; + } + bool hidden = false; + if (data.containsKey('hidden')) { + hidden = data['hidden'] as bool; + } + //TODO: color array + gradiantType support + final healthByLevel = (data['health'] as List<Object?>).cast<int>(); + int radix = 16; + final colorValue = data['color']; + Color color = (colorValue is List<Object?>) + ? Color(int.parse(colorValue.first as String, radix: radix)) + : Color(int.parse(colorValue as String, radix: radix)); + + Color colorSecondary = color; + if (data.containsKey("colorSecondary")) { + colorSecondary = (data["colorSecondary"] is List<Object?>) + ? colorSecondary = Color( + int.parse(data['colorSecondary'][0], radix: radix), + ) + : Color(int.parse(data['colorSecondary'], radix: radix)); + } + + List<SummonModel> summonList = []; + if (data.containsKey('summons')) { + final summons = data['summons'] as Map<dynamic, dynamic>; + for (String key in summons.keys) { + summonList.add(SummonModel.fromJson(summons[key], key)); + } + } + + List<PerkModel> perkList = []; + if (data.containsKey('perks')) { + final perks = (data['perks'] as List<Object?>) + .cast<Map<String, dynamic>>(); + for (final item in perks) { + perkList.add(PerkModel.fromJson(item)); + } + } + + List<PerkModel> perkFHList = []; + if (data.containsKey('perks_fh')) { + final perks = (data['perks_fh'] as List<Object?>) + .cast<Map<String, dynamic>>(); + for (final item in perks) { + perkFHList.add(PerkModel.fromJson(item)); + } + } + + return CharacterClass( + id, + name, + healthByLevel, + edition, + color, + colorSecondary, + hidden, + summonList, + perkList, + perkFHList, + ); + } +} + +class PerkModel { + final String text; + final List<String> remove; + final List<String> add; + const PerkModel(this.text, this.remove, this.add); + + factory PerkModel.fromJson(Map<String, dynamic> data) { + String text = ""; + if (data.containsKey('text')) { + text = data['text']; + } + + List<String> addList = []; + if (data.containsKey('adds')) { + final adds = (data['adds'] as List<Object?>).cast<String>(); + for (String item in adds) { + addList.add(item); + } + } + + List<String> removeList = []; + if (data.containsKey('removes')) { + final removes = (data['removes'] as List<Object?>).cast<String>(); + for (String item in removes) { + removeList.add(item); + } + } + + return PerkModel(text, removeList, addList); + } +} diff --git a/server/lib/core/models/color.dart b/server/lib/core/models/color.dart new file mode 100644 index 0000000..a4f99de --- /dev/null +++ b/server/lib/core/models/color.dart @@ -0,0 +1,16 @@ +/// Minimal stand-in for Flutter's `Color` used by data models. +/// +/// The reference app parses character colors from JSON as +/// `Color(int.parse(hex, radix: 16))` and only uses them for widget +/// styling. The engine never reads them; the web client renders them in +/// Phase 4. We keep the API shape (`Color(int)`) so the model files port +/// unchanged. +class Color { + const Color(this.value); + + /// ARGB value, as in Flutter's `Color.value`. + final int value; + + @override + String toString() => 'Color(0x${value.toRadixString(16).padLeft(8, '0')})'; +} diff --git a/server/lib/core/models/monster.dart b/server/lib/core/models/monster.dart new file mode 100644 index 0000000..77312cf --- /dev/null +++ b/server/lib/core/models/monster.dart @@ -0,0 +1,207 @@ +/// A monster stat that is either a plain integer or a formula string. +/// +/// Formulas may contain `C` (number of characters) and `L` (scenario level) +/// and are evaluated by [StatCalculator.calculateFormula]. Named formulas such +/// as `"Hollowpact"` or `"Incarnate"` have special handling in [MonsterInstance]. +/// +/// Use [StatValue.fromJson] when parsing JSON — it throws [FormatException] for +/// values that are neither int nor String, catching data errors at load time +/// instead of silently producing wrong results at runtime. +sealed class StatValue { + // ignore: prefer-match-file-name, file contains multiple monster model types + const StatValue(); + + static StatValue fromJson(Object? value) { + if (value is int) return IntStatValue(value); + if (value is String) return FormulaStatValue(value); + throw FormatException( + 'Stat value must be int or String, got ${value?.runtimeType}: $value', + ); + } + + /// Returns a constant representing zero. + static const StatValue zero = IntStatValue(0); +} + +/// A stat whose value is a fixed integer (e.g. `"health": 3`). +final class IntStatValue extends StatValue { + const IntStatValue(this.value); + final int value; + @override + String toString() => value.toString(); +} + +/// A stat whose value is a formula string (e.g. `"health": "C+1"`). +final class FormulaStatValue extends StatValue { + const FormulaStatValue(this.formula); + final String formula; + @override + String toString() => formula; +} + +class MonsterModel { + const MonsterModel( + this.name, + this.display, + this.gfx, + this.hidden, + this.flying, + this.deck, + this.count, + this.levels, + this.edition, + this.capture, + ); + final String name; //id + final String deck; + final String display; //same as name. most of the time + final String gfx; //same as name. most of the time + final bool hidden; + final bool flying; + final int count; + final bool capture; + final String edition; + final List<MonsterLevelModel> levels; + + factory MonsterModel.fromJson( + Map<String, dynamic> data, + String name, + String edition, + ) { + String anEdition = edition; + if (data.containsKey('edition')) { + anEdition = data['edition'] as String; + } + + String display = name; + if (data.containsKey('display')) { + display = data['display'] as String; + } + String gfx = display; + if (data.containsKey('gfx')) { + gfx = data['gfx'] as String; + } + bool hidden = false; + if (data.containsKey('hidden')) { + hidden = data['hidden'] as bool; + } + bool flying = false; + if (data.containsKey('flying')) { + flying = data['flying'] as bool; + } + bool capture = false; + if (data.containsKey('capture')) { + capture = data['capture'] as bool; + } + final deck = data['deck'] as String; + final count = data['count'] as int; + + final levels = (data['levels'] as List<Object?>) + .cast<Map<String, dynamic>>(); + List<MonsterLevelModel> monsterLevelDataList = []; + for (final item in levels) { + monsterLevelDataList.add(MonsterLevelModel.fromJson(item)); + } + return MonsterModel( + name, + display, + gfx, + hidden, + flying, + deck, + count, + monsterLevelDataList, + anEdition, + capture, + ); + } +} + +class MonsterLevelModel { + const MonsterLevelModel(this.level, this.normal, this.elite, this.boss); + final int level; + final MonsterStatsModel? normal; + final MonsterStatsModel? elite; + final MonsterStatsModel? boss; + + factory MonsterLevelModel.fromJson(Map<String, dynamic> data) { + final level = data['level'] as int; + MonsterStatsModel normal; + MonsterStatsModel elite; + if (data.containsKey('normal') && data.containsKey('elite')) { + normal = MonsterStatsModel.fromJson(data['normal']); + elite = MonsterStatsModel.fromJson(data['elite']); + return MonsterLevelModel(level, normal, elite, null); + } else { + return MonsterLevelModel( + level, + null, + null, + MonsterStatsModel.fromJson(data), + ); + } + } +} + +class MonsterStatsModel { + const MonsterStatsModel( + this.health, + this.move, + this.attack, + this.range, + this.attributes, + this.immunities, + this.special1, + this.special2, + ); + final StatValue health; + final StatValue move; + final StatValue attack; + final int range; + final List<String> attributes; + final List<String> immunities; + final List<String> special1; + final List<String> special2; + + factory MonsterStatsModel.fromJson(Map<String, dynamic> data) { + final health = StatValue.fromJson(data['health']); + StatValue move = StatValue.zero; + if (data.containsKey('move')) { + move = StatValue.fromJson(data['move']); + } + StatValue attack = StatValue.zero; + if (data.containsKey('attack')) { + attack = StatValue.fromJson(data['attack']); + } + int range = 0; + if (data.containsKey('range')) { + range = data['range'] as int; + } + List<String> attributes = []; + if (data.containsKey('attributes')) { + attributes = (data['attributes'] as List<Object?>).cast<String>(); + } + List<String> immunities = []; + if (data.containsKey('immunities')) { + immunities = (data['immunities'] as List<Object?>).cast<String>(); + } + List<String> special1 = []; + if (data.containsKey('special1')) { + special1 = (data['special1'] as List<Object?>).cast<String>(); + } + List<String> special2 = []; + if (data.containsKey('special2')) { + special2 = (data['special2'] as List<Object?>).cast<String>(); + } + return MonsterStatsModel( + health, + move, + attack, + range, + attributes, + immunities, + special1, + special2, + ); + } +} diff --git a/server/lib/core/models/monster_ability.dart b/server/lib/core/models/monster_ability.dart new file mode 100644 index 0000000..3a90a52 --- /dev/null +++ b/server/lib/core/models/monster_ability.dart @@ -0,0 +1,113 @@ +const int _kGraphicsIndex = 3; + +class MonsterAbilityDeckModel { + // ignore: prefer-match-file-name, file contains multiple ability model types + final String name; + final String edition; + final List<MonsterAbilityCardModel> cards; + const MonsterAbilityDeckModel(this.name, this.edition, this.cards); + + factory MonsterAbilityDeckModel.fromJson( + Map<String, dynamic> data, + String edition, + ) { + final name = data['name'] as String; + final List<dynamic> dynamicCards = + data['cards'] + as List< + dynamic + >; // ignore: avoid-dynamic, complex JSON cards array requires mutable dynamic list + List<MonsterAbilityCardModel> cards = []; + for (final card in dynamicCards) { + String title = name; + if (card[0] is String) { + title = card[0] as String; + card.removeAt(0); + } + int nr = card[0] as int; + + ///duplication check + if (cards.any((element) => element.nr == nr)) { + print("duplicate monster ability card nr: $nr for $name"); + } + bool shuffle = card[1] as bool; + int initiative = card[2] as int; + List<GraphicPositional> graphicPositionals = []; + if (card[3] is List) { + //handle the graphic extras + List<dynamic> list = + card[3]; // ignore: avoid-dynamic, graphic extras are a dynamic JSON array + + for (final item in list) { + double angle = 0; + double scale = 1; + if (item.containsKey('angle')) { + angle = item['angle']; + } + if (item.containsKey('scale')) { + scale = item['scale']; + } + GraphicPositional pos = GraphicPositional( + item["gfx"], + item["x"], + item["y"], + scale, + angle, + ); + graphicPositionals.add(pos); + } + + card.removeAt(_kGraphicsIndex); + } + List<String> lines = []; + for (int i = _kGraphicsIndex; i < card.length; i++) { + lines.add(card[i] as String); + } + cards.add( + MonsterAbilityCardModel( + title, + nr, + shuffle, + initiative, + lines, + name, + graphicPositionals, + ), + ); + } + return MonsterAbilityDeckModel(name, edition, cards); + } +} + +class GraphicPositional { + final String gfx; + final double x; + final double y; + final double scale; + final double angle; + const GraphicPositional(this.gfx, this.x, this.y, this.scale, this.angle); +} + +class MonsterAbilityCardModel { + final String deck; + final String title; + final int nr; + final bool shuffle; + final int initiative; + final List<String> lines; + final List<GraphicPositional> graphicPositional; + const MonsterAbilityCardModel( + this.title, + this.nr, + this.shuffle, + this.initiative, + this.lines, + this.deck, + this.graphicPositional, + ); + + Map<String, dynamic> toJson() => {'nr': nr, 'deck': deck}; + + @override + String toString() => '{"nr": $nr, "deck": "$deck" }'; +} diff --git a/server/lib/core/models/room.dart b/server/lib/core/models/room.dart new file mode 100644 index 0000000..903dc47 --- /dev/null +++ b/server/lib/core/models/room.dart @@ -0,0 +1,64 @@ +class RoomMonsterData { + // ignore: prefer-match-file-name, file contains multiple room model types + final String name; + final List<int> normal; + final List<int> elite; + const RoomMonsterData(this.name, this.normal, this.elite); + + factory RoomMonsterData.fromJson(Map<String, dynamic> data, String key) { + String name = key; + List<int> normal = data.containsKey('normal') + ? data['normal'].cast<int>() + : [0, 0, 0]; + List<int> elite = data.containsKey('elite') + ? data['elite'].cast<int>() + : [0, 0, 0]; + + return RoomMonsterData(name, normal, elite); + } +} + +class RoomModel { + final String name; + final List<RoomMonsterData> monsterData; + const RoomModel(this.name, this.monsterData); + + factory RoomModel.fromJson(Map<String, dynamic> data) { + String name = data.keys.first; + List<RoomMonsterData> monsterList = []; + data[name].forEach((key, value) { + monsterList.add(RoomMonsterData.fromJson(value, key)); + }); + + return RoomModel(name, monsterList); + } +} + +class RoomsModel { + final String scenarioName; + final List<RoomModel> roomData; + const RoomsModel(this.scenarioName, this.roomData); + + factory RoomsModel.fromJson(List<Object?> sectionData, String scenarioName) { + List<RoomModel> roomList = []; + for (final value in sectionData) { + roomList.add(RoomModel.fromJson(value as Map<String, dynamic>)); + } + + return RoomsModel(scenarioName, roomList); + } +} + +class EditionRoomsModel { + final List<RoomsModel> roomData; + const EditionRoomsModel(this.roomData); + + factory EditionRoomsModel.fromJson(Map<String, dynamic> data) { + List<RoomsModel> roomList = []; + for (final entry in data.entries) { + roomList.add(RoomsModel.fromJson(entry.value, entry.key)); + } + + return EditionRoomsModel(roomList); + } +} diff --git a/server/lib/core/models/scenario.dart b/server/lib/core/models/scenario.dart new file mode 100644 index 0000000..18cd709 --- /dev/null +++ b/server/lib/core/models/scenario.dart @@ -0,0 +1,314 @@ +import 'dart:convert'; + +import 'package:collection/collection.dart'; +import 'package:x_haven_server/core/game_methods.dart'; +import 'package:x_haven_server/core/models/room.dart'; + +class LootDeckModel { + // ignore: prefer-match-file-name, file contains multiple scenario model types + final int lumber; + final int hide; + final int metal; + final int coin; + final int arrowvine; + final int corpsecap; + final int snowthistle; + final int axenut; + final int flamefruit; + final int rockroot; + final int treasure; + const LootDeckModel( + this.lumber, + this.hide, + this.metal, + this.coin, + this.arrowvine, + this.corpsecap, + this.snowthistle, + this.axenut, + this.flamefruit, + this.rockroot, + this.treasure, + ); + + static int _getValueFromJson(Map<String, dynamic> data, String value) { + if (data.containsKey(value)) { + return data[value]; + } + return 0; + } + + factory LootDeckModel.fromJson(Map<String, dynamic> data) { + return LootDeckModel( + _getValueFromJson(data, "lumber"), + _getValueFromJson(data, "hide"), + _getValueFromJson(data, "metal"), + _getValueFromJson(data, "coin"), + _getValueFromJson(data, "arrowvine"), + _getValueFromJson(data, "corpsecap"), + _getValueFromJson(data, "snowthistle"), + _getValueFromJson(data, "axenut"), + _getValueFromJson(data, "flamefruit"), + _getValueFromJson(data, "rockroot"), + _getValueFromJson(data, "treasure"), + ); + } +} + +class SpecialRule { + final String type; + final String name; + final Object? health; + final int level; + final int init; + final String note; + final List<Object?> list; + final bool startOfRound; + final Object? condition; + + const SpecialRule( + this.type, + this.name, + this.health, + this.level, + this.init, + this.note, + this.list, + this.startOfRound, + this.condition, + ); + + factory SpecialRule.fromJson(Map<String, dynamic> data) { + final String type = data['type']; //required + String name = ""; + if (data.containsKey('name')) { + name = data['name']; + } + Object? health = ""; + if (data.containsKey('health')) { + health = data['health']; + } + Object? condition = ""; + if (data.containsKey('condition')) { + condition = data['condition']; + } + int level = 0; + if (data.containsKey('level')) { + level = data['level']; + } + int init = 99; + if (data.containsKey('init')) { + init = data['init']; + } + String note = ""; + if (data.containsKey('note')) { + note = data['note']; + } + bool startOfRound = true; + if (data.containsKey('startOfRound')) { + startOfRound = data['startOfRound']; + } + List<Object?> aList = []; + if (data.containsKey('list')) { + aList = data['list'] as List<Object?>; + } + return SpecialRule( + type, + name, + health, + level, + init, + note, + aList, + startOfRound, + condition, + ); + } + + Map<String, dynamic> toJson() => { + 'type': type, + 'note': note, + 'name': name, + 'health': health.toString(), + 'condition': condition.toString(), + 'init': init, + 'level': level, + 'startOfRound': startOfRound, + 'list': list, + }; + + @override + String toString() => json.encode(toJson()); +} + +//can't be immutable since merging other data late +class ScenarioModel { + ScenarioModel({ + required this.name, + required this.sections, + required this.monsters, + required this.specialRules, + required this.lootDeck, + required this.initMessage, + required this.monsterStandees, + }); + final String name; + List<String> monsters; + List<SpecialRule> specialRules; + final LootDeckModel? lootDeck; + String initMessage; + final List<RoomMonsterData>? monsterStandees; + final List<ScenarioModel> sections; + factory ScenarioModel.fromJson( + String name, + Map<String, dynamic> data, + RoomsModel? rooms, + ) { + List<String> monsterList = []; + if (data.containsKey('monsters')) { + final monsters = (data['monsters'] as List<Object?>).cast<String>(); + for (final monster in monsters) { + monsterList.add(monster); + } + } + List<SpecialRule> rulesList = []; + if (data.containsKey('special')) { + final specialRules = (data['special'] as List<Object?>) + .cast<Map<String, dynamic>>(); + for (final rule in specialRules) { + rulesList.add(SpecialRule.fromJson(rule)); + } + } + LootDeckModel? lootDeck; + if (data.containsKey('lootDeck')) { + lootDeck = LootDeckModel.fromJson(data['lootDeck']); + } + String initMessage = ""; + if (data.containsKey('initialMessage')) { + initMessage = data['initialMessage']; + } + + List<ScenarioModel> sectionList = []; + + if (rooms != null) { + List names = []; + for (final u in rooms.roomData) { + if (names.contains(u.name)) { + print("duplicate ${u.name} in ${rooms.scenarioName}"); + } else { + names.add(u.name); + } + } + } + + if (rooms != null) { + for (int i = 1; i < rooms.roomData.length; i++) { + //skip first as it is the scenario start room + sectionList.add(ScenarioModel.sectionFromRoomData(rooms.roomData[i])); + } + } + + if (data.containsKey("sections")) { + final sections = data['sections'] as Map<dynamic, dynamic>; + for (String key in sections.keys) { + if (rooms == null) { + sectionList.add( + ScenarioModel.sectionFromJson(key, sections[key], rooms), + ); + } else { + //it might be a bit silly that room data and section data is separate + //merge if has already + int splitIndex = 0; + //would be nice to know which is solo scenario + ScenarioModel? section = sectionList.firstWhereOrNull( + (element) => element.name == key.split(" ")[splitIndex], + ); + if (section != null) { + //merge + ScenarioModel model = ScenarioModel.sectionFromJson( + key, + sections[key], + rooms, + ); + section.monsters = model.monsters; + section.initMessage = model.initMessage; + section.specialRules = model.specialRules; + } else { + sectionList.add( + ScenarioModel.sectionFromJson(key, sections[key], rooms), + ); + } + } + } + } + if (rooms != null && rooms.roomData.isEmpty) { + rooms = null; + } + + return ScenarioModel( + name: name, + monsters: monsterList, + specialRules: rulesList, + lootDeck: lootDeck, + initMessage: initMessage, + sections: sectionList, + monsterStandees: rooms?.roomData.first.monsterData, + ); + } + + factory ScenarioModel.sectionFromJson( + String name, + Map<String, dynamic> data, + RoomsModel? rooms, + ) { + List<String> monsterList = []; + if (data.containsKey('monsters')) { + final monsters = (data['monsters'] as List<Object?>).cast<String>(); + for (final monster in monsters) { + monsterList.add(monster); + } + } + List<SpecialRule> rulesList = []; + if (data.containsKey('special')) { + final specialRules = (data['special'] as List<Object?>) + .cast<Map<String, dynamic>>(); + for (final rule in specialRules) { + rulesList.add(SpecialRule.fromJson(rule)); + } + } + String initMessage = ""; + if (data.containsKey('initialMessage')) { + initMessage = data['initialMessage']; + } + + //find right room + List<RoomMonsterData>? standees = rooms?.roomData + .firstWhereOrNull( + (element) => + element.name == + GameMethods.findNrFromScenarioName(name).toString(), + ) + ?.monsterData; + return ScenarioModel( + name: name, + monsters: monsterList, + specialRules: rulesList, + lootDeck: null, + initMessage: initMessage, + sections: [], + monsterStandees: standees, + ); + } + + factory ScenarioModel.sectionFromRoomData(RoomModel room) { + return ScenarioModel( + name: "#${room.name}", + monsters: [], + specialRules: [], + lootDeck: null, + initMessage: "", + sections: [], + monsterStandees: room.monsterData, + ); + } +} diff --git a/server/lib/core/models/summon_model.dart b/server/lib/core/models/summon_model.dart new file mode 100644 index 0000000..802f3f8 --- /dev/null +++ b/server/lib/core/models/summon_model.dart @@ -0,0 +1,57 @@ +import 'package:x_haven_server/core/models/monster.dart'; + +class SummonModel { + final String name; + final StatValue health; + final int move; + final int attack; + final int range; + final int level; + final String gfx; + final int standees; + const SummonModel( + this.name, + this.health, + this.move, + this.attack, + this.range, + this.level, + this.gfx, + this.standees, + ); + + factory SummonModel.fromJson(Map<String, dynamic> data, String key) { + String name = key; + StatValue health = const IntStatValue(2); //default to 2 not to die + if (data.containsKey('health')) { + health = StatValue.fromJson(data['health']); + } + int move = 0; + if (data.containsKey('move')) { + move = data['move']; + } + int attack = 0; + if (data.containsKey('attack')) { + attack = data['attack']; + } + int range = 0; + if (data.containsKey('range')) { + range = data['range']; + } + int level = 0; + if (data.containsKey('level')) { + level = data['level']; + } + String gfx = ""; + if (data.containsKey('gfx')) { + gfx = data['gfx']; + } + + int standees = 1; + if (data.containsKey('standees')) { + standees = data['standees']; + } + + return SummonModel(name, health, move, attack, range, level, gfx, standees); + } +} diff --git a/server/lib/core/save_store.dart b/server/lib/core/save_store.dart new file mode 100644 index 0000000..5ffdc36 --- /dev/null +++ b/server/lib/core/save_store.dart @@ -0,0 +1,56 @@ +import 'dart:io'; + +import 'package:path/path.dart' as p; + +/// Persistent store for the authoritative game-state snapshot. +/// +/// Replaces the reference app's `shared_preferences`-backed persistence with a +/// small synchronous store: the server saves after every action and must be +/// able to read back the snapshot before broadcasting (Phase 2). +abstract class SaveStore { + /// Returns the stored snapshot, or null if nothing has been saved yet. + String? read(); + + /// Writes the snapshot. + void write(String data); + + /// Removes the stored snapshot. + void clear(); +} + +/// In-memory [SaveStore] — used by tests. +class InMemorySaveStore implements SaveStore { + String? _data; + + @override + String? read() => _data; + + @override + void write(String data) => _data = data; + + @override + void clear() => _data = null; +} + +/// File-backed [SaveStore] writing a single JSON snapshot into [directory]. +class FileSaveStore implements SaveStore { + final File _file; + + FileSaveStore(String directory) + : _file = File(p.join(directory, 'game.json')); + + @override + String? read() => _file.existsSync() ? _file.readAsStringSync() : null; + + @override + void write(String data) { + final dir = _file.parent; + if (!dir.existsSync()) dir.createSync(recursive: true); + _file.writeAsString(data, flush: true); + } + + @override + void clear() { + if (_file.existsSync()) _file.deleteSync(); + } +} diff --git a/server/lib/core/service_locator.dart b/server/lib/core/service_locator.dart new file mode 100644 index 0000000..8046359 --- /dev/null +++ b/server/lib/core/service_locator.dart @@ -0,0 +1,25 @@ +import 'package:get_it/get_it.dart'; + +import 'game_data.dart'; +import 'save_store.dart'; +import 'settings.dart'; +import 'state/game_state.dart'; +import 'translation_service.dart'; + +final getIt = GetIt.instance; + +/// Registers the server-side singletons. +/// +/// The reference app's `setupGetIt()` registered the network services too +/// (Communication, Network, Connection, Client) — those are replaced by the +/// WebSocket layer in Phase 2. [saveStore] defaults to in-memory; +/// `bin/main.dart` passes a [FileSaveStore] rooted at `saves/`. +void setupCore({SaveStore? saveStore}) { + getIt.registerLazySingleton<SaveStore>( + () => saveStore ?? InMemorySaveStore(), + ); + getIt.registerLazySingleton<GameData>(() => GameData()); + getIt.registerLazySingleton<Settings>(() => Settings()); + getIt.registerLazySingleton<GameState>(() => GameState()); + getIt.registerLazySingleton<TranslationService>(() => TranslationService()); +} diff --git a/server/lib/core/settings.dart b/server/lib/core/settings.dart new file mode 100644 index 0000000..1f48a87 --- /dev/null +++ b/server/lib/core/settings.dart @@ -0,0 +1,251 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:x_haven_server/core/commands/load_character_save_command.dart'; +import 'package:x_haven_server/core/commands/load_save_command.dart'; +import 'package:x_haven_server/core/service_locator.dart'; + +import 'enums.dart'; +import 'state/game_state.dart'; + +/// Server-side settings. +/// +/// Ported from the reference app with the Flutter-specific parts removed: +/// no `ValueNotifier`s (plain fields), no window management, no +/// shared_preferences persistence (server settings persistence lands in +/// Phase 6). The `server`/`client` network settings are gone — this process +/// is always the server. +class Settings { + static const double _kDesktopBarScale = 1.6; + + double userScalingMainList = 1.0; + double userScalingBars = + (Platform.isWindows || Platform.isLinux || Platform.isMacOS) + ? _kDesktopBarScale + : 1.0; + double userScalingMenus = 1.0; + bool fullScreen = true; + bool darkMode = false; + bool noInit = true; + bool noStandees = false; + bool randomStandees = false; + bool noCalculation = false; + bool expireConditions = true; + bool hideLootDeck = false; + bool shimmer = Platform.isWindows || Platform.isLinux || Platform.isMacOS; + + /// Opt-in display power saving, in escalating tiers. Defaults to + /// [PowerMode.normal]: the higher tiers trade away polish or convenience, so + /// they are the user's choice to make. + /// + /// Most of the codebase should not read this directly — use + /// `reducePowerEnabled()` in `ui_utils.dart`, which asks the narrower + /// question "may I degrade visual quality?". + PowerMode powerMode = PowerMode.normal; + bool showScenarioNames = true; + bool showCustomContent = true; + bool showSectionsInMainView = true; + bool showReminders = true; + bool autoAddStandees = true; + bool autoAddSpawns = true; + bool showAmdDeck = true; + bool showBattleGoalReminder = true; + bool fhHazTerrainCalcInOGGloom = true; + bool showCharacterAMD = true; + bool enableHeathWheel = true; + + //used for both initiative and search menus + bool softNumpadInput = false; + + Style style = Style.original; + String locale = 'en'; + + final Map<String, String> saves = {}; + final Map<String, String> characterSaves = {}; + + void loadSave(String saveName, {GameState? gameState}) { + String? save = saves[saveName]; + if (save != null) { + final gs = gameState ?? getIt<GameState>(); + gs.action(LoadSaveCommand(saveName, save, gameState: gs)); + } + } + + void saveState(String saveName, {GameState? gameState}) { + saves[saveName] = (gameState ?? getIt<GameState>()).toString(); + } + + void deleteSave(String saveName) { + saves.remove(saveName); + } + + void loadCharacterSave(String saveName, {GameState? gameState}) { + String? save = characterSaves[saveName]; + if (save != null) { + final gs = gameState ?? getIt<GameState>(); + gs.action(LoadCharacterSaveCommand(saveName, save, gameState: gs)); + } + } + + void saveCharacterState(String saveName, Character character) { + characterSaves['$saveName\n${character.id}'] = character.toSave(); + } + + void deleteCharacterSave(String saveId) { + characterSaves.remove(saveId); + } + + /// Applies a settings JSON previously produced by [toString]. + /// + /// Ported from the reference app's `loadFromDisk` field parsing, minus the + /// network/settings persistence parts. (Server settings persistence lands + /// in Phase 6.) + void loadFromData(String state) { + Map<String, dynamic> data = jsonDecode(state); + + if (data["userScalingMainList"] != null) { + userScalingMainList = (data["userScalingMainList"] as num).toDouble(); + } + if (data["userScalingBars"] != null) { + userScalingBars = (data["userScalingBars"] as num).toDouble(); + } + if (data["userScalingMenus"] != null) { + userScalingMenus = (data["userScalingMenus"] as num).toDouble(); + } + if (data["fullScreen"] != null) { + fullScreen = data["fullScreen"] as bool; + } + if (data["softNumpadInput"] != null) { + softNumpadInput = data["softNumpadInput"] as bool; + } + if (data["darkMode"] != null) { + darkMode = data["darkMode"] as bool; + } + if (data["noInit"] != null) { + noInit = data["noInit"] as bool; + } + if (data["noStandees"] != null) { + noStandees = data["noStandees"] as bool; + } + if (data["randomStandees"] != null) { + randomStandees = data["randomStandees"] as bool; + } + if (data["noCalculation"] != null) { + noCalculation = data["noCalculation"] as bool; + } + if (data["hideLootDeck"] != null) { + hideLootDeck = data["hideLootDeck"] as bool; + } + if (data["style"] != null) { + style = Style.values[data["style"] as int]; + } + if (data["expireConditions"] != null) { + expireConditions = data["expireConditions"] as bool; + } + + if (data["shimmer"] != null) { + shimmer = data["shimmer"] as bool; + } + final powerModeIdx = data["powerMode"] as int?; + if (powerModeIdx != null && + powerModeIdx >= 0 && + powerModeIdx < PowerMode.values.length) { + powerMode = PowerMode.values[powerModeIdx]; + } + if (data["showScenarioNames"] != null) { + showScenarioNames = data["showScenarioNames"] as bool; + } + if (data["showCustomContent"] != null) { + showCustomContent = data["showCustomContent"] as bool; + } + + if (data["showSectionsInMainView"] != null) { + showSectionsInMainView = data["showSectionsInMainView"] as bool; + } + + if (data["showReminders"] != null) { + showReminders = data["showReminders"] as bool; + } + + if (data["autoAddStandees"] != null) { + autoAddStandees = data["autoAddStandees"] as bool; + } + + if (data["autoAddSpawns"] != null) { + autoAddSpawns = data["autoAddSpawns"] as bool; + } + + if (data["showAmdDeck"] != null) { + showAmdDeck = data["showAmdDeck"] as bool; + } + + if (data["showBattleGoalReminder"] != null) { + showBattleGoalReminder = data["showBattleGoalReminder"] as bool; + } + + if (data["fhHazTerrainCalcInOGGloom"] != null) { + fhHazTerrainCalcInOGGloom = data["fhHazTerrainCalcInOGGloom"] as bool; + } + + if (data["showCharacterAMD"] != null) { + showCharacterAMD = data["showCharacterAMD"] as bool; + } + + if (data["enableHeathWheel"] != null) { + enableHeathWheel = data["enableHeathWheel"] as bool; + } + + if (data["locale"] != null) { + locale = data["locale"] as String; + } + + if (data["saves"] != null) { + Map<String, dynamic> map = data["saves"] as Map<String, dynamic>; + for (final key in map.keys) { + saves[key] = map[key] as String; + } + } + + if (data["characterSaves"] != null) { + Map<String, dynamic> map = data["characterSaves"] as Map<String, dynamic>; + for (final key in map.keys) { + characterSaves[key] = map[key] as String; + } + } + } + + @override + String toString() { + return '{' + '"userScalingMainList": $userScalingMainList, ' + '"userScalingBars": $userScalingBars, ' + '"userScalingMenus": $userScalingMenus, ' + '"fullScreen": $fullScreen, ' + '"softNumpadInput": $softNumpadInput, ' + '"noInit": $noInit, ' + '"noStandees": $noStandees, ' + '"randomStandees": $randomStandees, ' + '"noCalculation": $noCalculation, ' + '"expireConditions": $expireConditions, ' + '"hideLootDeck": $hideLootDeck, ' + '"style": ${style.index}, ' + '"darkMode": $darkMode, ' + '"shimmer": $shimmer, ' + '"powerMode": ${powerMode.index}, ' + '"showScenarioNames": $showScenarioNames, ' + '"showCustomContent": $showCustomContent, ' + '"showSectionsInMainView": $showSectionsInMainView, ' + '"showReminders": $showReminders, ' + '"autoAddStandees": $autoAddStandees, ' + '"autoAddSpawns": $autoAddSpawns, ' + '"showAmdDeck": $showAmdDeck, ' + '"showBattleGoalReminder": $showBattleGoalReminder, ' + '"fhHazTerrainCalcInOGGloom": $fhHazTerrainCalcInOGGloom, ' + '"showCharacterAMD": $showCharacterAMD, ' + '"enableHeathWheel": $enableHeathWheel, ' + '"locale": "$locale", ' + '"saves": ${jsonEncode(saves)}, ' + '"characterSaves": ${jsonEncode(characterSaves)} ' + '}'; + } +} diff --git a/server/lib/core/stat_calculator.dart b/server/lib/core/stat_calculator.dart new file mode 100644 index 0000000..2ffb297 --- /dev/null +++ b/server/lib/core/stat_calculator.dart @@ -0,0 +1,174 @@ +// ignore_for_file: avoid-non-null-assertion + +import 'package:x_haven_server/core/models/monster.dart'; +import 'package:x_haven_server/core/state/game_state.dart'; +import 'package:x_haven_server/core/service_locator.dart'; + +import 'game_methods.dart'; + +class StatCalculator { + static int? calculateFormula(final Object stat, [GameState? gameState]) { + if (stat is IntStatValue) return stat.value; + if (stat is int) return stat; + + final String str; + if (stat is FormulaStatValue) { + str = stat.formula; + } else if (stat is String) { + str = stat; + } else { + return null; + } + + final gs = gameState ?? getIt<GameState>(); + int C = GameMethods.getCurrentCharacterAmount(gameState: gs); + final int minNrCharacters = 2; + if (C < minNrCharacters) { + C = minNrCharacters; + } + int L = gs.level; + String formula = str.replaceAll("C", C.toString()); + formula = formula.replaceAll("L", L.toString()); + return eval(formula); + } + + static int? eval(final String str) { + return Parser(str).parse(); + } + + static bool evaluateCondition(final Object str) { + return calculateFormula(str) == 1; + } +} + +class Parser { + int pos = -1; + String ch = ''; + String str; + + Parser(this.str); + + void nextChar() { + ch = (++pos < str.length) ? str[pos] : '-1'; + } + + bool eat(String charToEat) { + while (ch == ' ') { + nextChar(); + } + if (ch == charToEat.toString()) { + nextChar(); + return true; + } + return false; + } + + int? parse() { + try { + nextChar(); + int? result = parseCondition(); + if (pos < str.length) { + // ignore: avoid_print + print("Unexpected: $ch"); + return null; + } + return result; + } catch (_) { + return null; + } + } + + // Grammar: + // condition = expression | `>` expression | `<` expression | '=' expression + // expression = term | expression `+` term | expression `-` term + // term = factor | term `*` factor | term `/` factor + // factor = `+` factor | `-` factor | `(` expression `)` | number + // | functionName `(` expression `)` | functionName factor + // | factor `^` factor + + int? parseCondition() { + try { + int result = parseExpression()!; + for (;;) { + if (eat('<')) { + result = result < parseExpression()! ? 1 : 0; + } else if (eat('>')) { + result = result > parseExpression()! ? 1 : 0; + } else if (eat('=')) { + result = result == parseExpression()! ? 1 : 0; + } else { + return result; + } + } + } catch (_) { + return null; + } + } + + int? parseExpression() { + try { + int result = parseTerm()!; + for (;;) { + if (eat('+')) { + result += parseTerm()!; + } else if (eat('-')) { + result -= parseTerm()!; + } else { + return result; + } + } + } catch (_) { + return null; + } + } + + int? parseTerm() { + try { + int result = parseFactor()!; + for (;;) { + if (eat('*')) result *= parseFactor()!; // multiplication + if (eat('x')) { + result *= parseFactor()!; // multiplication + } else if (eat('/')) { + result = (result / parseFactor()!).ceil(); + } else if (eat('d')) { + result = (result / parseFactor()!).floor(); + } else { + return result; + } + } + } catch (_) { + return null; + } + } + + int? parseFactor() { + try { + if (eat('+')) return parseFactor(); // unary plus + if (eat('-')) return -parseFactor()!; // unary minus + + int? result; + int startPos = pos; + int asciiValue = ch.codeUnits.first; + if (eat('(')) { + // parentheses + result = parseExpression(); + if (!eat(')')) throw Exception("Missing ')'"); + } else if (asciiValue >= '0'.codeUnits.first && + asciiValue <= '9'.codeUnits.first) { + // numbers + while ((asciiValue >= '0'.codeUnits.first && + asciiValue <= '9'.codeUnits.first)) { + nextChar(); + asciiValue = ch.codeUnits.first; + } + result = int.parse(str.substring(startPos, pos)); + } else { + throw Exception("Unexpected: $ch"); + } + return result; + } catch (_) { + return null; + } + } +} diff --git a/server/lib/core/state/character.dart b/server/lib/core/state/character.dart new file mode 100644 index 0000000..59fe3bf --- /dev/null +++ b/server/lib/core/state/character.dart @@ -0,0 +1,143 @@ +part of 'game_state.dart'; + +// ignore_for_file: library_private_types_in_public_api + +class Character extends ListItemData { + final CharacterState characterState; + final CharacterClass characterClass; + + Character(this.characterState, this.characterClass) { + id = GameMethods.isObjectiveOrEscort(characterClass) + ? characterState.display + : characterClass.id; + } + + static CharacterClass _requireClass(String anId, String? edition) { + final cls = _getClassStatic(anId, edition); + if (cls == null) { + throw StateError('Character class not found: $anId (edition: $edition)'); + } + return cls; + } + + Character.fromSave(Map<String, dynamic> json) + : characterState = CharacterState.fromSave( + json['characterClass'] as String, + json['characterState'] as Map<String, dynamic>, + ), + characterClass = _requireClass( + json['characterClass'] as String, + json['edition'] as String?, + ) { + id = characterClass.id; + if (json.containsKey("note")) { + _note = json["note"] as String; + } + } + + Character.fromJson(Map<String, dynamic> json) + : characterState = CharacterState.fromJson( + json['characterClass'] as String, + json['characterState'] as Map<String, dynamic>, + ), + characterClass = _requireClass( + json['characterClass'] as String, + json['edition'] as String?, + ) { + final turnStateIdx = json['turnState'] as int?; + if (turnStateIdx != null && + turnStateIdx >= 0 && + turnStateIdx < TurnsState.values.length) { + _turnState = TurnsState.values[turnStateIdx]; + } + if (json.containsKey("note")) { + _note = json["note"] as String; + } + + id = GameMethods.isObjectiveOrEscort(characterClass) + ? characterState.display + : characterClass.id; + } + + /// Updates mutable fields in-place from [json]. [characterClass] and [id] + /// never change; only [_turnState] and [characterState] need updating. + void updateFromJson(Map<String, dynamic> json) { + final turnStateIdx = json['turnState'] as int?; + if (turnStateIdx != null && + turnStateIdx >= 0 && + turnStateIdx < TurnsState.values.length) { + _turnState = TurnsState.values[turnStateIdx]; + } + _note = json.containsKey("note") ? json["note"] as String : ""; + characterState.updateFromJson( + json['characterClass'] as String, + json['characterState'] as Map<String, dynamic>, + ); + } + + void nextRound(_StateModifier _) { + if (!GameMethods.isObjectiveOrEscort(characterClass)) { + characterState._initiative = 0; + } + } + + void flipUseFHPerks(_StateModifier s) { + //first clear all perks + for (int i = 0; i < characterState._perkList.length; i++) { + if (characterState._perkList[i]) { + characterState.flipPerk(s, i); + CharacterMethods.removePerk(s, this, i); + } + } + + characterState._useFHPerks = !characterState._useFHPerks; + } + + void flipPerk(_StateModifier s, int index) { + characterState.flipPerk(s, index); + if (characterState.perkList[index]) { + CharacterMethods.addPerk(s, this, index); + } else { + CharacterMethods.removePerk(s, this, index); + } + } + + String toSave() { + return '{' + '"characterState": ${characterState.toString()}, ' + '"note": ${jsonEncode(note)}, ' + '"characterClass": "${characterClass.id}", ' + '"edition": "${characterClass.edition}" ' + '}'; + } + + @override + Map<String, dynamic> toJson() => { + 'id': id, + 'turnState': turnState.index, + 'note': note, + 'characterState': characterState.toJson(), + 'characterClass': characterClass.id, + 'edition': characterClass.edition, + }; + + @override + String toString() => json.encode(toJson()); + + static CharacterClass? _getClassStatic( + String id, + String? edition, { + GameData? gameData, + }) { + final modelData = (gameData ?? getIt<GameData>()).modelData; + for (String key in modelData.keys) { + final item = modelData[key]?.characters.firstWhereOrNull((item) { + return item.id == id && (edition == null || edition == item.edition); + }); + if (item != null) { + return item; + } + } + return null; + } +} diff --git a/server/lib/core/state/character_state.dart b/server/lib/core/state/character_state.dart new file mode 100644 index 0000000..848bc1c --- /dev/null +++ b/server/lib/core/state/character_state.dart @@ -0,0 +1,251 @@ +part of 'game_state.dart'; + +// ignore_for_file: library_private_types_in_public_api + +class CharacterState extends FigureState { + static const int _kMaxPerks = 18; + + String _display = ""; + final List<bool> _perkList = List.filled(_kMaxPerks, false); + int _perkListVersion = 0; + bool _useFHPerks = false; + + int _initiative = 0; + int _xp = 0; + final List<MonsterInstance> _summonList = []; + BuiltList<MonsterInstance> _summonListNotifier = BuiltList.of([]); + final ModifierDeck _modifierDeck; + + String get display => _display; + int get initiative => _initiative; + int get xp => _xp; + BuiltList<MonsterInstance> get summonList => BuiltList.of(_summonList); + BuiltList<MonsterInstance> get summonListNotifier => _summonListNotifier; + ModifierDeck get modifierDeck => _modifierDeck; + + void _notifySummonList() { + // UI-only in the reference app + } + + /// Public guarded notify — allows commands to trigger the summon list + /// update at the correct time (e.g. after a 600 ms death animation). + void notifySummonList(_StateModifier _) { + _notifySummonList(); + } + + BuiltList<bool> get perkList => BuiltList.of(_perkList); + int get perkListVersion => _perkListVersion; + bool get useFHPerks => _useFHPerks; + + CharacterState(final String id) : _modifierDeck = ModifierDeck(id); + + static ModifierDeck _deckFromJson(String id, Map<String, dynamic> json) { + if (json.containsKey("modifierDeck")) { + return ModifierDeck.fromJson(id, json["modifierDeck"]); + } + return ModifierDeck(id); + } + + CharacterState.fromSave(final String id, Map<String, dynamic> json) + : _modifierDeck = ModifierDeck(id) { + _level = json["level"]; + _display = json['display']; + if (json.containsKey("useFHPerks")) { + _useFHPerks = json["useFHPerks"]; + } + if (json.containsKey("perkList")) { + final perks = json["perkList"]; + int i = 0; + for (bool item in perks) { + if (i >= _perkList.length) break; + _perkList[i] = item; + i++; + } + } + } + + CharacterState.fromJson(final String id, Map<String, dynamic> json) + : _modifierDeck = _deckFromJson(id, json) { + _initiative = json['initiative']; + _xp = json['xp']; + _chill = json['chill']; + _health = json["health"]; + _level = json["level"]; + _maxHealth = json["maxHealth"]; + _display = json['display']; + + final summons = json["summonList"]; + for (final item in summons) { + _summonList.add(MonsterInstance.fromJson(item)); + } + _notifySummonList(); + + //todo: automate check json.containsKey for everything: the nr of update bugs... + if (json.containsKey("perkList")) { + final perks = json["perkList"]; + int i = 0; + for (bool item in perks) { + if (i >= _perkList.length) break; + _perkList[i] = item; + i++; + } + } + if (json.containsKey("useFHPerks")) { + _useFHPerks = json["useFHPerks"]; + } + + final condis = json["conditions"]; + for (int item in condis) { + if (item >= 0 && item < Condition.values.length) { + _conditions.add(Condition.values[item]); + } + } + + if (json.containsKey("conditionsAddedThisTurn")) { + final condis2 = json["conditionsAddedThisTurn"]; + for (int item in condis2) { + if (item >= 0 && item < Condition.values.length) { + _conditionsAddedThisTurn.add(Condition.values[item]); + } + } + } + if (json.containsKey("conditionsAddedPreviousTurn")) { + final condis3 = json["conditionsAddedPreviousTurn"]; + for (int item in condis3) { + if (item >= 0 && item < Condition.values.length) { + _conditionsAddedPreviousTurn.add(Condition.values[item]); + } + } + } + } + + /// Updates all fields in-place from [json]. Preserves object identity. + void updateFromJson(String _, Map<String, dynamic> json) { + _initiative = json['initiative'] as int; + _xp = json['xp'] as int; + _chill = json['chill'] as int; + _health = json["health"] as int; + _level = json["level"] as int; + _maxHealth = json["maxHealth"] as int; + _display = json['display'] as String; + _plague = 0; // not serialised — reset to match fromJson behaviour + + _summonList.clear(); + for (final item in json["summonList"]) { + _summonList.add(MonsterInstance.fromJson(item as Map<String, dynamic>)); + } + _notifySummonList(); + + for (int i = 0; i < _perkList.length; i++) { + _perkList[i] = false; + } + if (json.containsKey("perkList")) { + int i = 0; + for (bool item in json["perkList"]) { + if (i >= _perkList.length) break; + _perkList[i] = item; + i++; + } + } + _perkListVersion++; + _useFHPerks = json.containsKey("useFHPerks") + ? json["useFHPerks"] as bool + : false; + + // Assign a new list instance. + final newConditions = <Condition>[]; + for (int item in json["conditions"]) { + if (item >= 0 && item < Condition.values.length) { + newConditions.add(Condition.values[item]); + } + } + _conditions = newConditions; + + if (json.containsKey("modifierDeck")) { + _modifierDeck.updateFromJson( + json["modifierDeck"] as Map<String, dynamic>, + ); + } else { + _modifierDeck.resetToDefault(); + } + + _conditionsAddedThisTurn.clear(); + if (json.containsKey("conditionsAddedThisTurn")) { + for (int item in json["conditionsAddedThisTurn"]) { + if (item >= 0 && item < Condition.values.length) { + _conditionsAddedThisTurn.add(Condition.values[item]); + } + } + } + _conditionsAddedPreviousTurn.clear(); + if (json.containsKey("conditionsAddedPreviousTurn")) { + for (int item in json["conditionsAddedPreviousTurn"]) { + if (item >= 0 && item < Condition.values.length) { + _conditionsAddedPreviousTurn.add(Condition.values[item]); + } + } + } + } + + void flipPerk(_StateModifier _, int index) { + _perkList[index] = !_perkList[index]; + _perkListVersion++; + } + + void setDisplay(_StateModifier _, String value) { + _display = value; + } + + void setInitiative(_StateModifier _, int value) { + _initiative = value; + } + + void setXp(_StateModifier _, int value) { + _xp = max(value, 0); + } + + void addSummon(_StateModifier _, MonsterInstance summon) { + _summonList.add(summon); + _notifySummonList(); + } + + /// Removes [summon] from the list. + /// The caller is responsible for calling [notifySummonList] at the + /// appropriate time (e.g. after a 600 ms death animation). + void removeSummon(_StateModifier _, MonsterInstance summon) { + _summonList.remove(summon); + } + + String toSave() { + return '{' + '"level": ${level}, ' + '"useFHPerks": ${jsonEncode(useFHPerks)}, ' + '"display": ${jsonEncode(display)}, ' + '"perkList": ${_perkList.toString()} ' + '}'; + } + + Map<String, dynamic> toJson() => { + 'initiative': initiative, + 'health': health, + 'maxHealth': maxHealth, + 'level': level, + 'xp': xp, + 'chill': chill, + 'display': display, + 'modifierDeck': _modifierDeck.toJson(), + 'summonList': _summonList.map((s) => s.toJson()).toList(), + 'useFHPerks': useFHPerks, + 'perkList': List<bool>.of(_perkList), + 'conditions': _conditions.map((c) => c.index).toList(), + 'conditionsAddedThisTurn': _conditionsAddedThisTurn + .map((c) => c.index) + .toList(), + 'conditionsAddedPreviousTurn': _conditionsAddedPreviousTurn + .map((c) => c.index) + .toList(), + }; + + @override + String toString() => json.encode(toJson()); +} diff --git a/server/lib/core/state/figure_state.dart b/server/lib/core/state/figure_state.dart new file mode 100644 index 0000000..d14275f --- /dev/null +++ b/server/lib/core/state/figure_state.dart @@ -0,0 +1,62 @@ +part of 'game_state.dart'; + +// ignore_for_file: library_private_types_in_public_api +class FigureState { + List<Condition> _conditions = []; + + List<Condition> get conditions => _conditions; + + int _level = 1; + int _health = 0; + int _maxHealth = 0; + int _chill = 0; + int _plague = 0; + final Set<Condition> _conditionsAddedThisTurn = {}; + final Set<Condition> _conditionsAddedPreviousTurn = {}; + + int get level => _level; + int get health => _health; + int get maxHealth => _maxHealth; + int get chill => _chill; + int get plague => _plague; + BuiltSet<Condition> get conditionsAddedThisTurn => + BuiltSet.of(_conditionsAddedThisTurn); + BuiltSet<Condition> get conditionsAddedPreviousTurn => + BuiltSet.of(_conditionsAddedPreviousTurn); + + void setHealth(_StateModifier _, int value) { + _health = value; + } + + void setFigureLevel(_StateModifier _, int value) { + _level = value; + } + + void setMaxHealth(_StateModifier _, int value) { + _maxHealth = value; + } + + void setChill(_StateModifier _, int value) { + _chill = value; + } + + void setPlague(_StateModifier _, int value) { + _plague = value; + } + + void setConditions(_StateModifier _, List<Condition> value) { + _conditions = value; + } + + void addToConditionsThisTurn(_StateModifier _, Condition condition) { + _conditionsAddedThisTurn.add(condition); + } + + void removeFromConditionsThisTurn(_StateModifier _, Condition condition) { + _conditionsAddedThisTurn.remove(condition); + } + + void removeFromConditionsPreviousTurn(_StateModifier _, Condition condition) { + _conditionsAddedPreviousTurn.remove(condition); + } +} diff --git a/server/lib/core/state/game_save_state.dart b/server/lib/core/state/game_save_state.dart new file mode 100644 index 0000000..331b3a8 --- /dev/null +++ b/server/lib/core/state/game_save_state.dart @@ -0,0 +1,252 @@ +part of 'game_state.dart'; + +final _gameSaveStateLog = Logger('GameSaveState'); + +class GameSaveState { + String? _savedState; + + String getState() { + final state = _savedState; + if (state == null) throw StateError('GameSaveState: no saved state'); + return state; + } + + void save(GameState gameState) { + _savedState = gameState.toString(); + } + + void load(GameState gameState) { + if (_savedState != null) { + try { + final data = json.decode(_savedState ?? '') as Map<String, dynamic>; + + gameState._level = data['level'] as int; + gameState._scenario = data['scenario']; // as String; + if (data.containsKey('toastMessage')) { + gameState._toastMessage = data['toastMessage']; // as String; + } + + if (data.containsKey('scenarioSectionsAdded')) { + List<Object?> scenarioSectionsAdded = + data['scenarioSectionsAdded'] as List<Object?>; + gameState._scenarioSectionsAdded.clear(); + for (final item in scenarioSectionsAdded) { + gameState._scenarioSectionsAdded.add(item as String); + } + } + + if (data.containsKey('scenarioSpecialRules')) { + final scenarioSpecialRulesList = data['scenarioSpecialRules'] as List; + gameState._scenarioSpecialRules.clear(); + for (Map<String, dynamic> item in scenarioSpecialRulesList) { + gameState._scenarioSpecialRules.add(SpecialRule.fromJson(item)); + } + } + gameState._scenarioSectionsVersion++; + gameState._currentCampaign = data['currentCampaign']; + gameState._round = data['round'] as int; + if (data.containsKey('totalRounds')) { + gameState._totalRounds = data['totalRounds'] as int; + } else { + gameState._totalRounds = gameState._round; + } + final roundStateIdx = data['roundState'] as int?; + if (roundStateIdx != null && + roundStateIdx >= 0 && + roundStateIdx < RoundState.values.length) { + gameState._roundState = RoundState.values[roundStateIdx]; + } + gameState._solo = data['solo'] as bool; + + if (data.containsKey('autoScenarioLevel')) { + gameState._autoScenarioLevel = data['autoScenarioLevel'] as bool; + } else { + gameState._autoScenarioLevel = true; + } + + if (data.containsKey("allyDeckInOGGloom")) { + gameState._allyDeckInOGGloom = data["allyDeckInOGGloom"] as bool; + } else { + gameState._allyDeckInOGGloom = true; + } + + if (data.containsKey('difficulty')) { + gameState._difficulty = data['difficulty'] as int; + } else { + gameState._difficulty = 0; + } + + //main list — update existing objects in-place + final list = data['currentList'] as List; + List<ListItemData> newList = []; + for (Map<String, dynamic> item in list) { + if (item["noteRow"] == true) { + final String itemId = item["id"] as String; + final NoteRow? existing = gameState._currentList + .whereType<NoteRow>() + .firstWhereOrNull((e) => e.id == itemId); + if (existing != null) { + existing.updateFromJson(item); + newList.add(existing); + } else { + newList.add(NoteRow.fromJson(item)); + } + } else if (item["characterClass"] != null) { + final String itemId = item["id"] as String; + final Character? existing = gameState._currentList + .whereType<Character>() + .firstWhereOrNull((e) => e.id == itemId); + if (existing != null) { + existing.updateFromJson(item); + newList.add(existing); + } else { + newList.add(Character.fromJson(item)); + } + } else if (item["type"] != null) { + final String itemId = item["id"] as String; + final Monster? existing = gameState._currentList + .whereType<Monster>() + .firstWhereOrNull((e) => e.id == itemId); + if (existing != null) { + existing.updateFromJson(item); + newList.add(existing); + } else { + newList.add(Monster.fromJson(item)); + } + } + } + gameState._currentList = newList; + gameState._notifyCurrentList(); + + final unlockedClassesList = data['unlockedClasses'] as List; + gameState._unlockedClasses.clear(); + for (String item in unlockedClassesList) { + gameState._unlockedClasses.add(item); + } + gameState._unlockedClassesVersion++; + + //ability decks — update existing instances in-place + final decks = data['currentAbilityDecks'] as List; + final List<MonsterAbilityState> newAbilityDecks = []; + for (Map<String, dynamic> item in decks) { + final String deckName = item["name"] as String; + // Prototype has the full initialized card set; used only for nr lookups. + final proto = MonsterAbilityState(deckName); + + List<MonsterAbilityCardModel> newDrawList = []; + List drawPile = item["drawPile"] as List; + for (final cardItem in drawPile) { + int nr = cardItem["nr"]; + for (final card in proto._drawPile.getList()) { + if (card.nr == nr) { + newDrawList.add(card); + break; + } + } + } + List<MonsterAbilityCardModel> newDiscardList = []; + for (final cardItem in item["discardPile"] as List) { + int nr = cardItem["nr"]; + for (final card in proto._drawPile.getList()) { + if (card.nr == nr) { + newDiscardList.add(card); + break; + } + } + } + + // Reuse existing state; fall back to the prototype for monsters + // newly added from a remote device. + final state = + gameState._currentAbilityDecks.firstWhereOrNull( + (s) => s.name == deckName, + ) ?? + proto; + + if (item.containsKey("lastRoundDrawn")) { + state._lastRoundDrawn = item["lastRoundDrawn"] as int; + } + state._drawPile.clear(); + state._discardPile.clear(); + state._drawPile.setList(newDrawList); + state._discardPile.setList(newDiscardList); + state.drawPileVersion++; + newAbilityDecks.add(state); + } + gameState._currentAbilityDecks.clear(); + gameState._currentAbilityDecks.addAll(newAbilityDecks); + + _loadModifierDeck('modifierDeck', data, gameState); + _loadModifierDeck('modifierDeckAllies', data, gameState); + _loadLootDeck(data, gameState); + + if (data["sanctuaryDeck"] != null) { + gameState._sanctuaryDeck = SanctuaryDeck.fromJson( + data["sanctuaryDeck"], + ); + } + + //this is not really a setting, but a scenario command? + if (data["showAllyDeck"] != null) { + gameState._showAllyDeck = data["showAllyDeck"]; + } + + //////elements + Map elementData = data['elementState']; + for (final element in Elements.values) { + final raw = elementData[element.index.toString()] as int?; + final idx = + (raw != null && raw >= 0 && raw < ElementState.values.length) + ? raw + : ElementState.inert.index; + gameState._elementState[element] = ElementState.values[idx]; + } + } catch (e, stack) { + // Deserialization failure: log always (not just debug) so it surfaces + // in release builds and can be caught by crash-reporting tools. + _gameSaveStateLog.warning('GameSaveState.load error: $e\n$stack'); + } + } + } + + void saveToDisk(GameState gameState) { + if (_savedState == null) { + save(gameState); + } + getIt<SaveStore>().write(_savedState!); + } + + void loadFromDisk(GameState gameState) { + //have to call after init or element state overridden + String? data = getIt<SaveStore>().read(); + if (data != null) { + _savedState = data; + load(gameState); + } else { + save(gameState); + } + } + + void loadFromData(String data, GameState gameState) { + //have to call after init or element state overridden + _savedState = data; + load(gameState); + } + + void _loadLootDeck(Map<String, dynamic> data, GameState gameState) { + gameState._lootDeck.updateFromJson(data["lootDeck"]); + } + + void _loadModifierDeck( + String identifier, + Map<String, dynamic> data, + GameState gameState, + ) { + final modifierDeckData = data[identifier] as Map<String, dynamic>; + if (identifier == 'modifierDeck') { + gameState._modifierDeck.updateFromJson(modifierDeckData); + } else { + gameState._modifierDeckAllies.updateFromJson(modifierDeckData); + } + } +} diff --git a/server/lib/core/state/game_state.dart b/server/lib/core/state/game_state.dart new file mode 100644 index 0000000..a6884cc --- /dev/null +++ b/server/lib/core/state/game_state.dart @@ -0,0 +1,352 @@ +import 'dart:collection'; +import 'dart:convert'; +import 'dart:math'; + +import 'package:built_collection/built_collection.dart'; +import 'package:collection/collection.dart'; +import 'package:logging/logging.dart'; + +import 'package:x_haven_server/core/models/character_class.dart'; +import 'package:x_haven_server/core/models/monster.dart'; +import 'package:x_haven_server/core/models/monster_ability.dart'; +import 'package:x_haven_server/core/models/room.dart'; +import 'package:x_haven_server/core/models/scenario.dart'; + +import '../action_handler.dart'; +import '../card_stack.dart'; +import '../commands/add_standee_command.dart'; +import '../enums.dart'; +import '../game_data.dart'; +import '../game_event.dart'; +import '../game_methods.dart'; +import '../save_store.dart'; +import '../service_locator.dart'; +import '../settings.dart'; +import '../stat_calculator.dart'; + +part "../methods/character_methods.dart"; +part "../methods/deck_methods.dart"; +part "../methods/element_methods.dart"; +part "../methods/game_util_methods.dart"; +part "../methods/monster_methods.dart"; +part "../methods/round_methods.dart"; +part "../methods/scenario_methods.dart"; +part "character.dart"; +part "character_state.dart"; +part "figure_state.dart"; +part "game_save_state.dart"; +part "list_item_data.dart"; +part "loot_deck_state.dart"; +part "modifier_deck.dart"; +part "monster.dart"; +part "note_row.dart"; +part "monster_ability_state.dart"; +part "monster_instance.dart"; +part "sanctuary_deck.dart"; + +// ignore_for_file: library_private_types_in_public_api + +/// Central game state holder. +/// +/// Server port of the reference app's `GameState`: the `ValueNotifier`s are +/// plain fields (state is pushed to clients over the network in Phase 2 +/// instead of notifying local listeners), but the structure, part-file +/// layout, `_StateModifier` token, and serialization are unchanged. +class GameState { + late final ActionHandler _actionHandler; + + //state + String _currentCampaign = "Jaws of the Lion"; + int _round = 1; + int _totalRounds = 1; + RoundState _roundState = RoundState.chooseInitiative; + int _level = 1; + bool _solo = false; + bool _autoScenarioLevel = false; + bool _allyDeckInOGGloom = true; + int _difficulty = 1; + String _scenario = ""; + String _toastMessage = ""; + bool _showAllyDeck = false; + List<RoomMonsterData>? pendingAutoAddDialog = null; + + List<String> _scenarioSectionsAdded = []; + List<SpecialRule> _scenarioSpecialRules = []; + int _scenarioSectionsVersion = 0; + List<ListItemData> _currentList = []; //has both monsters and characters + final List<MonsterAbilityState> _currentAbilityDecks = + <MonsterAbilityState>[]; + final Map<Elements, ElementState> _elementState = HashMap(); + Set<String> _unlockedClasses = {}; + int _unlockedClassesVersion = 0; + + LootDeck _lootDeck = LootDeck.empty(); //loot deck for current scenario + final ModifierDeck _modifierDeck = ModifierDeck(""); + final ModifierDeck _modifierDeckAllies = ModifierDeck("allies"); + SanctuaryDeck _sanctuaryDeck = SanctuaryDeck(); + + String get currentCampaign => _currentCampaign; + int get round => _round; + int get totalRounds => _totalRounds; + RoundState get roundState => _roundState; + int get level => _level; + bool get solo => _solo; + bool get autoScenarioLevel => _autoScenarioLevel; + bool get allyDeckInOGGloom => _allyDeckInOGGloom; + int get difficulty => _difficulty; + String get toastMessage => _toastMessage; + String get scenario => _scenario; + + /// Direct set for tests (mirrors the reference app's writable + /// `ValueNotifier<String>` scenario, which its tests wrote to in order to + /// bypass `SetScenarioCommand`'s side effects). + set scenario(String value) => _scenario = value; + bool get showAllyDeck => _showAllyDeck; + int get scenarioSectionsVersion => _scenarioSectionsVersion; + + BuiltList<String> get scenarioSectionsAdded => + BuiltList.of(_scenarioSectionsAdded); + BuiltList<SpecialRule> get scenarioSpecialRules => + BuiltList.of(_scenarioSpecialRules); + BuiltList<ListItemData> get currentList => BuiltList.of(_currentList); + BuiltList<MonsterAbilityState> get currentAbilityDecks => + BuiltList.of(_currentAbilityDecks); + BuiltMap<Elements, ElementState> get elementState => + BuiltMap.of(_elementState); + + ElementState elementStateFor(Elements element) => _elementState[element]!; + BuiltSet<String> get unlockedClasses => BuiltSet.of(_unlockedClasses); + int get unlockedClassesVersion => _unlockedClassesVersion; + + LootDeck get lootDeck => _lootDeck; //todo: still mutable + ModifierDeck get modifierDeck => _modifierDeck; //todo: still mutable + ModifierDeck get modifierDeckAllies => + _modifierDeckAllies; //todo: still mutable + SanctuaryDeck get sanctuaryDeck => _sanctuaryDeck; + + GameState() { + _actionHandler = ActionHandler(gameState: this); + } + + // ActionHandler delegation — public API preserved for all callers + void action(Command command) => _actionHandler.action(command); + void undo() => _actionHandler.undo(); + void redo() => _actionHandler.redo(); + void updateAllUI() => _actionHandler.updateAllUI(); + Command getCurrent() => _actionHandler.getCurrent(); + void resetCommandHistory() => _actionHandler.resetCommandHistory(); + void clearLocalCommands() => _actionHandler.clearLocalCommands(); + void insertReceivedDescription(int index, String description) => + _actionHandler.insertReceivedDescription(index, description); + void addSaveState(GameSaveState state) => _actionHandler.addSaveState(state); + + int get commandIndex => _actionHandler.commandIndex; + + /// Writable, as in the reference (whose `ValueNotifier<int>` getter allowed + /// direct writes); used by tests and by the Phase 2 network layer. + set commandIndex(int value) => _actionHandler.commandIndex = value; + + GameEvent get lastEvent => _actionHandler.lastEvent; + int get maxUndo => _actionHandler.maxUndo; + List<Command?> get commands => _actionHandler.commands; + List<String> get commandDescriptions => _actionHandler.commandDescriptions; + List<GameSaveState?> get gameSaveStates => _actionHandler.gameSaveStates; + + /// The Phase 2 broadcast hook is reachable through the action handler. + void Function(int index, String description, String eventJson)? + get onAction => _actionHandler.onAction; + + // Minimal observer hook — replaces the reference app's ChangeNotifier + // notifications. The network layer (Phase 2) subscribes; unused in Phase 1. + final List<void Function()> _listeners = []; + void addListener(void Function() listener) => _listeners.add(listener); + void removeListener(void Function() listener) => _listeners.remove(listener); + void notifyListeners() => [..._listeners].forEach((l) => l()); + + void init() { + _elementState[Elements.fire] = ElementState.inert; + _elementState[Elements.ice] = ElementState.inert; + _elementState[Elements.air] = ElementState.inert; + _elementState[Elements.earth] = ElementState.inert; + _elementState[Elements.light] = ElementState.inert; + _elementState[Elements.dark] = ElementState.inert; + } + + void setCampaign(_StateModifier _, String value) { + _currentCampaign = value; + } + + void setRoundState(_StateModifier _, RoundState value) { + _roundState = value; + } + + void setLevel(_StateModifier _, int value) { + _level = value; + } + + void setSolo(_StateModifier _, bool value) { + _solo = value; + } + + void setAutoScenarioLevel(_StateModifier _, bool value) { + _autoScenarioLevel = value; + } + + void setAllyDeckInOGGloom(_StateModifier _, bool value) { + _allyDeckInOGGloom = value; + } + + void setDifficulty(_StateModifier _, int value) { + _difficulty = value; + } + + void setScenario(_StateModifier _, String value) { + _scenario = value; + } + + void setToastMessage(_StateModifier _, String value) { + _toastMessage = value; + } + + Map<String, dynamic> toJson() { + final Map<String, int> elements = {}; + for (final key in _elementState.keys) { + final state = _elementState[key]; + if (state != null) { + elements[key.index.toString()] = state.index; + } + } + return { + 'level': _level, + 'solo': _solo, + 'autoScenarioLevel': _autoScenarioLevel, + 'difficulty': _difficulty, + 'roundState': _roundState.index, + 'round': _round, + 'totalRounds': _totalRounds, + 'scenario': _scenario, + 'toastMessage': _toastMessage, + 'scenarioSpecialRules': _scenarioSpecialRules + .map((r) => r.toJson()) + .toList(), + 'scenarioSectionsAdded': _scenarioSectionsAdded, + 'currentCampaign': _currentCampaign, + 'currentList': _currentList.map((item) => item.toJson()).toList(), + 'currentAbilityDecks': _currentAbilityDecks + .map((d) => d.toJson()) + .toList(), + 'sanctuaryDeck': _sanctuaryDeck.toJson(), + 'modifierDeck': _modifierDeck.toJson(), + 'modifierDeckAllies': _modifierDeckAllies.toJson(), + 'lootDeck': _lootDeck.toJson(), + 'unlockedClasses': unlockedClasses.toList(), + 'showAllyDeck': showAllyDeck, + 'allyDeckInOGGloom': allyDeckInOGGloom, + 'elementState': elements, + }; + } + + @override + String toString() => json.encode(toJson()); + + void save() { + GameSaveState state = GameSaveState(); + state.saveToDisk(this); + addSaveState(state); + } + + void load() { + GameSaveState state = GameSaveState(); + state.loadFromDisk(this); + addSaveState( + state, + ); //init state: means game save state is one larger than command list + } + + void loadFromData(String data) { + GameSaveState state = GameSaveState(); + state.loadFromData(data, this); + } + + /// Fires [notifyListeners] with the current list. + void _notifyCurrentList() { + _reflowNoteRows(); + notifyListeners(); + } + + /// Keeps every linked [NoteRow] positioned directly after its target row (and + /// after any earlier notes on the same target), so connected notes stay glued + /// to their anchor through drag-reordering and the per-round initiative sort. + /// Figures and unlinked notes keep their relative order. A note whose target + /// is not currently present is left where it is (and re-glues if the target + /// returns, e.g. mid network sync). No-op — and no reallocation — when there + /// are no linked notes, which is the common case. + void _reflowNoteRows() { + bool hasLinkedNote = false; + for (final item in _currentList) { + if (item is NoteRow && item.linkedId.isNotEmpty) { + hasLinkedNote = true; + break; + } + } + if (!hasLinkedNote) return; + + final Set<String> figureIds = {}; + for (final item in _currentList) { + if (item is! NoteRow) figureIds.add(item.id); + } + + final Map<String, List<NoteRow>> notesByTarget = {}; + final List<ListItemData> anchors = []; + for (final item in _currentList) { + if (item is NoteRow && + item.linkedId.isNotEmpty && + figureIds.contains(item.linkedId)) { + notesByTarget.putIfAbsent(item.linkedId, () => []).add(item); + } else { + anchors.add(item); + } + } + if (notesByTarget.isEmpty) return; + + final List<ListItemData> result = []; + for (final item in anchors) { + result.add(item); + final notes = notesByTarget.remove(item.id); + if (notes != null) result.addAll(notes); + } + _currentList = result; + } + + /// Notifies every monster instance / summon list in the current list. Used + /// by [updateAllUI] (redo / network sync). + void notifyAllMonsterInstances() { + for (final item in _currentList) { + if (item is Monster) { + item._notifyMonsterInstances(); + } else if (item is Character) { + item.characterState._notifySummonList(); + } + } + } + + /// Clears the current list. only for use in tests. temp. should use load from data instead + void clearList() { + _currentList.clear(); + _notifyCurrentList(); + } +} + +abstract class Command { + //private class so only this class and it's children is allowed to change state + _StateModifier stateAccess = _StateModifier(); + void execute(); + void onUndo() {} + String describe(); + + /// The [GameEvent] this command produces. Defaults to [NoEvent]. + /// Override in commands that drive UI animations. + GameEvent get event => const NoEvent(); +} + +class _StateModifier {} diff --git a/server/lib/core/state/list_item_data.dart b/server/lib/core/state/list_item_data.dart new file mode 100644 index 0000000..c322525 --- /dev/null +++ b/server/lib/core/state/list_item_data.dart @@ -0,0 +1,22 @@ +part of 'game_state.dart'; + +// ignore_for_file: library_private_types_in_public_api +class ListItemData { + String id = ''; + TurnsState _turnState = TurnsState.notDone; + TurnsState get turnState => _turnState; + + // Free-form inline note shown on the row. Shared by characters and monsters. + String _note = ""; + String get note => _note; + + void setTurnState(_StateModifier _, TurnsState value) { + _turnState = value; + } + + void setNote(_StateModifier _, String value) { + _note = value; + } + + Map<String, dynamic> toJson() => {}; +} diff --git a/server/lib/core/state/loot_deck_state.dart b/server/lib/core/state/loot_deck_state.dart new file mode 100644 index 0000000..31c6df7 --- /dev/null +++ b/server/lib/core/state/loot_deck_state.dart @@ -0,0 +1,577 @@ +part of 'game_state.dart'; + +// ignore_for_file: library_private_types_in_public_api + +class LootCard { + // ignore: prefer-match-file-name, file contains multiple loot deck state types + static const int _kHighCharCount = 4; + static const int _kLowCharCount = 2; + + final String gfx; + final int id; + final LootBaseValue baseValue; + final LootType lootType; + String owner = ""; + int _enhanced = 0; + int get enhanced => _enhanced; + + LootCard({ + required this.id, + required this.lootType, + required this.baseValue, + required enhanced, + required this.gfx, + }) { + _enhanced = enhanced; + } + + Map<String, dynamic> toJson() => { + 'gfx': gfx, + 'owner': owner, + 'id': id, + 'enhanced': enhanced, + 'baseValue': baseValue.index, + 'lootType': lootType.index, + }; + + @override + String toString() => json.encode(toJson()); + + int? getValue() { + int value = 1; + if (lootType == LootType.other) { + if (enhanced > 0) { + return enhanced; + } + return null; + } + if (enhanced > 0) { + value += enhanced; + } + int characters = GameMethods.getCurrentCharacterAmount(); + if (characters >= _kHighCharCount) { + return value; + } + if (baseValue == LootBaseValue.oneIf4twoIfNot) { + value++; + } else if (characters <= _kLowCharCount && + baseValue == LootBaseValue.oneIf3or4twoIfNot) { + value++; + } + return value; + } +} + +class LootDeck { + static const int _kSpecialCard1418 = 1418; + static const int _kSpecialCard1419 = 1419; + static const int _kTreasureCardId = 9999; + static const int _kMaterialOneCount = 2; + static const int _kMaterialTwoCount = 3; + static const int _kHerbPoolCount = 2; + static const int _kCoin1Count = 12; + static const int _kCoin2Count = 6; + static const int _kMaterialPoolSize = 8; + static const int _kHerbPoolSize = 2; + + List<LootCard> _coinPool = []; + List<LootCard> _lumberPool = []; + List<LootCard> _hidePool = []; + List<LootCard> _metalPool = []; + List<LootCard> _corpsecapPool = []; + List<LootCard> _arrowvinePool = []; + List<LootCard> _flamefruitPool = []; + List<LootCard> _axenutPool = []; + List<LootCard> _rockrootPool = []; + List<LootCard> _snowthistlePool = []; + + BuiltList<LootCard> get coinPool => BuiltList.of(_coinPool); + BuiltList<LootCard> get lumberPool => BuiltList.of(_lumberPool); + BuiltList<LootCard> get hidePool => BuiltList.of(_hidePool); + BuiltList<LootCard> get metalPool => BuiltList.of(_metalPool); + BuiltList<LootCard> get corpsecapPool => BuiltList.of(_corpsecapPool); + BuiltList<LootCard> get arrowvinePool => BuiltList.of(_arrowvinePool); + BuiltList<LootCard> get flamefruitPool => BuiltList.of(_flamefruitPool); + BuiltList<LootCard> get axenutPool => BuiltList.of(_axenutPool); + BuiltList<LootCard> get rockrootPool => BuiltList.of(_rockrootPool); + BuiltList<LootCard> get snowthistlePool => BuiltList.of(_snowthistlePool); + + //2 +1, 3 oneIf3or4twoIfNot, 3 oneIf4twoIfNot + + BuiltList<int> get addedCards => BuiltList.of(_addedCards); + List<int> _addedCards = [0, 0, 0, 0, 0, 0, 0, 0, 0]; + Map<String, int> _enhancements = {}; + + final CardStack<LootCard> _drawPile = CardStack<LootCard>(); + final CardStack<LootCard> _discardPile = CardStack<LootCard>(); + + bool get drawPileIsEmpty => _drawPile.isEmpty; + bool get drawPileIsNotEmpty => _drawPile.isNotEmpty; + bool get discardPileIsEmpty => _discardPile.isEmpty; + bool get discardPileIsNotEmpty => _discardPile.isNotEmpty; + LootCard get drawPileTop => _drawPile.peek; + LootCard get discardPileTop => _discardPile.peek; + BuiltList<LootCard> get drawPileContents => BuiltList.of(_drawPile.getList()); + BuiltList<LootCard> get discardPileContents => + BuiltList.of(_discardPile.getList()); + int get drawPileSize => _drawPile.size(); + int get discardPileSize => _discardPile.size(); + + bool get hasCard1418 => _hasCard1418; + bool _hasCard1418 = false; + bool get hasCard1419 => _hasCard1419; + bool _hasCard1419 = false; + + CardStack<LootCard> get drawPileNotifier => _drawPile; + + LootDeck(LootDeckModel model, LootDeck other) { + _hasCard1418 = other._hasCard1418; + _hasCard1419 = other._hasCard1419; + _enhancements = other._enhancements; + + //build deck + _initPools(); + _setDeck(model); + } + + LootDeck.from(LootDeck other) { + _hasCard1418 = other._hasCard1418; + _hasCard1419 = other._hasCard1419; + _enhancements = other._enhancements; + + _initPools(); + } + + LootDeck.empty() { + _initPools(); + } + + LootDeck.fromJson(Map<String, dynamic> lootDeckData) { + updateFromJson(lootDeckData); + } + + /// Updates this deck in-place from [lootDeckData]. + void updateFromJson(Map<String, dynamic> lootDeckData) { + _hasCard1418 = lootDeckData["1418"] as bool; + _hasCard1419 = lootDeckData["1419"] as bool; + + _addedCards = lootDeckData.containsKey('addedCards') + ? List<int>.from(lootDeckData['addedCards'] as List) + : [0, 0, 0, 0, 0, 0, 0, 0, 0]; + + _enhancements = lootDeckData.containsKey('enhancements') + ? Map<String, int>.from(lootDeckData['enhancements'] as Map) + : {}; + + _initPools(); + + LootCard cardFromJson(Map<dynamic, dynamic> item, int fallbackId) { + final String gfx = item["gfx"] as String; + final String owner = item.containsKey('owner') + ? item["owner"] as String + : ""; + final int id = item.containsKey('id') ? item["id"] as int : fallbackId; + + // 'enhanced' was stored as bool in older saves, int in newer ones. + int enhanced = 0; + if (item['enhanced'] is bool) { + enhanced = (item['enhanced'] as bool) ? 1 : 0; + } else if (item['enhanced'] is num) { + enhanced = (item['enhanced'] as num).toInt(); + } + + final baseIdx = item["baseValue"] is int ? item["baseValue"] as int : 0; + final lootTypeIdx = item["lootType"] is int ? item["lootType"] as int : 0; + final LootBaseValue baseValue = + (baseIdx >= 0 && baseIdx < LootBaseValue.values.length) + ? LootBaseValue.values[baseIdx] + : LootBaseValue.values.first; + final LootType lootType = + (lootTypeIdx >= 0 && lootTypeIdx < LootType.values.length) + ? LootType.values[lootTypeIdx] + : LootType.values.first; + + return LootCard( + id: id, + gfx: gfx, + enhanced: enhanced, + baseValue: baseValue, + lootType: lootType, + )..owner = owner; + } + + List<LootCard> newDrawList = []; + List drawPile = lootDeckData["drawPile"] as List; + int id = 0; + for (final item in drawPile) { + if (item.containsKey('id')) id = item["id"] as int; + newDrawList.add(cardFromJson(item as Map, id)); + } + List<LootCard> newDiscardList = []; + for (final item in lootDeckData["discardPile"] as List) { + if (item.containsKey('id')) id = item["id"] as int; + newDiscardList.add(cardFromJson(item as Map, id)); + } + _drawPile.clear(); + _discardPile.clear(); + _drawPile.setList(newDrawList); + _discardPile.setList(newDiscardList); + } + + void setDeck(_StateModifier _, LootDeckModel model) { + _setDeck(model); + } + + void returnLootCard(_StateModifier _, bool top) { + final card = _discardPile.pop(); + card.owner = ""; + if (top) { + _drawPile.push(card); + } else { + _drawPile.insert(0, card); + } + } + + void _addCardFromPool(int amount, List<LootCard> pool, List<LootCard> cards) { + pool.shuffle(); + if (amount > pool.length) { + amount = pool.length; + } + for (int i = 0; i < amount; i++) { + cards.add(pool[i]); + } + pool.sort((a, b) => a.id - b.id); //may not be needed + } + + void _setDeck(LootDeckModel model) { + List<LootCard> cards = []; + + if (_hasCard1419) { + _addOtherType(_kSpecialCard1419, cards, "special 1419"); + } + if (_hasCard1418) { + _addOtherType(_kSpecialCard1418, cards, "special 1418"); + } + + _addCardFromPool(model.arrowvine, _arrowvinePool, cards); + _addCardFromPool(model.corpsecap, _corpsecapPool, cards); + _addCardFromPool(model.axenut, _axenutPool, cards); + _addCardFromPool(model.flamefruit, _flamefruitPool, cards); + _addCardFromPool(model.rockroot, _rockrootPool, cards); + _addCardFromPool(model.snowthistle, _snowthistlePool, cards); + + _addCardFromPool(model.coin, _coinPool, cards); + _addCardFromPool(model.metal, _metalPool, cards); + _addCardFromPool(model.hide, _hidePool, cards); + _addCardFromPool(model.lumber, _lumberPool, cards); + + for (int i = 0; i < model.treasure; i++) { + _addOtherType(_kTreasureCardId, cards, "treasure"); + } + + _drawPile.setList(cards); + _discardPile.setList([]); + _shuffle(); + } + + void _addOtherType(int id, List<LootCard> cards, String gfx) { + cards.add( + LootCard( + id: id, + baseValue: LootBaseValue.one, + enhanced: _enhancements[id.toString()] ?? 0, + lootType: LootType.other, + gfx: gfx, + ), + ); + } + + void _initMaterialPool(int startId, List<LootCard> list, String gfx) { + list.clear(); + for (int i = 0; i < _kMaterialOneCount; i++) { + list.add( + LootCard( + id: startId, + baseValue: LootBaseValue.one, + enhanced: _enhancements[startId.toString()] ?? 0, + lootType: LootType.materiel, + gfx: gfx, + ), + ); + startId++; + } + for (int i = 0; i < _kMaterialTwoCount; i++) { + list.add( + LootCard( + id: startId, + baseValue: LootBaseValue.oneIf3or4twoIfNot, + enhanced: _enhancements[startId.toString()] ?? 0, + lootType: LootType.materiel, + gfx: gfx, + ), + ); + startId++; + } + for (int i = 0; i < _kMaterialTwoCount; i++) { + list.add( + LootCard( + id: startId, + baseValue: LootBaseValue.oneIf4twoIfNot, + enhanced: _enhancements[startId.toString()] ?? 0, + lootType: LootType.materiel, + gfx: gfx, + ), + ); + startId++; + } + } + + void _initHerbPool(int startId, List<LootCard> list, String gfx) { + list.clear(); + for (int i = 0; i < _kHerbPoolCount; i++) { + list.add( + LootCard( + id: startId, + baseValue: LootBaseValue.one, + enhanced: _enhancements[startId.toString()] ?? 0, + lootType: LootType.materiel, + gfx: gfx, + ), + ); + startId++; + } + } + + void _initPools() { + _coinPool = []; + _lumberPool = []; + _hidePool = []; + _metalPool = []; + _axenutPool = []; + _arrowvinePool = []; + _rockrootPool = []; + _flamefruitPool = []; + _snowthistlePool = []; + _corpsecapPool = []; + + int id = 1; + + for (int i = 0; i < _kCoin1Count; i++) { + _addOtherType(id, _coinPool, "coin 1"); + id++; + } + for (int i = 0; i < _kCoin2Count; i++) { + _addOtherType(id, _coinPool, "coin 2"); + id++; + } + _addOtherType(id, _coinPool, "coin 3"); + id++; + _addOtherType(id, _coinPool, "coin 3"); + id++; + + _initMaterialPool(id, _lumberPool, "lumber"); + id += _kMaterialPoolSize; + _initMaterialPool(id, _hidePool, "hide"); + id += _kMaterialPoolSize; + _initMaterialPool(id, _metalPool, "metal"); + id += _kMaterialPoolSize; + _initHerbPool(id, _arrowvinePool, "arrowvine"); + id += _kHerbPoolSize; + _initHerbPool(id, _axenutPool, "axenut"); + id += _kHerbPoolSize; + _initHerbPool(id, _corpsecapPool, "corpsecap"); + id += _kHerbPoolSize; + _initHerbPool(id, _flamefruitPool, "flamefruit"); + id += _kHerbPoolSize; + _initHerbPool(id, _snowthistlePool, "snowthistle"); + id += _kHerbPoolSize; + _initHerbPool(id, _rockrootPool, "rockroot"); + } + + void addSpecial1418(_StateModifier _) { + if (!_hasCard1418) { + _hasCard1418 = true; + _drawPile.add( + LootCard( + id: _kSpecialCard1418, + lootType: LootType.other, + baseValue: LootBaseValue.one, + enhanced: 0, + gfx: "special 1418", + ), + ); + //add directly to current deck and shuffle. save state separately + _shuffle(); + } + } + + void addSpecial1419(_StateModifier _) { + if (!_hasCard1419) { + _hasCard1419 = true; + _drawPile.add( + LootCard( + id: _kSpecialCard1419, + lootType: LootType.other, + baseValue: LootBaseValue.one, + enhanced: 0, + gfx: "special 1419", + ), + ); + _shuffle(); + } + } + + void removeSpecial1418(_StateModifier _) { + _hasCard1418 = false; + _drawPile.removeWhere((element) => element.id == _kSpecialCard1418); + _discardPile.removeWhere((element) => element.id == _kSpecialCard1418); + } + + void removeSpecial1419(_StateModifier _) { + _hasCard1419 = false; + _drawPile.removeWhere((element) => element.id == _kSpecialCard1419); + _discardPile.removeWhere((element) => element.id == _kSpecialCard1419); + } + + List<LootCard> _getAvailableCards(List<LootCard> pool) { + List<LootCard> list = []; + for (final item in pool) { + if (!_drawPile.getList().any((element) => element.id == item.id)) { + list.add(item); + } + } + list.shuffle(); + return list; + } + + void addExtraCard(_StateModifier _, String identifier) { + _initPools(); + _shuffle(); + if (identifier == "hide") { + final pool = _getAvailableCards(_hidePool); + if (pool.isNotEmpty) { + _drawPile.add(pool.first); + _addedCards[0] = _addedCards.first + 1; + } + } + if (identifier == "lumber") { + final pool = _getAvailableCards(_lumberPool); + if (pool.isNotEmpty) { + _drawPile.add(pool.first); + _addedCards[1]++; + } + } + if (identifier == "metal") { + final pool = _getAvailableCards(_metalPool); + if (pool.isNotEmpty) { + _drawPile.add(pool.first); + _addedCards[2]++; + } + } + if (identifier == "arrowvine") { + final pool = _getAvailableCards(_arrowvinePool); + if (pool.isNotEmpty) { + _drawPile.add(pool.first); + _addedCards[3]++; + } + } + if (identifier == "axenut") { + final pool = _getAvailableCards(_axenutPool); + if (pool.isNotEmpty) { + _drawPile.add(pool.first); + _addedCards[4]++; + } + } + if (identifier == "corpsecap") { + final pool = _getAvailableCards(_corpsecapPool); + if (pool.isNotEmpty) { + _drawPile.add(pool.first); + _addedCards[5]++; + } + } + if (identifier == "flamefruit") { + final pool = _getAvailableCards(_flamefruitPool); + if (pool.isNotEmpty) { + _drawPile.add(pool.first); + _addedCards[6]++; + } + } + if (identifier == "rockroot") { + final pool = _getAvailableCards(_rockrootPool); + if (pool.isNotEmpty) { + _drawPile.add(pool.first); + _addedCards[7]++; + } + } + if (identifier == "snowthistle") { + final pool = _getAvailableCards(_snowthistlePool); + if (pool.isNotEmpty) { + _drawPile.add(pool.first); + _addedCards[8]++; + } + } + _shuffle(); + } + + void addEnhancement( + _StateModifier _, + int id, + int value, { + GameState? gameState, + GameData? gameData, + }) { + _enhancements[id.toString()] = value; + //reset loot deck + _initPools(); + final gs = gameState ?? getIt<GameState>(); + final gd = gameData ?? getIt<GameData>(); + String scenario = gs.scenario; + LootDeckModel? lootDeckModel = + gd.modelData[gs.currentCampaign]?.scenarios[scenario]?.lootDeck; + if (lootDeckModel != null) { + _setDeck(lootDeckModel); + } + } + + void _shuffle() { + while (_discardPile.isNotEmpty) { + LootCard card = _discardPile.pop(); + _drawPile.push(card); + } + _drawPile.shuffle(); + } + + void draw(_StateModifier _, {GameState? gameState}) { + //put top of draw pile on discard pile + LootCard card = _drawPile.pop(); + + //mark owner + final gs = gameState ?? getIt<GameState>(); + for (final item in gs.currentList) { + if (item.turnState == TurnsState.current && item is Character) { + if (!GameMethods.isObjectiveOrEscort(item.characterClass)) { + card.owner = item.characterClass.id; + break; + } + } + } + + _discardPile.push(card); + } + + Map<String, dynamic> toJson() => { + 'drawPile': _drawPile.getList().map((c) => c.toJson()).toList(), + 'discardPile': _discardPile.getList().map((c) => c.toJson()).toList(), + 'addedCards': _addedCards, + 'enhancements': _enhancements, + '1418': _hasCard1418, + '1419': _hasCard1419, + }; + + @override + String toString() => json.encode(toJson()); +} + +enum LootType { materiel, other } + +enum LootBaseValue { one, oneIf4twoIfNot, oneIf3or4twoIfNot } diff --git a/server/lib/core/state/modifier_deck.dart b/server/lib/core/state/modifier_deck.dart new file mode 100644 index 0000000..6575e01 --- /dev/null +++ b/server/lib/core/state/modifier_deck.dart @@ -0,0 +1,758 @@ +part of 'game_state.dart'; + +// ignore_for_file: library_private_types_in_public_api + +class ModifierDeck { + static const int _kImbuementLevel1 = 1; + static const int _kImbuementLevel2 = 2; + static const int _kPlusMinus1Count = 5; + static const int _kPlus0Count = 6; + static const int _kCursePosition = 5; + + final String name; + final CardStack<ModifierCard> _drawPile = CardStack<ModifierCard>(); + final CardStack<ModifierCard> _discardPile = CardStack<ModifierCard>(); + final CardStack<ModifierCard> _removedPile = CardStack<ModifierCard>(); + final Map<String, int> _removables = { + "curse": 0, + "bless": 0, + "in-enfeeble": 0, + "vi-enfeeble": 0, + "vi-gr-enfeeble": 0, + "li-enfeeble": 0, + "in-empower": 0, + "rm-empower": 0, + "vi-empower": 0, + "vi-gr-empower": 0, + }; + + /// Removable gfx keys that get physical draw-pile card sync. In the + /// reference app this is exactly the set of counters that have a + /// `_handleRemovableCards` listener attached in `_initListeners()`, i.e. the + /// keys present at construction. Entries added later by `getRemovable()` + /// (e.g. "enfeeble") never trigger physical card sync. + final Set<String> _syncedRemovables = {}; + + int _badOmen = 0; + bool _corrosiveSpew = false; + int _addedMinusOnes = 0; + int _imbuement = 0; + + int _revealedCount = 0; + bool _cassandraSpecial = false; + + bool _needsShuffle = false; + bool get needsShuffle => _needsShuffle; + + BuiltList<ModifierCard> get drawPileContents => + BuiltList.of(_drawPile.getList()); + BuiltList<ModifierCard> get discardPileContents => + BuiltList.of(_discardPile.getList()); + BuiltList<ModifierCard> get removedPileContents => + BuiltList.of(_removedPile.getList()); + bool get drawPileIsEmpty => _drawPile.isEmpty; + bool get drawPileIsNotEmpty => _drawPile.isNotEmpty; + bool get discardPileIsEmpty => _discardPile.isEmpty; + bool get discardPileIsNotEmpty => _discardPile.isNotEmpty; + int get drawPileSize => _drawPile.size(); + int get discardPileSize => _discardPile.size(); + int get removedPileSize => _removedPile.size(); + ModifierCard get discardPileTop => _discardPile.peek; + ModifierCard get drawPileTop => _drawPile.peek; + + CardStack<ModifierCard> get drawPileNotifier => _drawPile; + int get badOmen => _badOmen; + bool get corrosiveSpew => _corrosiveSpew; + int get addedMinusOnes => _addedMinusOnes; + int get imbuement => _imbuement; + int get revealedCount => _revealedCount; + bool get cassandraSpecial => _cassandraSpecial; + + ModifierDeck(this.name) { + //build deck + _initDeck(); + _initListeners(); + } + + ModifierDeck.fromJson(this.name, Map<String, dynamic> modifierDeckData) { + _initDeck(); + _initListeners(); + updateFromJson(modifierDeckData); + } + + /// Resets this deck to the default 20-card state. + void resetToDefault() { + _initDeck(); + _cassandraSpecial = false; + } + + /// Updates this deck in-place from [modifierDeckData]. + void updateFromJson(Map<String, dynamic> modifierDeckData) { + // Reset removable counts first (the piles are fully replaced below + // anyway, so no physical card sync is needed here). + for (final key in _removables.keys) { + _removables[key] = 0; + } + _needsShuffle = false; + + for (final item in modifierDeckData["drawPile"] as List) { + String gfx = item["gfx"]; + if (gfx == "curse" || + gfx.contains("empower") || + gfx.contains("enfeeble") || + gfx == "bless") { + addRemovableValue(_StateModifier(), gfx, 1); + } + } + for (final item in modifierDeckData["discardPile"] as List) { + String gfx = item["gfx"]; + if (_isMultiplyType(gfx)) { + _needsShuffle = true; + } + } + + _drawPile.clear(); + _discardPile.clear(); + _removedPile.clear(); + _drawPile.setList(_getCardsFromJson(modifierDeckData, "drawPile")); + _discardPile.setList(_getCardsFromJson(modifierDeckData, "discardPile")); + if (modifierDeckData.containsKey('removedPile')) { + _removedPile.setList(_getCardsFromJson(modifierDeckData, "removedPile")); + } + + _imbuement = modifierDeckData.containsKey("imbuement") + ? modifierDeckData['imbuement'] as int + : 0; + _badOmen = modifierDeckData.containsKey('badOmen') + ? modifierDeckData["badOmen"] as int + : 0; + _corrosiveSpew = modifierDeckData.containsKey('corrosiveSpew') + ? modifierDeckData["corrosiveSpew"] as bool + : false; + _revealedCount = min( + modifierDeckData.containsKey('revealed') + ? modifierDeckData["revealed"] as int + : 0, + drawPileSize, + ); + _cassandraSpecial = modifierDeckData.containsKey('cassandra') + ? modifierDeckData["cassandra"] as bool + : false; + _addedMinusOnes = modifierDeckData.containsKey('addedMinusOnes') + ? modifierDeckData["addedMinusOnes"] as int + : 0; + } + + void setRemovableValue(_StateModifier _, String id, int value) { + if (_removables.containsKey(id)) { + _removables[id] = value; + if (_syncedRemovables.contains(id)) { + _handleRemovableCards(value, id); + } + } + } + + void addRemovableValue(_StateModifier _, String id, int value) { + final current = _removables[id]; + if (current != null) { + final newValue = current + value; + _removables[id] = newValue; + if (_syncedRemovables.contains(id)) { + _handleRemovableCards(newValue, id); + } + } + } + + int getRemovable(String id) { + _removables[id] ??= 0; + return _removables[id] ?? 0; + } + + void moveCardToRemovedPile(_StateModifier s, String gfx) { + if (hasCard(gfx)) { + removeCard(s, gfx); + _removedPile.add(ModifierCard(CardType.add, gfx)); + } + } + + void restoreCardFromRemovedPile(_StateModifier s, String gfx, CardType type) { + addCard(s, gfx, type); + _removedPile.removeFirstWhere((card) => card.gfx == gfx); + } + + void setBadOmen(_StateModifier _, int value) { + _badOmen = value; + } + + void setCorrosiveSpew(_StateModifier _) { + _corrosiveSpew = true; + } + + void addCSSanctuary(_StateModifier s, {GameState? gameState}) { + //adds one of each + final gs = gameState ?? getIt<GameState>(); + _drawPile.add(gs._sanctuaryDeck.drawFlip(s)); + _drawPile.add(gs._sanctuaryDeck.drawMult(s)); + _drawPile.shuffle(); + } + + void removeCSSanctuary(_StateModifier _, {GameState? gameState}) { + var list = _drawPile.getList(); + final gs = gameState ?? getIt<GameState>(); + for (int i = list.length - 1; i >= 0; i--) { + if (list[i].gfx.startsWith("sanctuary")) { + gs._sanctuaryDeck.returnCard(list[i].gfx); + _drawPile.removeAt(i); + } + } + list = _discardPile.getList(); + for (int i = list.length - 1; i >= 0; i--) { + if (list[i].gfx.startsWith("sanctuary")) { + gs._sanctuaryDeck.returnCard(list[i].gfx); + _discardPile.removeAt(i); + } + } + } + + bool hasCSSanctuary() { + if (_drawPile.getList().firstWhereOrNull((test) { + return test.gfx.startsWith("sanctuary"); + }) != + null || + _discardPile.getList().firstWhereOrNull((test) { + return test.gfx.startsWith("sanctuary"); + }) != + null) { + return true; + } + return false; + } + + void addCSPartyCard(_StateModifier s, int type) { + addCard(s, "party/$type", CardType.remove); + } + + void removeCSPartyCard(_StateModifier _) { + _drawPile.removeWhere((test) { + return test.gfx.startsWith("party/"); + }); + _discardPile.removeWhere((test) { + return test.gfx.startsWith("party/"); + }); + } + + bool hasPartyCard() { + if (_drawPile.getList().firstWhereOrNull((test) { + return test.gfx.startsWith("party/"); + }) != + null || + _discardPile.getList().firstWhereOrNull((test) { + return test.gfx.startsWith("party/"); + }) != + null) { + return true; + } + return false; + } + + void addHailSpecial(_StateModifier s) { + addCard(s, "special/hail", CardType.add); + } + + void removeHailSpecial(_StateModifier s) { + removeCard(s, "special/hail"); + } + + void revealCards(_StateModifier _, int amount) { + _revealedCount = amount; + } + + void setCassandraSpecial(_StateModifier _, bool on) { + _cassandraSpecial = on; + } + + bool hasHail() { + if (_discardPile.getList().firstWhereOrNull( + (item) => item.gfx == "special/hail", + ) != + null) { + return true; + } + if (_drawPile.getList().firstWhereOrNull( + (item) => item.gfx == "special/hail", + ) != + null) { + return true; + } + return false; + } + + void addMinusOne(_StateModifier _) { + _addedMinusOnes++; + _drawPile.insert(0, ModifierCard(CardType.add, "minus1")); + _shuffleDrawPileRespectCassandra(); + _revealedCount = 0; + if (_addedMinusOnes < 0) { + //do not add/remove extra minus ones to removed pile + _removedPile.removeFirstWhere((item) => item.gfx == "minus1"); + } + } + + void removeMinusOne(_StateModifier _) { + _shuffle(); + + final card = _removeCardFromDrawPile("minus1"); + if (card != null) { + _addedMinusOnes--; + if (_addedMinusOnes < 0) { + _removedPile.add(card); + } + } + } + + bool hasMinus1() { + return _drawPile.getList().firstWhereOrNull( + (element) => element.gfx == "minus1", + ) != + null || + _discardPile.getList().firstWhereOrNull( + (element) => element.gfx == "minus1", + ) != + null; + } + + bool hasMinus2() { + return !(_removedPile.getList().firstWhereOrNull( + (element) => element.gfx == "minus2", + ) != + null); + } + + bool hasNull() { + return _drawPile.getList().firstWhereOrNull( + (element) => element.gfx == "nullAttack", + ) != + null || + _discardPile.getList().firstWhereOrNull( + (element) => element.gfx == "nullAttack", + ) != + null; + } + + void removeNull(_StateModifier _) { + _shuffle(); + final card = _removeCardFromDrawPile("nullAttack"); + if (card != null) { + _removedPile.add(card); + } + } + + void addNull(_StateModifier _) { + _drawPile.add(ModifierCard(CardType.multiply, "nullAttack")); + _removedPile.removeFirstWhere((item) => item.gfx == "nullAttack"); + _shuffle(); + } + + bool hasCard(String gfx) { + final drawPileHas = + _drawPile.getList().firstWhereOrNull((test) => test.gfx == gfx) != null; + final discardPileHas = + _discardPile.getList().firstWhereOrNull((test) => test.gfx == gfx) != + null; + return (drawPileHas || discardPileHas); + } + + void removeCard(_StateModifier _, String gfx) { + _shuffle(); + _removeCardFromDrawPile(gfx); + _shuffle(); + } + + void removeCardFromDiscard(_StateModifier _, int index) { + final card = _discardPile.removeAt(index); + _removedPile.add(card); + if (card.gfx == "minus1") { + _addedMinusOnes--; + } + } + + void removeCardFromDrawPile(_StateModifier _, int index) { + final card = _drawPile.removeAt(index); + _removedPile.add(card); + if (card.gfx == "minus1") { + _addedMinusOnes--; + } + if (_revealedCount > _drawPile.size() - 1 - index) { + _revealedCount--; + } + } + + void returnCardToDiscard(_StateModifier _, int index) { + final card = _removedPile.removeAt(index); + _discardPile.add(card); + if (card.gfx == "minus1") { + _addedMinusOnes++; + } + } + + void returnCardToDrawPileFromRemoved(_StateModifier _, int index) { + final card = _removedPile.removeAt(index); + _drawPile.add(card); + _revealedCount++; + if (card.gfx == "minus1") { + _addedMinusOnes++; + } + } + + void returnCardToDrawPile(_StateModifier _) { + final card = _discardPile.pop(); + _drawPile.push(card); + //todo: how to tell if revealed should change? if it is over 0? + } + + void addCard(_StateModifier _, String id, CardType type) { + _drawPile.add(ModifierCard(type, id)); + _shuffle(); + } + + void removeMinusTwo(_StateModifier _) { + _shuffle(); + final card = _removeCardFromDrawPile("minus2"); + if (card != null) { + _removedPile.add(card); + } + } + + void addMinusTwo(_StateModifier _) { + _drawPile.add(ModifierCard(CardType.add, "minus2")); + _removedPile.removeFirstWhere((item) => item.gfx == "minus2"); + _shuffle(); + } + + void setImbue1(_StateModifier _) { + assert(name.isEmpty); //only basic deck for this feature + + _shuffle(); + _removeCardFromDrawPile("minus1"); + _removeCardFromDrawPile("minus1"); + _removeCardFromDrawPile("minus1"); + _drawPile.add(ModifierCard(CardType.add, "imbue-plus1")); + _drawPile.add(ModifierCard(CardType.add, "imbue-plus1")); + _drawPile.add(ModifierCard(CardType.add, "imbue-plus1")); + _drawPile.add(ModifierCard(CardType.add, "imbue-plus2muddle")); + _drawPile.add(ModifierCard(CardType.add, "imbue-plus0poison")); + _shuffle(); + _imbuement = _kImbuementLevel1; + } + + void setImbue2(_StateModifier m) { + assert(name.isEmpty); //only basic deck for this feature + + if (_imbuement == 0) { + setImbue1(m); + } + + _shuffle(); + _removeCardFromDrawPile("minus2"); + _removeCardFromDrawPile("plus0"); + _removeCardFromDrawPile("plus0"); + + _drawPile.add(ModifierCard(CardType.add, "imbue2-plus3")); + _drawPile.add(ModifierCard(CardType.add, "imbue2-plus1heal1")); + _drawPile.add(ModifierCard(CardType.add, "imbue2-plus1heal1")); + _drawPile.add(ModifierCard(CardType.add, "imbue2-plus1curse")); + _drawPile.add(ModifierCard(CardType.add, "imbue2-plus0wound")); + _shuffle(); + _imbuement = _kImbuementLevel2; + } + + void resetImbue(_StateModifier _) { + assert(name.isEmpty); //only basic deck for this feature + + if (_imbuement != 0) { + _shuffle(); + _drawPile.removeWhere((element) => element.gfx.startsWith("imbue")); + + _drawPile.add(ModifierCard(CardType.add, "minus1")); + _drawPile.add(ModifierCard(CardType.add, "minus1")); + _drawPile.add(ModifierCard(CardType.add, "minus1")); + if (_imbuement == _kImbuementLevel2) { + if (hasMinus2()) { + //if minus2 has not been separately removed + _drawPile.add(ModifierCard(CardType.add, "minus2")); + } + _drawPile.add(ModifierCard(CardType.add, "plus0")); + _drawPile.add(ModifierCard(CardType.add, "plus0")); + } + _imbuement = 0; + _shuffle(); + } + } + + void shuffle(_StateModifier _) { + if (_cassandraSpecial) { + //dont shuffle the revealed cards + _shuffleOnlyBelowRevealed(); + } else { + _shuffle(); + } + } + + void shuffleUnDrawn(_StateModifier _) { + _drawPile.shuffle(); + _revealedCount = 0; + } + + void draw(_StateModifier _) { + if (_revealedCount > 0) { + _revealedCount--; + } + //shuffle deck, for the case the deck ends during play + if (_drawPile.isEmpty) { + _shuffle(); + } + //put top of draw pile on discard pile + if (_drawPile.isNotEmpty) { + ModifierCard card = _drawPile.pop(); + if (card.type == CardType.multiply) { + _needsShuffle = true; + } + + if (_removables[card.gfx] != null) { + addRemovableValue(_StateModifier(), card.gfx, -1); + } + _discardPile.push(card); + } + } + + void reorderCards(_StateModifier s, int newIndex, int oldIndex) { + List<ModifierCard> list = List.of(_drawPile.getList()); + final item = list.removeAt(oldIndex); + list.insert(newIndex, item); + _drawPile.setList(list); + + //if rearranging between revealed and unrevealed then un-reveal everything below the unknown moved card. + final revertOldIndex = _drawPile.size() - oldIndex; + final revertNewIndex = _drawPile.size() - newIndex; + if (revertOldIndex <= revealedCount && revertNewIndex > revealedCount) { + //moving one revealed card to unrevealed area - hide one + revealCards(s, revealedCount - 1); + } + if (revertNewIndex <= revealedCount && revertOldIndex > revealedCount) { + //hide new index card and those below + revealCards(s, revertNewIndex - 1); + } + } + + Map<String, dynamic> toJson() => { + 'addedMinusOnes': _addedMinusOnes, + 'imbuement': _imbuement, + 'badOmen': _badOmen, + 'corrosiveSpew': _corrosiveSpew, + 'revealed': _revealedCount, + 'cassandra': _cassandraSpecial, + 'drawPile': _drawPile.getList().map((c) => c.toJson()).toList(), + 'removedPile': _removedPile.getList().map((c) => c.toJson()).toList(), + 'discardPile': _discardPile.getList().map((c) => c.toJson()).toList(), + }; + + @override + String toString() => json.encode(toJson()); + + void _initListeners() { + // UI-only in the reference app. In the reference this attached the + // _handleRemovableCards listener to each counter notifier, so physical + // card sync only ever happened for the keys present here (always the ten + // initial ones); record that set for set/addRemovableValue. + _syncedRemovables + ..clear() + ..addAll(_removables.keys); + } + + List<ModifierCard> _getCardsFromJson( + Map<String, dynamic> modifierDeckData, + String deckId, + ) { + List<ModifierCard> newList = []; + for (final item in modifierDeckData[deckId] as List) { + String gfx = item["gfx"]; + gfx = gfx.replaceAll("-allies", ""); + if (gfx == "curse") { + newList.add(ModifierCard(CardType.remove, gfx)); + } else if (gfx.contains("enfeeble")) { + if (gfx == "enfeeble") { + //if updating from old version + gfx = "in-enfeeble"; + } + newList.add(ModifierCard(CardType.remove, gfx)); + } else if (gfx.contains("empower")) { + newList.add(ModifierCard(CardType.remove, gfx)); + } else if (gfx == "bless") { + newList.add(ModifierCard(CardType.remove, gfx)); + } else if (_isMultiplyType(gfx)) { + newList.add(ModifierCard(CardType.multiply, gfx)); + } else { + newList.add(ModifierCard(CardType.add, gfx)); + } + } + return newList; + } + + void _initDeck() { + List<ModifierCard> cards = []; + cards.add(ModifierCard(CardType.add, "minus2")); + cards.add(ModifierCard(CardType.add, "plus2")); + cards.add(ModifierCard(CardType.multiply, "doubleAttack")); + cards.add(ModifierCard(CardType.multiply, "nullAttack")); + for (int i = 0; i < _kPlusMinus1Count; i++) { + cards.add(ModifierCard(CardType.add, "minus1")); + cards.add(ModifierCard(CardType.add, "plus1")); + } + for (int i = 0; i < _kPlus0Count; i++) { + cards.add(ModifierCard(CardType.add, "plus0")); + } + _drawPile.setList(cards); + _discardPile.setList([]); + _removedPile.setList([]); + _shuffle(); + _badOmen = 0; + _corrosiveSpew = false; + _addedMinusOnes = 0; + _imbuement = 0; + _needsShuffle = false; + for (final item in _removables.keys) { + _removables[item] = 0; + } + } + + ModifierCard? _removeCardFromDrawPile(String gfx) { + final card = _drawPile.getList().lastWhereOrNull( + (element) => element.gfx == gfx, + ); + if (card != null) { + _drawPile.remove(card); + _drawPile.shuffle(); + } + return card; + } + + /// Syncs the physical removable cards in the draw pile with the + /// [notifierValue] stored in [_removables] for [gfx]. In the reference app + /// this ran as a listener on the removable counter notifiers; it is now + /// called directly from [setRemovableValue] and [addRemovableValue]. + void _handleRemovableCards(int notifierValue, String gfx) { + //count and add or remove, then shuffle + int count = 0; + bool shuffle = true; + for (final item in _drawPile.getList()) { + if (item.gfx == gfx) { + count++; + } + } + if (count == notifierValue) { + shuffle = false; + } else if (count < notifierValue) { + for (int i = count; i < notifierValue; i++) { + if (gfx == "rm-empower" && corrosiveSpew) { + shuffle = false; + //put on top + //_drawPile.insert(0, ModifierCard(CardType.remove, gfx)); + _drawPile.push(ModifierCard(CardType.remove, gfx)); + } else if (gfx == "curse" && _badOmen > 0) { + _badOmen--; + shuffle = false; + //put in sixth or as far down as it goes. + int position = _kCursePosition; + final size = _drawPile.getList().length; + if (size < _kPlus0Count) { + position = size; + } + _drawPile.insert(size - position, ModifierCard(CardType.remove, gfx)); + } else { + _drawPile.insert(0, ModifierCard(CardType.remove, gfx)); + } + } + } else { + int toRemove = count - notifierValue; + for (int i = 0; i < toRemove; i++) { + _drawPile.removeFirstWhere((card) => card.gfx == gfx); + } + } + if (shuffle) { + _shuffleDrawPileRespectCassandra(); + } + } + + void _shuffle() { + while (_discardPile.isNotEmpty) { + ModifierCard card = _discardPile.pop(); + //remove curse and bless + if (card.type != CardType.remove) { + _drawPile.push(card); + } + } + _drawPile.shuffle(); + + _needsShuffle = false; + _revealedCount = 0; + } + + void _shuffleOnlyBelowRevealed() { + final revealCount = _revealedCount; + List<ModifierCard> revealed = []; + for (int i = 0; i < _revealedCount; i++) { + revealed.insert(0, _drawPile.pop()); + } + _shuffle(); + _revealedCount = revealCount; + for (int i = 0; i < _revealedCount; i++) { + _drawPile.add(revealed[i]); + } + } + + void _shuffleDrawPileRespectCassandra() { + if (_cassandraSpecial) { + //dont shuffle the revealed cards + List<ModifierCard> revealed = []; + for (int i = 0; i < _revealedCount; i++) { + revealed.insert(0, _drawPile.pop()); + } + _drawPile.shuffle(); + for (int i = 0; i < _revealedCount; i++) { + _drawPile.add(revealed[i]); + } + } else { + _revealedCount = 0; + _drawPile.shuffle(); + } + } + + bool _isMultiplyType(String gfx) { + if (gfx.contains("nullAttack") || gfx.contains("doubleAttack")) { + return true; + } + if (gfx == "P4" && name == "Nightshroud") { + if (GameMethods.getCharacterByName( + "Nightshroud", + )?.characterClass.edition == + "Gloomhaven 2nd Edition") { + return true; + } + } + return false; + } +} + +enum CardType { add, multiply, remove } + +class ModifierCard { + final CardType type; + final String gfx; + + ModifierCard(this.type, this.gfx); + + Map<String, dynamic> toJson() => {'gfx': gfx}; + + @override + String toString() => '{"gfx": "$gfx" }'; +} diff --git a/server/lib/core/state/monster.dart b/server/lib/core/state/monster.dart new file mode 100644 index 0000000..6ed3f67 --- /dev/null +++ b/server/lib/core/state/monster.dart @@ -0,0 +1,198 @@ +part of 'game_state.dart'; + +// ignore_for_file: library_private_types_in_public_api + +class Monster extends ListItemData { + Monster(String name, int level, this._isAlly, {GameData? gameData}) + : type = _findType(name, gameData) { + id = name; + _level = level; + _addAbilityDeck(); + } + + static MonsterModel _findType(String name, GameData? gameData) { + final gd = gameData ?? getIt<GameData>(); + for (final key in gd.modelData.keys) { + final campaign = gd.modelData[key]; + if (campaign == null) continue; + if (campaign.monsters.containsKey(name)) { + final model = campaign.monsters[name]; + if (model != null) return model; + } + } + throw StateError('Monster model not found: $name'); + } + + MonsterModel type; + final List<MonsterInstance> _monsterInstances = []; + final BuiltList<MonsterInstance> _monsterInstancesNotifier = BuiltList.of([]); + int _level = 0; + bool _isAlly; + bool _isActive = false; + int _version = 0; + + int get level => _level; + bool get isAlly => _isAlly; + + //note: this is only used for the no standee tracking setting + bool get isActive => _isActive; + + BuiltList<MonsterInstance> get monsterInstances => + BuiltList.of(_monsterInstances); + BuiltList<MonsterInstance> get monsterInstancesNotifier => + _monsterInstancesNotifier; + + void _notifyMonsterInstances() { + // UI-only in the reference app + } + + /// Public guarded notify. The per-instance notification was UI-only in the + /// reference app; kept as a no-op hook for API compatibility. + void notifyMonsterInstances(_StateModifier _) { + _notifyMonsterInstances(); + } + + Monster.fromJson(Map<String, dynamic> json, {GameData? gameData}) + : _isAlly = false, + type = _findType(json['type'] as String, gameData) { + id = json['id']; + final turnStateIdx = json['turnState'] as int?; + if (turnStateIdx != null && + turnStateIdx >= 0 && + turnStateIdx < TurnsState.values.length) { + _turnState = TurnsState.values[turnStateIdx]; + } + if (json.containsKey("note")) { + _note = json["note"] as String; + } + _level = json['level']; + if (json.containsKey("isAlly")) { + _isAlly = json['isAlly']; + } + if (json.containsKey("isActive")) { + _isActive = json['isActive']; + } + + List<Object?> instanceList = json["monsterInstances"] as List<Object?>; + + _monsterInstances.clear(); + for (Map<String, dynamic> item + in instanceList.cast<Map<String, dynamic>>()) { + _monsterInstances.add(MonsterInstance.fromJson(item)); + } + + //fixing update issue, when _isActive is repurposed to work even with standees + if (_monsterInstances.isNotEmpty && !_isActive) { + if (!json.containsKey("v")) { + _isActive = true; + } + } + if (json.containsKey("v")) { + _version = json['v']; + } + _notifyMonsterInstances(); + } + + /// Updates all mutable fields in-place from [json]. + void updateFromJson(Map<String, dynamic> json) { + final turnStateIdx = json['turnState'] as int?; + if (turnStateIdx != null && + turnStateIdx >= 0 && + turnStateIdx < TurnsState.values.length) { + _turnState = TurnsState.values[turnStateIdx]; + } + _note = json.containsKey("note") ? json["note"] as String : ""; + _level = json['level'] as int; + if (json.containsKey("isAlly")) { + _isAlly = json['isAlly'] as bool; + } + if (json.containsKey("isActive")) { + _isActive = json['isActive'] as bool; + } + + _monsterInstances.clear(); + for (Map<String, dynamic> item in json["monsterInstances"] as List) { + _monsterInstances.add(MonsterInstance.fromJson(item)); + } + + // Backwards-compat: set isActive when instances exist but version flag absent. + if (_monsterInstances.isNotEmpty && !_isActive) { + if (!json.containsKey("v")) { + _isActive = true; + } + } + if (json.containsKey("v")) { + _version = json['v'] as int; + } + _notifyMonsterInstances(); + } + + void setMonsterInstances(_StateModifier _, List<MonsterInstance> instances) { + _monsterInstances.clear(); + _monsterInstances.addAll(instances); + } + + void clearMonsterInstances(_StateModifier _) { + _monsterInstances.clear(); + } + + void sortMonsterInstances(_StateModifier s) { + RoundMethods.sortMonsterInstances(s, _monsterInstances); + } + + void setActive(_StateModifier _, bool value) { + _isActive = value; + } + + bool hasElites() { + for (final instance in _monsterInstances) { + if (instance.type == MonsterType.elite) { + return true; + } + } + return false; + } + + //includes boss + bool hasNormal() { + for (final instance in _monsterInstances) { + if (instance.type != MonsterType.elite) { + return true; + } + } + return false; + } + + void setLevel(_StateModifier _, int level) { + _level = level; + for (final item in _monsterInstances) { + item._setLevel(this); + } + } + + @override + Map<String, dynamic> toJson() => { + 'id': id, + 'turnState': turnState.index, + 'note': note, + 'isActive': isActive, + 'type': type.name, + 'monsterInstances': _monsterInstances.map((m) => m.toJson()).toList(), + 'isAlly': isAlly, + 'v': _version, + 'level': level, + }; + + @override + String toString() => json.encode(toJson()); + + void _addAbilityDeck({GameState? gameState}) { + final gs = gameState ?? getIt<GameState>(); + for (MonsterAbilityState deck in gs.currentAbilityDecks) { + if (deck.name == type.deck) { + return; + } + } + gs._currentAbilityDecks.add(MonsterAbilityState(type.deck)); + } +} diff --git a/server/lib/core/state/monster_ability_state.dart b/server/lib/core/state/monster_ability_state.dart new file mode 100644 index 0000000..161a063 --- /dev/null +++ b/server/lib/core/state/monster_ability_state.dart @@ -0,0 +1,98 @@ +part of 'game_state.dart'; + +// ignore_for_file: library_private_types_in_public_api + +class MonsterAbilityState { + final String name; + + int drawPileVersion = 0; + + final CardStack<MonsterAbilityCardModel> _drawPile = + CardStack<MonsterAbilityCardModel>(); + final CardStack<MonsterAbilityCardModel> _discardPile = + CardStack<MonsterAbilityCardModel>(); + + int get lastRoundDrawn => _lastRoundDrawn; + int _lastRoundDrawn = 0; + + BuiltList<MonsterAbilityCardModel> get drawPileContents => + BuiltList.of(_drawPile.getList()); + BuiltList<MonsterAbilityCardModel> get discardPileContents => + BuiltList.of(_discardPile.getList()); + bool get drawPileIsEmpty => _drawPile.isEmpty; + bool get drawPileIsNotEmpty => _drawPile.isNotEmpty; + bool get discardPileIsEmpty => _discardPile.isEmpty; + bool get discardPileIsNotEmpty => _discardPile.isNotEmpty; + MonsterAbilityCardModel get drawPileTop => _drawPile.peek; + MonsterAbilityCardModel get discardPileTop => _discardPile.peek; + int get drawPileSize => _drawPile.size(); + int get discardPileSize => _discardPile.size(); + + MonsterAbilityState(this.name, {GameData? gameData}) { + final gd = gameData ?? getIt<GameData>(); + + List<MonsterAbilityDeckModel> monsters = []; + for (String key in gd.modelData.keys) { + monsters.addAll(gd.modelData[key]?.monsterAbilities ?? []); + } + for (MonsterAbilityDeckModel model in monsters) { + if (name == model.name) { + _drawPile.init(model.cards); + _shuffle(); + break; + } + } + + _lastRoundDrawn = 0; + } + + void shuffle(_StateModifier _) { + _shuffle(); + drawPileVersion++; + } + + void shuffleUnDrawn(_StateModifier _) { + _drawPile.shuffle(); + drawPileVersion++; + } + + void removeFromDrawPile(_StateModifier _, MonsterAbilityCardModel card) { + _drawPile.remove(card); + drawPileVersion++; + } + + void removeFromDiscardPile(_StateModifier _, MonsterAbilityCardModel card) { + _discardPile.remove(card); + } + + void reorderDrawPile(_StateModifier _, int oldIndex, int newIndex) { + final list = _drawPile.getList(); + list.insert(newIndex, list.removeAt(oldIndex)); + _drawPile.setList(list); + } + + void _shuffle() { + while (_discardPile.isNotEmpty) { + _drawPile.push(_discardPile.pop()); + } + _drawPile.shuffle(); + } + + void draw(_StateModifier _, {GameState? gameState}) { + //put top of draw pile on discard pile + if (_drawPile.isNotEmpty) { + _discardPile.push(_drawPile.pop()); + } + _lastRoundDrawn = (gameState ?? getIt<GameState>()).totalRounds; + } + + Map<String, dynamic> toJson() => { + 'name': name, + 'drawPile': _drawPile.getList().map((c) => c.toJson()).toList(), + 'discardPile': _discardPile.getList().map((c) => c.toJson()).toList(), + 'lastRoundDrawn': lastRoundDrawn, + }; + + @override + String toString() => json.encode(toJson()); +} diff --git a/server/lib/core/state/monster_instance.dart b/server/lib/core/state/monster_instance.dart new file mode 100644 index 0000000..a3fde0c --- /dev/null +++ b/server/lib/core/state/monster_instance.dart @@ -0,0 +1,198 @@ +part of 'game_state.dart'; + +// ignore_for_file: library_private_types_in_public_api + +class MonsterInstance extends FigureState { + static const int _kIncarnateHealthMultiplier = 2; + MonsterInstance( + this.standeeNr, + this._type, + bool summoned, + Monster monster, { + GameState? gameState, + }) { + _setLevel(monster); + gfx = monster.type.gfx; + name = monster.type.name; + move = 0; //only used for summons + attack = 0; + range = 0; + _roundSummoned = summoned ? (gameState ?? getIt<GameState>()).round : -1; + } + + MonsterInstance.summon( + this.standeeNr, + this._type, + this.name, + int summonHealth, + this.move, + this.attack, + this.range, + this.gfx, + this._roundSummoned, + ) { + //deal with summon init + _maxHealth = summonHealth; + _health = summonHealth; + } + + String getId() { + return name + gfx + standeeNr.toString(); + } + + int standeeNr = 0; + + void setType(_StateModifier _, MonsterType value) { + _type = value; + } + + MonsterType get type => _type; + MonsterType _type = + MonsterType.normal; //can't be final due to ice wraith special + String name = ''; + String gfx = ''; + + //summon stats. not used currently + int move = 0; + int attack = 0; + int range = 0; + + int get roundSummoned => _roundSummoned; + void setRoundSummoned(_StateModifier _, int value) { + _roundSummoned = value; + } + + int _roundSummoned = -1; + + void _setLevel(Monster monster, {GameState? gameState}) { + StatValue newHealthValue = const IntStatValue( + 10, + ); //need to put something outer than 0 or the standee will die immediately causing glitch + final levels = monster.type.levels; + final levelIndex = levels.isEmpty + ? -1 + : monster.level.clamp(0, levels.length - 1); + if (levelIndex >= 0) { + if (type == MonsterType.boss) { + newHealthValue = levels[levelIndex].boss?.health ?? newHealthValue; + } else if (type == MonsterType.elite) { + newHealthValue = levels[levelIndex].elite?.health ?? newHealthValue; + } else if (type == MonsterType.normal) { + newHealthValue = levels[levelIndex].normal?.health ?? newHealthValue; + } + } + int? value = StatCalculator.calculateFormula(newHealthValue); + if (value != null) { + _maxHealth = value; + } else { + final gs = gameState ?? getIt<GameState>(); + //handle edge case + if (newHealthValue is FormulaStatValue && + newHealthValue.formula == "Hollowpact") { + int value = 7; + for (final item in gs.currentList) { + if (item is Character && item.id == "Hollowpact") { + final healthByLevel = item.characterClass.healthByLevel; + final level = item.characterState.level; + if (level >= 1 && level <= healthByLevel.length) { + value = healthByLevel[level - 1]; + } + break; + } + } + _maxHealth = value; + } + if (newHealthValue is FormulaStatValue && + newHealthValue.formula == "Incarnate") { + int value = 36; //double Incarnates level 5 health + for (final item in gs.currentList) { + if (item is Character && item.id == "Incarnate") { + final healthByLevel = item.characterClass.healthByLevel; + final level = item.characterState.level; + if (level >= 1 && level <= healthByLevel.length) { + value = healthByLevel[level - 1] * _kIncarnateHealthMultiplier; + } + break; + } + } + _maxHealth = value; + } + } + _level = monster.level; + _health = maxHealth; + } + + Map<String, dynamic> toJson() => { + 'health': health, + 'maxHealth': maxHealth, + 'level': level, + 'standeeNr': standeeNr, + 'move': move, + 'attack': attack, + 'range': range, + 'name': name, + 'gfx': gfx, + 'roundSummoned': roundSummoned, + 'type': type.index, + 'chill': chill, + 'plague': plague, + 'conditions': conditions.map((c) => c.index).toList(), + 'conditionsAddedThisTurn': _conditionsAddedThisTurn + .map((c) => c.index) + .toList(), + 'conditionsAddedPreviousTurn': _conditionsAddedPreviousTurn + .map((c) => c.index) + .toList(), + }; + + @override + String toString() => json.encode(toJson()); + + MonsterInstance.fromJson(Map<String, dynamic> json) { + standeeNr = json["standeeNr"]; + _health = json["health"]; + _level = json["level"]; + _maxHealth = json["maxHealth"]; + name = json["name"]; + gfx = json["gfx"]; + final typeIdx = json["type"] as int?; + _type = + (typeIdx != null && typeIdx >= 0 && typeIdx < MonsterType.values.length) + ? MonsterType.values[typeIdx] + : MonsterType.normal; + move = json["move"]; + attack = json["attack"]; + range = json["range"]; + _roundSummoned = json.containsKey("roundSummoned") + ? json["roundSummoned"] + : -1; + _chill = json["chill"]; + if (json.containsKey("plague")) { + _plague = json["plague"]; + } + final condis = json["conditions"]; + for (int item in condis) { + if (item >= 0 && item < Condition.values.length) { + conditions.add(Condition.values[item]); + } + } + + if (json.containsKey("conditionsAddedThisTurn")) { + List<Object?> condis2 = json["conditionsAddedThisTurn"] as List<Object?>; + for (int item in condis2.cast<int>()) { + if (item >= 0 && item < Condition.values.length) { + _conditionsAddedThisTurn.add(Condition.values[item]); + } + } + } + if (json.containsKey("conditionsAddedPreviousTurn")) { + List<Object?> condis3 = + json["conditionsAddedPreviousTurn"] as List<Object?>; + for (int item in condis3.cast<int>()) { + if (item >= 0 && item < Condition.values.length) { + _conditionsAddedPreviousTurn.add(Condition.values[item]); + } + } + } + } +} diff --git a/server/lib/core/state/note_row.dart b/server/lib/core/state/note_row.dart new file mode 100644 index 0000000..5375da0 --- /dev/null +++ b/server/lib/core/state/note_row.dart @@ -0,0 +1,96 @@ +part of 'game_state.dart'; + +// ignore_for_file: library_private_types_in_public_api + +/// A free-form note that lives in the main list as its own row, styled like a +/// player/monster row but in a user-pickable colour. +/// +/// A note can be unlinked (a free-floating row placed wherever the user drags +/// it) or linked to a figure (a character or monster row) by that figure's +/// [id]. When linked it is kept positioned directly beneath its target by +/// [GameState._reflowNoteRows]. For a monster target it may additionally be +/// pinned to a specific [standeeNr] to annotate one standee rather than the +/// whole group. +class NoteRow extends ListItemData { + // Slate tone, clearly distinct from character/monster rows. + static const int defaultColor = 0xFF4E5D6C; + + String _text = ""; + int _color = defaultColor; + // "" means unlinked. + String _linkedId = ""; + // 0 means "whole group / not standee-specific". + int _standeeNr = 0; + + String get text => _text; + int get color => _color; + String get linkedId => _linkedId; + int get standeeNr => _standeeNr; + + bool get isLinked => _linkedId.isNotEmpty; + + NoteRow(String anId) { + id = anId; + } + + NoteRow.create( + String anId, { + String text = "", + int color = defaultColor, + String linkedId = "", + int standeeNr = 0, + }) { + id = anId; + _text = text; + _color = color; + _linkedId = linkedId; + _standeeNr = standeeNr; + } + + NoteRow.fromJson(Map<String, dynamic> json) { + id = json['id'] as String; + _applyJson(json); + } + + /// Updates fields in-place (preserving object identity across network + /// syncs). + void updateFromJson(Map<String, dynamic> json) { + _applyJson(json); + } + + void _applyJson(Map<String, dynamic> json) { + _text = json['text'] as String? ?? ""; + _color = json['color'] as int? ?? defaultColor; + _linkedId = json['linkedId'] as String? ?? ""; + _standeeNr = json['standeeNr'] as int? ?? 0; + } + + void setText(_StateModifier _, String value) { + _text = value; + } + + void setColor(_StateModifier _, int value) { + _color = value; + } + + /// Links the note to [linkedId] (a figure id; "" to unlink) and, for monster + /// targets, an optional [standeeNr] (0 for the whole group). + void setLink(_StateModifier _, String linkedId, int standeeNr) { + _linkedId = linkedId; + _standeeNr = linkedId.isEmpty ? 0 : standeeNr; + } + + @override + Map<String, dynamic> toJson() => { + 'id': id, + // Discriminator used by GameSaveState.load to rebuild the right type. + 'noteRow': true, + 'text': _text, + 'color': _color, + 'linkedId': _linkedId, + 'standeeNr': _standeeNr, + }; + + @override + String toString() => json.encode(toJson()); +} diff --git a/server/lib/core/state/sanctuary_deck.dart b/server/lib/core/state/sanctuary_deck.dart new file mode 100644 index 0000000..8858fea --- /dev/null +++ b/server/lib/core/state/sanctuary_deck.dart @@ -0,0 +1,85 @@ +part of 'game_state.dart'; + +// ignore_for_file: library_private_types_in_public_api + +class SanctuaryDeck { + static const int _kCardTypeCount = 5; + + final CardStack<ModifierCard> _multPile = CardStack<ModifierCard>(); + final CardStack<ModifierCard> _flipPile = CardStack<ModifierCard>(); + + SanctuaryDeck() { + //build deck + _initDeck(); + } + + SanctuaryDeck.fromJson(Map<String, dynamic> modifierDeckData) { + _initDeck(); + + List<ModifierCard> newMultList = []; + List<ModifierCard> newFlipList = []; + for (final item in modifierDeckData["multPile"] as List) { + String gfx = item["gfx"]; + newMultList.add(ModifierCard(CardType.remove, gfx)); + } + for (final item in modifierDeckData["flipPile"] as List) { + String gfx = item["gfx"]; + newFlipList.add(ModifierCard(CardType.remove, gfx)); + } + _multPile.setList(newMultList); + _flipPile.setList(newFlipList); + } + + ModifierCard drawMult(_StateModifier _) { + if (_multPile.isEmpty) { + _initDeck(); + } + _multPile.shuffle(); + return _multPile.pop(); + } + + ModifierCard drawFlip(_StateModifier _) { + if (_flipPile.isEmpty) { + _initDeck(); + } + _flipPile.shuffle(); + return _flipPile.pop(); + } + + void returnCard(String gfx) { + if (gfx.contains("flip")) { + _flipPile.add(ModifierCard(CardType.remove, gfx)); + _flipPile.shuffle(); + } else { + _multPile.add(ModifierCard(CardType.remove, gfx)); + _multPile.shuffle(); + } + } + + Map<String, dynamic> toJson() => { + 'multPile': _multPile.getList().map((c) => c.toJson()).toList(), + 'flipPile': _flipPile.getList().map((c) => c.toJson()).toList(), + }; + + @override + String toString() => json.encode(toJson()); + + void _initDeck() { + _multPile.clear(); + _flipPile.clear(); + List<ModifierCard> flipCards = []; + List<ModifierCard> multCards = []; + final prefix = "sanctuary/"; + for (int i = 1; i < _kCardTypeCount; i++) { + //2 of each of 4 different cards + flipCards.add(ModifierCard(CardType.remove, "${prefix}flip-$i")); + flipCards.add(ModifierCard(CardType.remove, "${prefix}flip-$i")); + multCards.add(ModifierCard(CardType.remove, "${prefix}x2-$i")); + multCards.add(ModifierCard(CardType.remove, "${prefix}x2-$i")); + } + _flipPile.setList(flipCards); + _multPile.setList(multCards); + _flipPile.shuffle(); + _multPile.shuffle(); + } +} diff --git a/server/lib/core/translation_service.dart b/server/lib/core/translation_service.dart new file mode 100644 index 0000000..28dbdc2 --- /dev/null +++ b/server/lib/core/translation_service.dart @@ -0,0 +1,53 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:logging/logging.dart'; + +final _log = Logger('TranslationService'); + +/// In-game ability-text translations (the reference app's `TranslationService`, +/// disk-based port): loads `assets/i18n/<locale>.json` and resolves keys with +/// a fallback to the English key. +class TranslationService { + Map<String, String> _translations = {}; + + // Returns the translated string, or the English key if no translation exists. + String t(String key) => _translations[key] ?? key; + + Future<void> load(String locale) async { + if (locale == 'en') { + _translations = {}; + return; + } + try { + final file = File('assets/i18n/$locale.json'); + if (!file.existsSync()) { + _log.warning( + 'TranslationService: locale file "$locale.json" not found', + ); + _translations = {}; + return; + } + final jsonString = await file.readAsString(); + final Map<String, dynamic> data = + jsonDecode(jsonString) as Map<String, dynamic>; + final Map<String, String> flat = {}; + for (final entry in data.entries) { + final value = entry.value; + if (value is Map<String, dynamic>) { + for (final inner in value.entries) { + if (inner.value is String) { + flat[inner.key] = inner.value as String; + } + } + } else if (value is String) { + flat[entry.key] = value; + } + } + _translations = flat; + } catch (e) { + _log.warning('TranslationService: failed to load locale "$locale": $e'); + _translations = {}; + } + } +} diff --git a/server/lib/core/ui_utils.dart b/server/lib/core/ui_utils.dart new file mode 100644 index 0000000..f6900d8 --- /dev/null +++ b/server/lib/core/ui_utils.dart @@ -0,0 +1,12 @@ +import 'package:x_haven_server/core/service_locator.dart'; + +import 'enums.dart'; +import 'settings.dart'; + +/// Minimal port of the reference app's `ui_utils.dart` for the headless +/// engine: only [reducePowerEnabled], which `line_builder` consults. +/// The rest of the reference file is pure widget styling (Phase 3+). +bool reducePowerEnabled({Settings? settings}) { + final resolved = settings ?? getIt<Settings>(); + return resolved.powerMode == PowerMode.reducePower; +} |
