Allows spending freebie points on disciplines and attributes.

This commit is contained in:
2023-04-13 22:59:28 -07:00
parent 97352b489e
commit 5e27ff5b89
3 changed files with 523 additions and 332 deletions

View File

@@ -223,6 +223,13 @@ Const DERANGEMENT_DESCRIPTION_PARANOIA = "You are convinced that you are being h
Const DERANGEMENT_DESCRIPTION_PERFECTION = "All your energy is directed toward preventing anything from going wong. When it does you must make a self-control roll or frenzy." Const DERANGEMENT_DESCRIPTION_PERFECTION = "All your energy is directed toward preventing anything from going wong. When it does you must make a self-control roll or frenzy."
Const DERANGEMENT_DESCRIPTION_REGRESSION = "You become childlike retreating to an earlier time when less was expected of you Willpower is regained inthe way a Child's is." Const DERANGEMENT_DESCRIPTION_REGRESSION = "You become childlike retreating to an earlier time when less was expected of you Willpower is regained inthe way a Child's is."
Const FREEBIE_POINT_COST_DISCIPLINE = 7
Const FREEBIE_POINT_COST_ATTRIBUTE = 5
Const FREEBIE_POINT_COST_ABIILTY = 2
Const FREEBIE_POINT_COST_VIRTUE = 2
Const FREEBIE_POINT_COST_HUMANITY = 1
Const FREEBIE_POINT_COST_BACKGROUND = 1
Type CharacterType Type CharacterType
name As String name As String
player As String player As String
@@ -243,6 +250,7 @@ Type CharacterType
willpower As Integer willpower As Integer
bloodPool As Integer bloodPool As Integer
derangementId As Integer derangementId As Integer
freebiePoints As Integer
' Disciplines ' Disciplines
discipline_animalism As Integer discipline_animalism As Integer
discipline_auspex As Integer discipline_auspex As Integer

View File

@@ -234,6 +234,7 @@ Sub NewCharacter (ch As CharacterType)
ch.willpower = 0 ch.willpower = 0
ch.bloodPool = 0 ch.bloodPool = 0
ch.derangementId = -1 ch.derangementId = -1
ch.freebiePoints = 15
' Virtues ' Virtues
ch.selfControl = 1 ch.selfControl = 1
ch.courage = 1 ch.courage = 1
@@ -418,6 +419,14 @@ Sub FillVirtues (ch As CharacterType, values() As Integer)
Next Next
End Sub End Sub
Function GetFreebiePoints(ch as CharacterType)
GetFreebiePoints = ch.freebiePoints
End Function
Sub SetFreebiePoints(ch As CharacterType, points As Integer)
ch.freebiepoints = points
End Sub
' Attributes ' Attributes
Sub FillAttributeValues (ch As CharacterType, values() As Integer, groupIndex As Integer) Sub FillAttributeValues (ch As CharacterType, values() As Integer, groupIndex As Integer)

View File

