unlimited 0.3.0
unlimited: ^0.3.0 copied to clipboard
Cards database and game rules for the Star Wars Unlimited CCG.
CHANGELOG #
This is an early release of the unlimited
package, and is likely to rapidly
change. We use semantic versioning,
which in sort means that the version number is incremented to represent
breaking/non-breaking changes to the API.
ℹ️ NOTE: While the package is in development, the version number is
0.J.I
, where J
is incremented when there is a breaking change to the API,
and I
is incremented when there is a non-breaking change to the API. If bug
fixes are needed, an additional +X
is appended to the version number.
0.3.0 #
cards.dart
:
-
Added a top-level
allCardSets
, aCollection
of all cards in the game.ℹ️ NOTE: This is just
sparkOfRebellion
for now. -
Moved
CardSetInventory
tostate.dart
, since it's a representation of state. -
Fixed a number of typos in the cards database, and added additional cards.
decks.dart
:
-
A new library, that inlines two starter decks as a sample for apps/libraries:
lukeDeck
is a deck that focuses on Luke Skywalker from Spark of Rebellion.vaderDeck
is a deck that focuses on Darth Vader from Spark of Rebellion.
persist.dart
:
-
A new library, that provides conveniences for persisting game/deck state.
For example,
DeckDecoder
providesdecodeDeck
to convert a list of cards:import 'package:unlimited/cards.dart'; import 'package:unlimited/persist.dart'; import 'package:unlimited/schema.dart'; /// [sparkOfRebellion] starter deck with Luke Skywalker. final lukeDeck = allCardSets.decodeDeck([ // Luke Skywalker CardReference(CardSet.sparkOfRebellion, 005), // Administrator's Tower CardReference(CardSet.sparkOfRebellion, 029), // 2-1B Surgical Droid CardReference(CardSet.sparkOfRebellion, 059), // R2-D2 CardReference(CardSet.sparkOfRebellion, 236, 3), // ... snip ... see `decks.dart` for the full list. ]);
schema.dart
:
-
Card.isToken
was removed. There is now a base type calledAttachmentCard
, which is used for cards that are attached to other cards (such asUpgradeCard
, but alsoTokenCard
). All references toisToken
were removed.-UpgradeCard.token( +TokenCard( /* ... */ )
-
Card.hp
was renamedCard.health
.Every card that has health now inherits from
TargetCard
. In practice, this isUnitCard
,LeaderCard
, andBaseCard
. -
UnitCard.isLeader
was removed. There is now a base type calledEntityCard
, which is used for cards that are entities (such asUnitCard
, but alsoLeaderCard
). All references toisLeader
were removed.-UnitCard.leader( +LeaderCard( /* ... */ )
-
UnitCard.unique
was added, instead of just having an optionaltitle
.-UnitCard.leader( +UnitCard( /* ... */ title: 'Dark Lord of the Sith', )
-
Added
Trait.capitalShip
.
state.dart
:
-
Added
extension CardDuplicator<T extends Card> on T
, which provides the methodduplicate
to conveniently create multiple copies of a card.import 'package:unlimited/schema.dart'; import 'package:unlimited/state.dart'; void example(Card card) { // Will print the card 3 times. for (final copy in card.duplicate(3)) { print(copy); } }
-
Added
DeployedCard
, that tracks a card in play, including state such as damage:import 'package:unlimited/schema.dart'; import 'package:unlimited/state.dart'; void example(TargetCard card) { DeployedCard(card, damage: 1); }
There is also
DeployedUnit
, which includes upgrades, andDeployedBase
. -
Added
Area
, which represents all of the cards associated to a player:totalResources
,availableResources
base
leader
hand
deck
discard
arena
-
CardSetInventory
now optionally takesbelongsTo
, or infers it:// Both of these calls are identical. CardSetInventory( belongsTo: CardSet.sparkOfRebellion, { /* ... cards ... */ } ); CardSetInventory( { /* ... cards that all originate from sparkOfRebellion ... */ } );
-
Fixed a bug where
Deck
could allow invalid cards, and required too many.
0.2.0 #
cards.dart
:
-
Added
CardSetInventory
, which wraps aCardSet
and provides a list (well, really aSet
) of all the cards in the set (or at least as many that have been previewed so far). -
Changed
sparkOfRebellion
to be aCardSetInventory
instead of aSet<Card>
(which is still available as the.cards
property).
schema.dart
:
- Removed
CardType
, it was redundant with theCard
class and subclasses.
state.dart
:
Added an additional library, pacakge:unlimited/state.dart
, which contains representations of game state or card collections. For example, creating a deck:
import 'package:unlimited/state.dart';
void createDeck(BaseCard base, UnitCard leader, List<Card> cards) {
final deck = Deck(
base: base
leader: leader
cards: [
...cards,
],
);
}
0.0.1+1 #
No changes, update is merely for pub.dev.
0.0.1 #
Initial release. Woohoo!
Two libraries are available:
-
package:unlimited/schema.dart
defines the schema for the cards in the game.The game's card model is defined as a set of Dart classes, such as:
// SOR 010. UnitCard.leader( cardSet: CardSet.sparkOfRebellion, orderInSet: 10, name: 'DarthVader', title: 'Dark Lord of the Sith', aspects: const {Aspect.aggression, Aspect.villainy}, cost: 7, traits: const {Trait.force, Trait.imperial, Trait.sith}, power: 5, hp: 8, );
Some key classes are:
Card
; either aBaseCard
,EventCard
,UnitCard
, orUpgradeCard
.CardSet
, which defines each set of cards in the game.- Other classes such as
Aspect
,Trait
, and more.
-
package:unlimited/cards.dart
contains an inlined copy of the cards database.While applications are likely to want to fetch/update the cards database from an external datasource (i.e. as JSON or similar), this library is provided as a convenience, as well to validate that (a) the schema is correct and (b) the schema contains all the information needed to encapsulate the cards database.
// It's recommended to import the library with a prefix. import 'package:unlimited/cards.dart' as cards; import 'package:unlimited/schema.dart'; void main() { final vader = cards.sparkOfRebellion.firstWhere( (card) => card.name == 'Darth Vader', ); // Pattern match to get the card's type. switch (vader) { case final BaseCard card: print('Base: ${card.name}: ${card.location}'); case final UnitCard card: print('Unit: ${card.name}: ${card.title ?? '<No title>'}'); case final EventCard card: print('Event: ${card.name}'); case final UpgradeCard card: print('Upgrade: ${card.name}'); } }
0.0.0 #
Initial empty package as a placeholder.