forked from Alchyr/BaseLib-StS2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotes.txt
More file actions
183 lines (134 loc) · 7.81 KB
/
Notes.txt
File metadata and controls
183 lines (134 loc) · 7.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
https://github.com/pawslee/il-guide
actually a very nice introduction
TODO
compendium options for custom pools
pools not linked to a character are added to the misc pool thing
does the side scroll if there are too many options?
Is the layout dynamic or does it need to be manually modified
config options for mods
Suggested modification:
up to 3 rows. If 3 rows is full, shrink and increase number of elements per row (and if shrunk enough add another row)
PlayCardAction : allow _card.SpendResources to spend custom resources, and also pass that value to a custom OnPlayWrapper if the card is a CustomCard?
Ideally works for non-CustomCard as well
NMouseCardPlay handles dragging before card is actually played
Notes
notable classes - CombatManager, RunManager
CombatState IterateHookListeners
for visuals - NThing for visual version
CardModel -> NCard
Cards must be added to current run state before used? unsure of reason yet
card description: CardModel.GetDescriptionForPile, called by NCard and set to its label
text is formatted through the SmartFormat library, using various extensions (see LocManager.LoadLocFormatters)
DamageVar -
BaseValue, EnchantedValue, PreviewValue
BaseValue is self explanatory
EnchantedValue is the "modified" base value, so something like +3 damage enchantments appear as the base value
PreviewValue is the "final" damage when applying all modifiers, and is compared to EnchantedValue to determine text color (if upgraded, always)
see CardModel.ToHighlightedString, which is called by HighlightDifferencesFormatter/HighlightDifferencesInverseFormatter when using .diff or .inverseDiff in card text json
NPlayerHand -> NHandCardHolder
->?
NCardPlay
card.TryManualPlay (null or target, depending on card's targettype) ->
CardModel EnqueueManualPlay ->
new PlayCardAction in RunManager ActionQueueSynchronizer RequestEnqueue
-> validity checks ->
CardModel OnPlayWrapper, does most of the actual card play
If card is not autoplay: CardPileCmd.AddDuringManualCardPlay
ensures NCard for visual exists
removes card from current pile
adds to "Play" pile
moves to play position
If autoplay: just add to play pile (and positions)
HOOK : Hook.ModifyCardPlayResultPileTypeAndPosition
CARDS -
ALL cards in combat are assumed to be in a pile (CardPile). If they are not in a pile, they will be treated as not in combat (no damage calc and similar).
What pile a card is in is checked inefficiently - iterate through all of owner's piles and return first contains result.
This means there is a *lot* of iteration of all cards in all piles. Might be a problem if someone has like a million cards.
Incombat card visuals -
NCombatUi ->
NPlayerHand -> CardHolderContainer/ActiveCardHolders
RefreshHandLayout still recalculates positions
NCombatUi calculates positions for cards in PlayContainerCards
NCombatUi.OnCombatSetup ->
Initialize draw/discard/exhaust pile containers (NCombatCardPile), connect to player piles when they are modified
(Not visual, since these are only visible properly when viewing their screens. These are just UI elements.)
CombatManager.SetUpCombat -> player.ResetCombatState -> new PlayerCombatState -> subscribe all piles to CombatManager.StateTracker, reset orb queue
Adds CombatState.OnCardPileContentsChanged to cardpile ContentsChanged event to trigger NotifyCombatStateChanged
(results in applyPowers equivalent, PlayerCombatState.RecalculateCardValues) WRONG, this is just enchantment recalculation?
NCard UpdateVisuals -> CardModel.UpdateDynamicVarPreview
Cards drawn -> CardPileCmd.Add (piletype.GetPile) ->
to combat pile and combat ending, all adding fails, return
for each card, if card owner dead, fail
card must be added to RunState before add to deck, add to CombatState before add to combat pile (see CardPileCmd.AddGeneratedCardsToCombat)
card add success marked as true, card owner set
if adding to deck, check additional conditions and maybe fail
if adding to combat pile and combat is over, return "results" without actually processing
Finally, for each "successful" card:
(if add to hand check hand size, move to discard instead if full)
Check if card has an NCard (NCard.FindOnTable, returns null for any piletype besides hand/play)
Remove card from old pile
Add to target pile
If add to combat pile and old pile null, trigger hook AfterCardEnteredCombat
card NCard.UpdateVisuals (if not null)
If no visuals and is visually moving between piles (to draw/discard/deck, not to hand), add to cardsWithoutNodesChangingPiles
Otherwise if no visuals and needed (probably to hand), CardPileCmd.CreateCardNodeAndUpdateVisuals
Generate tween to move card to target position. separate logic between to exhaust, hand, play, and default.
default determines position with Pile.Type.GetTargetPosition, and moves card to vfx and adds NCardFlyVfx. Card will vanish upon reaching destination.
----------------------------------------------------------------------------------------------------------
cardpilecmd.add
check basics like still in combat, card owner
for each card being moved:
if destination is hand, check if hand is full.
if hand full, change destination to discard pile.
flag = num2 = owning player local, or target pile is play pile, or old pile is play pile
if flag, find NCard.
flag2 = ncard null and (target is/was hand, or old pile is not null)
flag4 = flag3 = ncard does not exist
flag5 = ncard doesn't exist && oldpile not null and type is draw/discard/exhaust/deck
flag4 = flag5
then jumps converge to IL_0611
flag6 = flag4 (ncard does exists, or doesn't exist but old pile is draw/discard/exhaust/deck)
flag6 = no ncard, old pile is draw/discard/exhaust/deck, target is draw/discard/deck
if (flag6) add to cardsWithoutNodesChangingPiles
else if (flag2, ncard null and (target is/was hand || old pile not null)
cardNode = create node!!!! important!
add node to cardNodes list
jump to 069b
if Not Flag jump to 069b
069b
remove from old pile (if not null) !!!!
if old pile *is* null and target is deck,
modify card added to deck hook
add to target pile to position based on parameter
if old pile null and target pile is combat pile, trigger card entered combat hook
if full hand and is local player, show hand full message
if old pile null or its type is anything other than "play", or if moving to hand (VISIBLE), or if dupe
update visuals of NCard (if not null)
loop to next card
create tween under NCombatRoom.Instance
for each card node:
get its model (card3), get its old pile (from CardPileAddedResults in results)
MoveCardToNewPileBeforeTween
if card in play queue, remove
if card in hand, call hand.Remove
otherwise, call cardNode.GetParent()?.RemoveChildSafely
if target is play pile, add to playContainer (NCombatRoom, Ui.PlayContainer)
otherwise, NCombatRoom.Ui (NCombatUI) .AddChildSafely card
This is likely intended for temporarily visible cards? no logic for card interactivity
set cardNode global position to its global position (avoid position change when swapping parent?)
node.PlayPileTween?.Kill (remove positioning for play?)
flag8 = flag7 = owner Not Local
if flag8 (owner Not local)
flag8 = card pile type is none/draw/hand/discard/deck
if flag8 (owner not local and card pile type is none/draw/hand/discard/deck)
tween visuals (position and grey out?) callback after tween cardNode.QueueFreeSafely
move to next card
switch based on piletype and tween appropriately
and Also add card node to appropriate parent
for each card without card node changing piles
make vfx to fly from old location to new pile location (uses piletype.GetTargetPosition(null))
(see NCardFlyShuffleVfx)
if tween was created, play it and await NCombatRoom signal tween.finished
for each success in results, trigger AfterCardChangedPiles hook
return results
----------------------------------------------------------------------------------------------------------