From f2a5a74ca8d660be8324c2a4a162ce822472d7e1 Mon Sep 17 00:00:00 2001 From: Offray Luna Date: Wed, 20 Dec 2023 13:20:14 -0500 Subject: [PATCH] Firelights: Refactoring cards deck, adding StoryNode(s) and improving stories storage. --- .../class/{initialize.st => cards.st} | 6 +++--- .../DeckOfCards.class/instance/cards..st | 3 --- .../DeckOfCards.class/instance/cards.st | 2 +- .../DeckOfCards.class/instance/reset.st | 2 +- .../DeckOfCards.class/instance/stock.st | 2 +- .../DeckOfCards.class/properties.json | 1 - .../FirelightsGame.class/instance/deck..st | 3 +++ .../FirelightsGame.class/instance/deck.st | 2 +- .../FirelightsGame.class/instance/export.st | 10 ++++++++++ .../instance/resetWorlMap.st | 4 ++++ .../FirelightsGame.class/instance/story..st | 3 +++ .../FirelightsGame.class/instance/story.st | 3 +++ .../FirelightsGame.class/instance/uiGameFor..st | 13 +++++++++++++ .../FirelightsGame.class/instance/worldMap..st | 3 +++ .../instance/worldMapDraw..st | 5 +++++ .../FirelightsGame.class/properties.json | 3 ++- RoloLudo.package/StoryNode.class/README.md | 0 .../StoryNode.class/instance/addCharacter..st | 3 +++ .../StoryNode.class/instance/addPlace..st | 3 +++ .../StoryNode.class/instance/characters.st | 3 +++ .../StoryNode.class/instance/places.st | 3 +++ .../StoryNode.class/instance/text..st | 3 +++ .../StoryNode.class/instance/text.st | 3 +++ RoloLudo.package/StoryNode.class/properties.json | 16 ++++++++++++++++ 24 files changed, 87 insertions(+), 12 deletions(-) rename RoloLudo.package/DeckOfCards.class/class/{initialize.st => cards.st} (55%) delete mode 100644 RoloLudo.package/DeckOfCards.class/instance/cards..st create mode 100644 RoloLudo.package/FirelightsGame.class/instance/deck..st create mode 100644 RoloLudo.package/FirelightsGame.class/instance/export.st create mode 100644 RoloLudo.package/FirelightsGame.class/instance/resetWorlMap.st create mode 100644 RoloLudo.package/FirelightsGame.class/instance/story..st create mode 100644 RoloLudo.package/FirelightsGame.class/instance/story.st create mode 100644 RoloLudo.package/FirelightsGame.class/instance/uiGameFor..st create mode 100644 RoloLudo.package/FirelightsGame.class/instance/worldMap..st create mode 100644 RoloLudo.package/FirelightsGame.class/instance/worldMapDraw..st create mode 100644 RoloLudo.package/StoryNode.class/README.md create mode 100644 RoloLudo.package/StoryNode.class/instance/addCharacter..st create mode 100644 RoloLudo.package/StoryNode.class/instance/addPlace..st create mode 100644 RoloLudo.package/StoryNode.class/instance/characters.st create mode 100644 RoloLudo.package/StoryNode.class/instance/places.st create mode 100644 RoloLudo.package/StoryNode.class/instance/text..st create mode 100644 RoloLudo.package/StoryNode.class/instance/text.st create mode 100644 RoloLudo.package/StoryNode.class/properties.json diff --git a/RoloLudo.package/DeckOfCards.class/class/initialize.st b/RoloLudo.package/DeckOfCards.class/class/cards.st similarity index 55% rename from RoloLudo.package/DeckOfCards.class/class/initialize.st rename to RoloLudo.package/DeckOfCards.class/class/cards.st index 9614ccc..07bb387 100644 --- a/RoloLudo.package/DeckOfCards.class/class/initialize.st +++ b/RoloLudo.package/DeckOfCards.class/class/cards.st @@ -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 \ No newline at end of file diff --git a/RoloLudo.package/DeckOfCards.class/instance/cards..st b/RoloLudo.package/DeckOfCards.class/instance/cards..st deleted file mode 100644 index 64f0301..0000000 --- a/RoloLudo.package/DeckOfCards.class/instance/cards..st +++ /dev/null @@ -1,3 +0,0 @@ -accessing -cards: aCollection - cards := aCollection \ No newline at end of file diff --git a/RoloLudo.package/DeckOfCards.class/instance/cards.st b/RoloLudo.package/DeckOfCards.class/instance/cards.st index a762a6b..b7340d2 100644 --- a/RoloLudo.package/DeckOfCards.class/instance/cards.st +++ b/RoloLudo.package/DeckOfCards.class/instance/cards.st @@ -1,3 +1,3 @@ accessing cards - ^ cards ifNil: [ cards := OrderedCollection new] \ No newline at end of file + ^ self class cards \ No newline at end of file diff --git a/RoloLudo.package/DeckOfCards.class/instance/reset.st b/RoloLudo.package/DeckOfCards.class/instance/reset.st index 4b96ab0..0cc5517 100644 --- a/RoloLudo.package/DeckOfCards.class/instance/reset.st +++ b/RoloLudo.package/DeckOfCards.class/instance/reset.st @@ -1,5 +1,5 @@ accessing reset self drawn: OrderedCollection new. - self cards: self class initialize cards. + self stock: self class cards. ^ self \ No newline at end of file diff --git a/RoloLudo.package/DeckOfCards.class/instance/stock.st b/RoloLudo.package/DeckOfCards.class/instance/stock.st index af992f2..3116de3 100644 --- a/RoloLudo.package/DeckOfCards.class/instance/stock.st +++ b/RoloLudo.package/DeckOfCards.class/instance/stock.st @@ -1,3 +1,3 @@ accessing stock - ^ stock := self cards copyWithoutAll: self drawn \ No newline at end of file + ^ stock := self class cards copyWithoutAll: self drawn \ No newline at end of file diff --git a/RoloLudo.package/DeckOfCards.class/properties.json b/RoloLudo.package/DeckOfCards.class/properties.json index 4b8fce1..49326ee 100644 --- a/RoloLudo.package/DeckOfCards.class/properties.json +++ b/RoloLudo.package/DeckOfCards.class/properties.json @@ -6,7 +6,6 @@ "pools" : [ ], "classvars" : [ ], "instvars" : [ - "cards", "drawn", "stock" ], diff --git a/RoloLudo.package/FirelightsGame.class/instance/deck..st b/RoloLudo.package/FirelightsGame.class/instance/deck..st new file mode 100644 index 0000000..d872bde --- /dev/null +++ b/RoloLudo.package/FirelightsGame.class/instance/deck..st @@ -0,0 +1,3 @@ +accessing +deck: anObject + deck := anObject \ No newline at end of file diff --git a/RoloLudo.package/FirelightsGame.class/instance/deck.st b/RoloLudo.package/FirelightsGame.class/instance/deck.st index 98bbfd8..30e4201 100644 --- a/RoloLudo.package/FirelightsGame.class/instance/deck.st +++ b/RoloLudo.package/FirelightsGame.class/instance/deck.st @@ -1,3 +1,3 @@ accessing deck - ^ deck ifNil: [ deck := DeckOfCards initialize] \ No newline at end of file + ^ deck ifNil: [ deck := DeckOfCards new] \ No newline at end of file diff --git a/RoloLudo.package/FirelightsGame.class/instance/export.st b/RoloLudo.package/FirelightsGame.class/instance/export.st new file mode 100644 index 0000000..172780f --- /dev/null +++ b/RoloLudo.package/FirelightsGame.class/instance/export.st @@ -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) \ No newline at end of file diff --git a/RoloLudo.package/FirelightsGame.class/instance/resetWorlMap.st b/RoloLudo.package/FirelightsGame.class/instance/resetWorlMap.st new file mode 100644 index 0000000..158cd03 --- /dev/null +++ b/RoloLudo.package/FirelightsGame.class/instance/resetWorlMap.st @@ -0,0 +1,4 @@ +accessing +resetWorlMap + self worldMap: nil. + self deck reset. \ No newline at end of file diff --git a/RoloLudo.package/FirelightsGame.class/instance/story..st b/RoloLudo.package/FirelightsGame.class/instance/story..st new file mode 100644 index 0000000..d191033 --- /dev/null +++ b/RoloLudo.package/FirelightsGame.class/instance/story..st @@ -0,0 +1,3 @@ +accessing +story: anObject + story := anObject \ No newline at end of file diff --git a/RoloLudo.package/FirelightsGame.class/instance/story.st b/RoloLudo.package/FirelightsGame.class/instance/story.st new file mode 100644 index 0000000..9e0e166 --- /dev/null +++ b/RoloLudo.package/FirelightsGame.class/instance/story.st @@ -0,0 +1,3 @@ +accessing +story + ^ story ifNil: [ story := OrderedCollection new] \ No newline at end of file diff --git a/RoloLudo.package/FirelightsGame.class/instance/uiGameFor..st b/RoloLudo.package/FirelightsGame.class/instance/uiGameFor..st new file mode 100644 index 0000000..1de36d1 --- /dev/null +++ b/RoloLudo.package/FirelightsGame.class/instance/uiGameFor..st @@ -0,0 +1,13 @@ +accessing +uiGameFor: aView + + | 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 ] \ No newline at end of file diff --git a/RoloLudo.package/FirelightsGame.class/instance/worldMap..st b/RoloLudo.package/FirelightsGame.class/instance/worldMap..st new file mode 100644 index 0000000..6cd5d24 --- /dev/null +++ b/RoloLudo.package/FirelightsGame.class/instance/worldMap..st @@ -0,0 +1,3 @@ +accessing +worldMap: anObject + wordMap := anObject \ No newline at end of file diff --git a/RoloLudo.package/FirelightsGame.class/instance/worldMapDraw..st b/RoloLudo.package/FirelightsGame.class/instance/worldMapDraw..st new file mode 100644 index 0000000..5c7181a --- /dev/null +++ b/RoloLudo.package/FirelightsGame.class/instance/worldMapDraw..st @@ -0,0 +1,5 @@ +accessing +worldMapDraw: aCardCollection + self deck drawn addAll: aCardCollection. + self worldMap addAll: aCardCollection. + \ No newline at end of file diff --git a/RoloLudo.package/FirelightsGame.class/properties.json b/RoloLudo.package/FirelightsGame.class/properties.json index f769e72..2de8ecf 100644 --- a/RoloLudo.package/FirelightsGame.class/properties.json +++ b/RoloLudo.package/FirelightsGame.class/properties.json @@ -11,7 +11,8 @@ "wordMap", "oracles", "wiki", - "characters" + "characters", + "story" ], "name" : "FirelightsGame", "type" : "normal" diff --git a/RoloLudo.package/StoryNode.class/README.md b/RoloLudo.package/StoryNode.class/README.md new file mode 100644 index 0000000..e69de29 diff --git a/RoloLudo.package/StoryNode.class/instance/addCharacter..st b/RoloLudo.package/StoryNode.class/instance/addCharacter..st new file mode 100644 index 0000000..c8b82cf --- /dev/null +++ b/RoloLudo.package/StoryNode.class/instance/addCharacter..st @@ -0,0 +1,3 @@ +accessing +addCharacter: aCharacter + self characters add: aCharacter \ No newline at end of file diff --git a/RoloLudo.package/StoryNode.class/instance/addPlace..st b/RoloLudo.package/StoryNode.class/instance/addPlace..st new file mode 100644 index 0000000..908b3fa --- /dev/null +++ b/RoloLudo.package/StoryNode.class/instance/addPlace..st @@ -0,0 +1,3 @@ +accessing +addPlace: aPlaceCard + self places add: aPlaceCard \ No newline at end of file diff --git a/RoloLudo.package/StoryNode.class/instance/characters.st b/RoloLudo.package/StoryNode.class/instance/characters.st new file mode 100644 index 0000000..8dc0109 --- /dev/null +++ b/RoloLudo.package/StoryNode.class/instance/characters.st @@ -0,0 +1,3 @@ +accessing +characters + ^ characters ifNil: [ characters := Set new] \ No newline at end of file diff --git a/RoloLudo.package/StoryNode.class/instance/places.st b/RoloLudo.package/StoryNode.class/instance/places.st new file mode 100644 index 0000000..b8da09e --- /dev/null +++ b/RoloLudo.package/StoryNode.class/instance/places.st @@ -0,0 +1,3 @@ +accessing +places + ^ places ifNil: [ places := Set new] \ No newline at end of file diff --git a/RoloLudo.package/StoryNode.class/instance/text..st b/RoloLudo.package/StoryNode.class/instance/text..st new file mode 100644 index 0000000..b540f41 --- /dev/null +++ b/RoloLudo.package/StoryNode.class/instance/text..st @@ -0,0 +1,3 @@ +accessing +text: aString + text := aString \ No newline at end of file diff --git a/RoloLudo.package/StoryNode.class/instance/text.st b/RoloLudo.package/StoryNode.class/instance/text.st new file mode 100644 index 0000000..3251dea --- /dev/null +++ b/RoloLudo.package/StoryNode.class/instance/text.st @@ -0,0 +1,3 @@ +accessing +text + ^ text \ No newline at end of file diff --git a/RoloLudo.package/StoryNode.class/properties.json b/RoloLudo.package/StoryNode.class/properties.json new file mode 100644 index 0000000..fdbf769 --- /dev/null +++ b/RoloLudo.package/StoryNode.class/properties.json @@ -0,0 +1,16 @@ +{ + "commentStamp" : "", + "super" : "Object", + "category" : "RoloLudo", + "classinstvars" : [ ], + "pools" : [ ], + "classvars" : [ ], + "instvars" : [ + "text", + "characters", + "places", + "inspirations" + ], + "name" : "StoryNode", + "type" : "normal" +} \ No newline at end of file