Firelights: Refactoring cards deck, adding StoryNode(s) and improving stories storage.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2023-12-20 13:20:14 -05:00
parent 02d36190c2
commit f2a5a74ca8
24 changed files with 87 additions and 12 deletions

View File

@ -1,10 +1,10 @@
accessing
initialize
cards
| response |
response := self new.
response := OrderedCollection new.
self suits keysDo: [:suit |
(self numeralCards, self faceCards) do: [:number|
response cards add: number asString, suit.
response add: number asString, suit.
].
].
^ response

View File

@ -1,3 +0,0 @@
accessing
cards: aCollection
cards := aCollection

View File

@ -1,3 +1,3 @@
accessing
cards
^ cards ifNil: [ cards := OrderedCollection new]
^ self class cards

View File

@ -1,5 +1,5 @@
accessing
reset
self drawn: OrderedCollection new.
self cards: self class initialize cards.
self stock: self class cards.
^ self

View File

@ -1,3 +1,3 @@
accessing
stock
^ stock := self cards copyWithoutAll: self drawn
^ stock := self class cards copyWithoutAll: self drawn

View File

@ -6,7 +6,6 @@
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"cards",
"drawn",
"stock"
],

View File

@ -0,0 +1,3 @@
accessing
deck: anObject
deck := anObject

View File

@ -1,3 +1,3 @@
accessing
deck
^ deck ifNil: [ deck := DeckOfCards initialize]
^ deck ifNil: [ deck := DeckOfCards new]

View File

@ -0,0 +1,10 @@
accessing
export
| response |
response := '' writeStream.
(STON writer on: response)
newLine: String lf;
prettyPrint: true;
keepNewLines: true;
nextPut: self.
^ MarkupFile exportAsFileOn: FileLocator temp / 'firelights.ston' containing: (response contents)

View File

@ -0,0 +1,4 @@
accessing
resetWorlMap
self worldMap: nil.
self deck reset.

View File

@ -0,0 +1,3 @@
accessing
story: anObject
story := anObject

View File

@ -0,0 +1,3 @@
accessing
story
^ story ifNil: [ story := OrderedCollection new]

View File

@ -0,0 +1,13 @@
accessing
uiGameFor: aView
<gtView>
| response |
response := '' writeStream.
response
nextPutAll: '❭❭❭ Main Character'; cr; cr;
nextPutAll: self characters first printString; cr;
nextPutAll: '❭❭❭ Deck'; cr; cr;
nextPutAll: self deck printString.
^ aView text
title: 'Game';
text: [ response contents ]

View File

@ -0,0 +1,3 @@
accessing
worldMap: anObject
wordMap := anObject

View File

@ -0,0 +1,5 @@
accessing
worldMapDraw: aCardCollection
self deck drawn addAll: aCardCollection.
self worldMap addAll: aCardCollection.

View File

@ -11,7 +11,8 @@
"wordMap",
"oracles",
"wiki",
"characters"
"characters",
"story"
],
"name" : "FirelightsGame",
"type" : "normal"

View File

@ -0,0 +1,3 @@
accessing
addCharacter: aCharacter
self characters add: aCharacter

View File

@ -0,0 +1,3 @@
accessing
addPlace: aPlaceCard
self places add: aPlaceCard

View File

@ -0,0 +1,3 @@
accessing
characters
^ characters ifNil: [ characters := Set new]

View File

@ -0,0 +1,3 @@
accessing
places
^ places ifNil: [ places := Set new]

View File

@ -0,0 +1,3 @@
accessing
text: aString
text := aString

View File

@ -0,0 +1,3 @@
accessing
text
^ text

View File

@ -0,0 +1,16 @@
{
"commentStamp" : "",
"super" : "Object",
"category" : "RoloLudo",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"text",
"characters",
"places",
"inspirations"
],
"name" : "StoryNode",
"type" : "normal"
}