mirror of
https://github.com/DungeonPaper/dungeon_world_data.git
synced 2026-05-18 02:08:58 +00:00
48 lines
1.0 KiB
Dart
48 lines
1.0 KiB
Dart
import 'dw_entity.dart';
|
|
import 'mappers.dart';
|
|
|
|
class Move extends DWEntity {
|
|
/// Move name
|
|
String name;
|
|
|
|
/// Move description
|
|
String description;
|
|
|
|
/// Move explanation
|
|
String? explanation;
|
|
|
|
/// Classes that can use this move.
|
|
/// The keys correspond to the `PlayerClass` key.
|
|
List<String> classes;
|
|
|
|
Move({
|
|
String? key,
|
|
required this.name,
|
|
required this.description,
|
|
this.explanation,
|
|
required this.classes,
|
|
}) : super(key: key ?? DWEntity.generateKey(name));
|
|
|
|
factory Move.fromJSON(Map map) => Move(
|
|
key: map['key'],
|
|
name: map['name'],
|
|
classes: map['classes'] != null
|
|
? listMapper(map['classes'], (dynamic j) => j.toString())
|
|
: [],
|
|
description: map['description'],
|
|
explanation: map['explanation'],
|
|
);
|
|
|
|
@override
|
|
Map toJSON() => {
|
|
'key': key,
|
|
'name': name,
|
|
'classes': classes,
|
|
'description': description,
|
|
'explanation': explanation,
|
|
};
|
|
|
|
@override
|
|
Move copy() => Move.fromJSON(toJSON());
|
|
}
|