diff options
Diffstat (limited to 'server/lib/core/commands/add_standee_command.dart')
| -rw-r--r-- | server/lib/core/commands/add_standee_command.dart | 64 |
1 files changed, 64 insertions, 0 deletions
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, + ); +} |
