diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fd02f8..891d289 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# v2.0.5 +* DW data updates/fixes + +# v2.0.4 +* File structure changes +* Bugfixes + # v2.0.3+2 * Bugfix in exporting spell tags diff --git a/LICENSE.md b/LICENSE similarity index 100% rename from LICENSE.md rename to LICENSE diff --git a/README.md b/README.md index 4d3333c..502b660 100644 --- a/README.md +++ b/README.md @@ -12,15 +12,17 @@ There is more information in the doc directory. ## Available data -* `List` basicMoves - Dungeon World's basic moves, such as Hack & Slash, Defy Danger, etc. -* `List` specialMoves - Dungeon World's special moves, such as Make Camp, Take Watch, etc. -* `List` classes - All of Dungeon World's classes, plus some homebrews. - See `PlayerClass` class for a full description of the usable properties. -* `List` equipment - Dungeon World's main list of items. -* `List` spells - Dungeon World's main spellbook list. Each class can have its own spells - list, see `PlayerClass` in the docs for more information. -* `List` monsters - Dungeon World's main monster list. -* `List` tags - List of all basic tags, along with descriptions. +| Name | Type | Description | +| ---- | ---- | ----------- | +| basicMoves | `List` | Dungeon World's basic moves, such as Hack & Slash, Defy Danger, etc. | +| specialMoves | `List` | Dungeon World's special moves, such as Make Camp, Take Watch, etc. | +| classes | `List` | All of Dungeon World's classes, plus some homebrews. + See `PlayerClass` class for a full description of the usable properties. | +| equipment | `List` | Dungeon World's main list of items. | +| spells | `List` | Dungeon World's main spellbook list. Each class can have its own spells + list, see `PlayerClass` in the docs for more information. | +| monsters | `List` | Dungeon World's main monster list. | +| tags | `List` | List of all basic tags, along with descriptions. | There is also a `Dice` class, with simple dice rolling functionality for your use. @@ -32,6 +34,6 @@ The data is from there, this package simply wraps it up for Dart. ## Contributing 1. Make your changes -1. Make a PR, explain what your changes do, what could break. -1. ??? +1. Run tests, and add new tests if appropriate. Make sure nothing breaks. +1. Create a PR, explain what your changes do. 1. Profit! diff --git a/analysis_options.yaml b/analysis_options.yaml index b7e731c..82c398e 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -2,7 +2,9 @@ # projects at Google. For details and rationale, # see https://github.com/dart-lang/pedantic#enabled-lints. include: package:pedantic/analysis_options.yaml - +analyzer: + exclude: + - example/*.dart # For lint rules and documentation, see http://dart-lang.github.io/linter/lints. # Uncomment to specify additional rules. # linter: diff --git a/example/classes.dart b/example/classes.dart new file mode 100644 index 0000000..37213bc --- /dev/null +++ b/example/classes.dart @@ -0,0 +1,9 @@ +import 'package:dungeon_world_data/dw_data.dart'; + +void main() { + // Get bard class + var bard = dungeonWorld.classes.firstWhere((k) => k.key == 'bard'); + // Get all bard advanced moves + + var moves = bard.advancedMoves1; +} diff --git a/example/equipment.dart b/example/equipment.dart new file mode 100644 index 0000000..876f630 --- /dev/null +++ b/example/equipment.dart @@ -0,0 +1,12 @@ +import 'package:dungeon_world_data/dw_data.dart'; + +void main() { + // Get inventory items + var equipment1 = dungeonWorld.equipment.first; + + // Get gear choices for class + + var bard = dungeonWorld.classes.firstWhere((k) => k.key == 'bard'); + var gearChoices1 = bard.gearChoices.map((i) => i.toJSON()).toList(); + ; +} diff --git a/example/example.dart b/example/example.dart deleted file mode 100644 index eecd208..0000000 --- a/example/example.dart +++ /dev/null @@ -1,47 +0,0 @@ -import 'package:dungeon_world_data/dw_data.dart'; - -void main() { - // Get all monsters - print(dungeonWorld.monsters.map((monster) => monster.name)); - print(''); - - // Get all bard advanced moves - var bard = dungeonWorld.classes.firstWhere((k) { - print(k.key); - return k.key == 'bard'; - }); - print(bard.advancedMoves1.map((move) => move.name)); - print(''); - - // Get fighter class - print(bard); - print(''); - - // Get all spells - print(dungeonWorld.spells.first); - print(''); - - // Get all inventory items - print(dungeonWorld.equipment - .where((i) => i.description != null) - .toList() - .join('\n\n')); - print(''); - - // Get gear choices for class - print(bard.gearChoices.map((i) => i.toJSON()).toList()); - - // Get starting moves for classs - var thief = dungeonWorld.classes.firstWhere((k) => k.key == 'thief'); - var wizard = dungeonWorld.classes.firstWhere((k) => k.key == 'wizard'); - print(thief.startingMoves); - print(wizard.spells); - - // Parse tags from objects or strings - print(Tag.fromJSON({'weight': 1})); - print(Tag.fromJSON('{coins: 3}')); - print(Tag.fromJSON('close')); - - // All info tags - print(dungeonWorld.tags); -} diff --git a/example/monsters.dart b/example/monsters.dart new file mode 100644 index 0000000..91374a3 --- /dev/null +++ b/example/monsters.dart @@ -0,0 +1,6 @@ +import 'package:dungeon_world_data/dw_data.dart'; + +void main() { + // Get all monsters + var monsters = dungeonWorld.monsters.map((monster) => monster.name); +} diff --git a/example/moves.dart b/example/moves.dart new file mode 100644 index 0000000..a14b39c --- /dev/null +++ b/example/moves.dart @@ -0,0 +1,11 @@ +import 'package:dungeon_world_data/dw_data.dart'; + +void main() { + var bard = dungeonWorld.classes.firstWhere((k) => k.key == 'bard'); + var thief = dungeonWorld.classes.firstWhere((k) => k.key == 'thief'); + + // Flattened move lists + var moves1 = bard.advancedMoves1; + var moves2 = dungeonWorld.basicMoves.first; + var moves3 = thief.startingMoves; +} diff --git a/example/spells.dart b/example/spells.dart new file mode 100644 index 0000000..e4452d0 --- /dev/null +++ b/example/spells.dart @@ -0,0 +1,10 @@ +import 'package:dungeon_world_data/dw_data.dart'; + +void main() { + // Get all spells + var spell1 = dungeonWorld.spells.first; + + // Get spells for class + var wizard = dungeonWorld.classes.firstWhere((k) => k.key == 'wizard'); + var spells1 = wizard.spells; +} diff --git a/example/tags.dart b/example/tags.dart new file mode 100644 index 0000000..e9776fe --- /dev/null +++ b/example/tags.dart @@ -0,0 +1,14 @@ +import 'package:dungeon_world_data/dw_data.dart'; + +void main() { + // Parse tags from objects or strings + var tag1 = Tag.fromJSON({'weight': 1}); + var tag2 = Tag.fromJSON('{coins: 3}'); + var tag3 = Tag.fromJSON('close'); + + // All info tags + var tagInfos = dungeonWorld.tags; + + // Get tags from spells, equipment + var tags1 = dungeonWorld.spells.first.tags; +} diff --git a/lib/dice.dart b/lib/dice.dart index 4c337c7..dcc947d 100644 --- a/lib/dice.dart +++ b/lib/dice.dart @@ -4,6 +4,7 @@ import 'package:quiver/core.dart'; class Dice { num amount; num sides; + DiceResult lastResult; /// Simple dice, with sides and die count. /// You can multiply, add or subtract Dice objects to change the amount of rolls (notice dice must @@ -109,8 +110,7 @@ class Dice { for (num i = 0; i < amount; i++) { results.add(Random().nextInt(sides) + 1); } - - return DiceResult(this, results); + return lastResult = DiceResult(this, results); } Dice get single => this / amount; diff --git a/pubspec.yaml b/pubspec.yaml index 584a1e7..4fc4a47 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: dungeon_world_data -homepage: https://github.com/chenasraf/dungeon_world_data +homepage: https://github.com/DungeonPaper/dungeon_world_data description: Data dump of Dungeon World classes, moves, equipment, and more. Also mirrored as NPM package. -version: 2.0.4 +version: 2.0.5 environment: sdk: ">=2.3.0 <3.0.0"