@@ -229,6 +229,21 @@ Function ChooseStringIdWithValues (labels() As String, values() As Integer, styl
ChooseStringIdWithValues = choice ChooseStringIdWithValues = choice
End Function End Function
Function ChooseStringIdWithValuesAndCancel (labels() As String, values() As Integer, style As MenuStyle, count As Integer, prompt As String)
MaybeCls
Dim mnuItems(1 To count + 1) As MenuItem
Call BuildMenuWithValues(mnuItems(), labels(), values(), count)
Dim cancelMenuItem As MenuItem
Call NewMenuItemWithValue(cancelMenuItem, "Cancel", count + 1, -1)
mnuItems(count + 1) = cancelMenuItem
Call AdjustMenuStyle(style, mnuItems(), count, FALSE)
Print prompt
Call PrintMenu(mnuItems(), count, style)
choice = GetMenuChoice(mnuItems(), style, count)
If choice = style.randomItemId Then choice = GetRandomMenuItemId(mnuItems(), count - 1)
ChooseStringIdWithValuesAndCancel = choice
End Function
Function ChooseStringIdWithColors (labels() As String, colors() As Integer, style As MenuStyle, prompt As String) Function ChooseStringIdWithColors (labels() As String, colors() As Integer, style As MenuStyle, prompt As String)
MaybeCls MaybeCls
' Check array bounds ' Check array bounds
@@ -429,6 +444,165 @@ Sub CGGetDerangement (ch As CharacterType)
End Sub End Sub
Sub CGSpendFreebiePoints (ch As CharacterType) Sub CGSpendFreebiePoints (ch As CharacterType)
freebiePoints = GetFreebiePoints(ch)
Dim ms As MenuStyle
Call NewMenuStyle(ms)
Dim labels(1 To 7) As String
Dim menuItemIds(1 To 7) As Integer
' TODO: Find a better way to handle these menuItemIds mabye a new Choose* function and some constants
While (freebiePoints > 0)
MaybeCls
Print "freebiePoints = "; itos$(freebiePoints)
' Build the menu
numMenuItems = 0
If freebiePoints >= FREEBIE_POINT_COST_DISCIPLINE Then
numMenuItems = numMenuItems + 1
menuItemIds(numMenuItems) = 1
labels(numMenuItems) = "Add a discipline dot 7 points"
End If
If freebiePoints >= FREEBIE_POINT_COST_ATTRIBUTE Then
numMenuItems = numMenuItems + 1
menuItemIds(numMenuItems) = 2
labels(numMenuItems) = "Add an attribute dot 5 points"
End If
If freebiePoints >= FREEBIE_POINT_COST_ability Then
numMenuItems = numMenuItems + 1
menuItemIds(numMenuItems) = 3
labels(numMenuItems) = "Add an ability dot 2 points"
End If
If freebiePoints >= FREEBIE_POINT_COST_VIRTUE Then
numMenuItems = numMenuItems + 1
menuItemIds(numMenuItems) = 4
labels(numMenuItems) = "Add a virtue dot 2 points"
End If
If freebiePoints >= FREEBIE_POINT_COST_HUMANITY Then
' TODO: Make this configurable for VtDA
numMenuItems = numMenuItems + 1
menuItemIds(numMenuItems) = 5
labels(numMenuItems) = "Add a humanity dot 1 point"
End If
If freebiePoints >= FREEBIE_POINT_COST_BACKGROUND Then
numMenuItems = numMenuItems + 1
menuItemIds(numMenuItems) = 6
labels(numMenuItems) = "Add a background dot 1 point"
End If
' TODO: Exclude this option from the randomized Ids. Maybe use a different Choose* function or just do it here.
numMenuItems = numMenuItems + 1
menuItemIds(numMenuItems) = 7
labels(numMenuItems) = "Show character sheet"
prompt$ = "You have " + itos$(freebiePoints) + " freebie points remaining what would you like to spend the points on?"
id = ChooseStringId(labels(), ms, numMenuItems, prompt$)
Select Case menuItemIds(id)
Case 1
Call CGSpendDisciplinePoint(ch)
Case 2
Call CGSpendAttributePoint(ch)
Case 3
Call CGSpendAbilityPoint(ch)
Case 4
Call CGSpendVirtuePoint(ch)
Case 5
Call CGSpendHumanityPoint(ch)
Case 6
Call CGSpendBackgroundPoint(ch)
Case 7
Call ShowCharacterSheet(ch)
End Select
freebiePoints = GetFreebiePoints(ch)
Wend
End Sub
Sub CGSpendDisciplinePoint (ch As CharacterType)
MaybeCls
Dim ms As MenuStyle
Call NewMenuStyle(ms)
Dim disciplineValues(DISCIPLINES_COUNT) As Integer
Call FillDisciplines(ch, disciplineValues())
discipline = ChooseStringIdWithValuesAndCancel(Disciplines(), disciplineValues(), ms, DISCIPLINES_COUNT, "Which discipline do you want to spend 1 of your " + itos$(disciplinePoints) + " points on?")
If discipline > 0 Then
Call SetDiscipline(ch, discipline, GetDiscipline(ch, discipline) + 1)
Call SetFreebiePoints(ch, GetFreebiePoints(ch) - 7)
End If
End Sub
Type AttributeReference
id As Integer
groupIndex As Integer
attributeIndex As Integer
End Type
Sub CGSpendAttributePoint (ch As CharacterType)
MaybeCls
'TODO: Paragraph
'Choose an attribute maybe choose a group then choose an attribute, but try to only have the one choice.
'Allow cancel
'If an attribute was chosen then add that attribute point to ch and subtract 5 freebie points from ch
Print "TODO: Fill in CGSpendAttributePoint"
Dim ms As MenuStyle ' With values
Call NewMenuStyle(ms)
numAttributes = 0
Dim numAttributesInGroup(1 To ABILITY_GROUPS_COUNT) As Integer
For attributeGroupIndex = 1 To ABILITY_GROUPS_COUNT
numAttributesInGroup(attributeGroupIndex) = GetNumAttributesInGroup(attributeGroupIndex)
numAttributes = numAttributes + numAttributesInGroup(attributeGroupIndex)
Next
Dim attributes(numAttributes) As AttributeReference
Dim labels(numAttributes) As String
Dim values(numAttributes) As Integer
attributeIndex = 1
For attributeGroupIndex = 1 To ABILITY_GROUPS_COUNT
For index = 1 To numAttributesInGroup(attributeGroupIndex)
Dim attribute As AttributeReference
attribute.id = attributeIndex
attribute.groupIndex = attributeGroupIndex
attribute.attributeIndex = index
attributes(attributeIndex) = attribute
labels(attributeIndex) = GetAttributeName$(attributeGroupIndex, index)
values(attributeIndex) = GetAttributeValue(ch, attributeGroupIndex, index)
attributeIndex = attributeIndex + 1
Next
Next
attributeIndex = ChooseStringIdWithValuesAndCancel(labels(), values(), ms, numAttributes, "Which attribute do you want to add one dot to?")
If attributeIndex > 0 Then
Dim attr As AttributeReference
attr = attributes(attributeIndex)
Call SetAttributeValue(ch, attr.groupIndex, attr.attributeIndex, GetAttributeValue(ch, at.groupindex, at.attributeindex) + 1)
Call SetFreebiePoints(ch, GetFreebiePoints(ch) - 5)
End If
End Sub
Sub CGSpendAbilityPoint (ch As CharacterType)
'TODO: Paragraph
'Choose an abililty group; Allow cancel
'Choose an ability; Allow cancel
'If an ability was chosen then add that ability point to ch and subtract 2 freebie points
Print "TODO: Fill in CGSpendAbilityPoint"
End Sub
Sub CGSpendVirtuePoint (ch As CharacterType)
'TODO: Paragraph
'Choose a virtue; Allow cancel
'If a virtue was chosen that add that virtue point to ch and subtract 2 freebie points.
Print "TODO: Fill in CGSpendVirtuePoint"
End Sub
Sub CGSpendHumanityPoint (ch As CharacterType)
'TODO: Paragraph
'Confirm they want to add the point
'If they say yes then add the humanity point to ch and subtract 1 freebie point.
Print "TODO: Fill in CGSpendHumanityPoint"
End Sub
Sub CGSpendBackgroundPoint (ch As CharacterType)
'TODO: Paragraph
'Choose a background; Allow cancel
'If they chose a background then add the background and subtract 1 freebie point.
Print "TODO: Fill in CGSpendBackgroundPoint"
End Sub End Sub
' Ignore this warning ch is not used yet because the sub is not implemented yet. ' Ignore this warning ch is not used yet because the sub is not implemented yet.