blob: 1b654b6996a9fbcdd763e4ba8fc003d9aa36d350 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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() {
final Character? character = GameMethods.getCharacterByName(characterId);
if (character != null) {
character.flipPerk(stateAccess, index);
}
}
@override
String describe() {
final 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);
}
}
|