Refactoring. New and improved SfPlayerCharacter to model character sheets.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2021-11-17 11:14:12 -05:00
parent 62756bf703
commit 40ab1d0000
25 changed files with 97 additions and 21 deletions

View File

@ -0,0 +1 @@
I model a simple bot to automatize some tasks related with rolling oracles, character creation and playin in general.

View File

@ -1,7 +1,9 @@
accessing accessing
newRandomPlayerCharacter newRandomPlayerCharacter
^ SfPlayerCharacter new ^ SfPlayerCharacter new
momentum; momentum: 2;
maxMomentum: 10;
momentumReset: 2;
health: 5; health: 5;
spirit: 5; spirit: 5;
supply: 5. supply: 5.

View File

@ -0,0 +1,11 @@
accessing
rollDice
"For the moment, I will model a dice roll in Ironsworn Starforged.
A more abstract vocabulary should be deviced allowing the roll of
dice pool"
^ OrderedDictionary new
at: 'challenge die (1):' put: 10 atRandom;
at: 'action die:' put: 6 atRandom;
at: 'challenge die (2):' put: 10 atRandom;
yourself.

View File

@ -1,5 +1,5 @@
{ {
"commentStamp" : "", "commentStamp" : "<historical>",
"super" : "Object", "super" : "Object",
"category" : "RoloLudo", "category" : "RoloLudo",
"classinstvars" : [ ], "classinstvars" : [ ],

View File

@ -2,6 +2,7 @@ accessing
fromDictionary: aDictionary fromDictionary: aDictionary
| optionsTable | | optionsTable |
name := aDictionary at: 'Name' ifAbsent: [ name := aDictionary at: 'Display name' ]. name := aDictionary at: 'Name' ifAbsent: [ name := aDictionary at: 'Display name' ].
intro := aDictionary at: 'Description'.
optionsTable := aDictionary at: 'Table'. optionsTable := aDictionary at: 'Table'.
optionsTable doWithIndex: [:opt :i | | key value prevKey | optionsTable doWithIndex: [:opt :i | | key value prevKey |
(i = 1) (i = 1)

View File

@ -0,0 +1,4 @@
accessing
edge: anRagedInteger
"Edge: Quickness, agility, and prowess when fighting at a distance"
edge := anRagedInteger

View File

@ -0,0 +1,4 @@
accessing
edge
^ edge

View File

@ -0,0 +1,4 @@
accessing
heart: integerBetween1and3
"Heart: Courage, willpower, empathy, sociability, and loyalty"
heart := integerBetween1and3

View File

@ -0,0 +1,4 @@
accessing
heart
^ heart

View File

@ -0,0 +1,4 @@
accessing
iron: integerBetween1and3
"Iron: Physical strength, endurance, aggressiveness, and prowess when fighting at close quarters"
iron := integerBetween1and3

View File

@ -0,0 +1,4 @@
accessing
iron
^ iron

View File

@ -0,0 +1,4 @@
accessing
maxMomentum: anObject
maxMomentum := anObject

View File

@ -0,0 +1,4 @@
accessing
maxMomentum
^ maxMomentum

View File

@ -1,4 +1,4 @@
accessing accessing
momentum: anObject momentum: anInteger
momentum := anObject momentum := anInteger

View File

@ -1,8 +1,3 @@
accessing accessing
momentum momentum
^ momentum ifNil: [ ^ momentum
momentum := Dictionary new
at: 'max' put: 10;
at: 'reset' put: 2;
at: 'current' put: 2.
]

View File

@ -0,0 +1,4 @@
accessing
momentumReset: anObject
momentumReset := anObject

View File

@ -0,0 +1,4 @@
accessing
momentumReset
^ momentumReset

View File

@ -0,0 +1,4 @@
accessing
shadow: integerBetween1And3
"Shadow: Sneakiness, deceptiveness, and cunning"
shadow := integerBetween1And3

View File

@ -0,0 +1,4 @@
accessing
shadow
^ shadow

View File

@ -1,4 +0,0 @@
accessing
stats: anObject
stats := anObject

View File

@ -1,4 +1,12 @@
accessing accessing
stats stats
^ stats ^ Dictionary new
addAll: {
'Edge' -> self edge .
'Heart' -> self heart.
'Iron' -> self iron.
'Shadow' -> self shadow.
'Wits' -> self wits
};
yourself

View File

@ -1,4 +1,4 @@
accessing accessing
vows: anObject vows: aDictionary
vows := anObject vows := aDictionary

View File

@ -0,0 +1,4 @@
accessing
wits: aRangedInteger
"Wits: Expertise, knowledge, and observation"
wits := aRangedInteger

View File

@ -0,0 +1,4 @@
accessing
wits
^ wits

View File

@ -10,12 +10,18 @@
"pronouns", "pronouns",
"callsign", "callsign",
"assets", "assets",
"stats", "edge",
"heart",
"iron",
"shadow",
"wits",
"vows", "vows",
"momentum",
"health", "health",
"spirit", "spirit",
"supply" "supply",
"momentum",
"momentumReset",
"maxMomentum"
], ],
"name" : "SfPlayerCharacter", "name" : "SfPlayerCharacter",
"type" : "normal" "type" : "normal"