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 accessing
initialize cards
| response | | response |
response := self new. response := OrderedCollection new.
self suits keysDo: [:suit | self suits keysDo: [:suit |
(self numeralCards, self faceCards) do: [:number| (self numeralCards, self faceCards) do: [:number|
response cards add: number asString, suit. response add: number asString, suit.
]. ].
]. ].
^ response ^ response

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,3 +1,3 @@
accessing accessing
deck 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", "wordMap",
"oracles", "oracles",
"wiki", "wiki",
"characters" "characters",
"story"
], ],
"name" : "FirelightsGame", "name" : "FirelightsGame",
"type" : "normal" "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"
}