Skip to content

Commit 3134c06

Browse files
committed
Add all monsters
In order to add monsters more support was required, also: * Added location restrictions to CardType, can restrict to crystalCaves or depths. * Added support for arriveClank, which triggers on arrival in the dungeon row but before dragon attacks (also tested). * Added CardType.interaction, but not currently using (much). Also added isDevice, but not using yet. * Added CardType.otherClank which only adds clank to others. * Added CardType.neverDiscards for supporting the Goblin. * Fixed a bug in canTakeArtifact where it would only think it had an artifact if the artifact was the last thing in the loot list. (Can't test yet w/o more loot types) * Added support for Fighting, both to the planner and the Game. * Refactored to share code between execution of PlayCard and Fight actions. * Added new ArrivalTriggers class to capture arrival effects in addition to whether a card was added to the dungeon row with a Dragon on it. * Walking all lists of players can be dangerous (sometimes the activePlayer needs to be special, at least for clank handling) so audited all callsites, including refactoring to separate most out into their own functions. * Separated CubeCounts.totalPlayerCubes from DragonBag.totalCubes to allow counting remaining Dragon cubes as well. * Found and closed at least one leak of cubes (when the dragon attacked). I have not yet enabled the cube count asserts yet. * Found instances of fold() being used improperly (forgetting to add the previous. Fixed two (and tested). * Added cardUsableAtLocation as a free function to check if a card can be used given the location. * Taught the planner how to plan a Fight.
1 parent 13b70a9 commit 3134c06

File tree

4 files changed

+340
-67
lines changed

4 files changed

+340
-67
lines changed

lib/cards.dart

Lines changed: 116 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ enum CardSet {
44
dungeon,
55
}
66

7+
enum Interaction {
8+
fight, // monster
9+
use, // device
10+
buy, // everything else
11+
}
12+
13+
enum Location {
14+
everywhere,
15+
crystalCave,
16+
deep,
17+
}
18+
719
class CardType {
820
final String name;
921
final CardSet set;
@@ -14,12 +26,17 @@ class CardType {
1426
final int clank;
1527
final int points;
1628

29+
final int othersClank;
30+
1731
final int skillCost;
1832
final int swordsCost;
1933

2034
final bool dragon;
21-
final bool danger; // Only used for Dragon Shrine and Kobold?
35+
final bool danger;
2236
final bool companion;
37+
final Location location;
38+
39+
final int arriveClank;
2340

2441
final int acquireClank;
2542
final int acquireSwords;
@@ -30,10 +47,14 @@ class CardType {
3047
final int drawCards;
3148
final int gainGold;
3249
final PlayEffect effect;
50+
final Interaction interaction;
51+
52+
final bool neverDiscards; // Special just for Goblin.
3353

3454
const CardType({
3555
required this.name,
3656
required this.set,
57+
bool isDevice = false,
3758
this.skill = 0,
3859
this.boots = 0,
3960
this.swords = 0,
@@ -42,17 +63,23 @@ class CardType {
4263
this.swordsCost = 0,
4364
this.points = 0,
4465
this.dragon = false,
66+
this.arriveClank = 0,
4567
this.acquireClank = 0,
4668
this.acquireSwords = 0,
4769
this.acquireHearts = 0,
4870
this.acquireBoots = 0,
4971
this.danger = false,
5072
this.companion = false,
73+
this.location = Location.everywhere,
5174
this.drawCards = 0,
5275
this.gainGold = 0,
76+
this.othersClank = 0,
5377
this.effect = PlayEffect.none,
5478
required this.count,
55-
});
79+
this.neverDiscards = false,
80+
}) : interaction = (isDevice)
81+
? Interaction.use
82+
: (swordsCost > 0 ? Interaction.fight : Interaction.buy);
5683

5784
@override
5885
String toString() => name;
@@ -304,4 +331,91 @@ const List<CardType> baseSetAllCardTypes = [
304331
acquireBoots: 1,
305332
skillCost: 5,
306333
),
334+
335+
// Monsters
336+
CardType(
337+
name: 'Goblin',
338+
set: CardSet.reserve,
339+
count: 1,
340+
swordsCost: 2,
341+
gainGold: 1,
342+
neverDiscards: true,
343+
),
344+
CardType(
345+
name: 'Cave Troll',
346+
set: CardSet.dungeon,
347+
count: 1,
348+
location: Location.deep,
349+
dragon: true,
350+
swordsCost: 4,
351+
gainGold: 3,
352+
drawCards: 2,
353+
),
354+
CardType(
355+
name: 'Belcher',
356+
set: CardSet.dungeon,
357+
count: 2,
358+
dragon: true,
359+
swordsCost: 2,
360+
gainGold: 4,
361+
clank: 2,
362+
),
363+
CardType(
364+
name: 'Animated Door',
365+
set: CardSet.dungeon,
366+
count: 2,
367+
dragon: true,
368+
swordsCost: 1,
369+
boots: 1,
370+
),
371+
CardType(
372+
name: 'Ogre',
373+
set: CardSet.dungeon,
374+
count: 2,
375+
dragon: true,
376+
swordsCost: 3,
377+
gainGold: 5,
378+
),
379+
CardType(
380+
name: 'Orc Grunt',
381+
set: CardSet.dungeon,
382+
count: 3,
383+
dragon: true,
384+
swordsCost: 2,
385+
gainGold: 3,
386+
),
387+
CardType(
388+
name: 'Crystal Golem',
389+
set: CardSet.dungeon,
390+
count: 2,
391+
location: Location.crystalCave,
392+
swordsCost: 3,
393+
skill: 3,
394+
),
395+
CardType(
396+
name: 'Kobold',
397+
set: CardSet.dungeon,
398+
count: 3,
399+
dragon: true,
400+
danger: true,
401+
swordsCost: 1,
402+
skill: 1,
403+
),
404+
CardType(
405+
name: 'Watcher',
406+
set: CardSet.dungeon,
407+
count: 3,
408+
arriveClank: 1,
409+
swordsCost: 3,
410+
gainGold: 3,
411+
othersClank: 1,
412+
),
413+
CardType(
414+
name: 'Overlord',
415+
set: CardSet.dungeon,
416+
count: 2,
417+
arriveClank: 1,
418+
swordsCost: 2,
419+
drawCards: 2,
420+
),
307421
];

0 commit comments

Comments
 (0)