|
1 | | -#if STS2_V_0_103_2 |
| 1 | +#if !STS2_AT_LEAST_0_104_0 |
2 | 2 | using CombatStateCompat = MegaCrit.Sts2.Core.Combat.CombatState; |
3 | 3 | #else |
4 | 4 | using CombatStateCompat = MegaCrit.Sts2.Core.Combat.ICombatState; |
5 | 5 | #endif |
6 | 6 | using MegaCrit.Sts2.Core.Combat; |
7 | 7 | using MegaCrit.Sts2.Core.Entities.Cards; |
8 | 8 | using MegaCrit.Sts2.Core.Entities.Creatures; |
| 9 | +using MegaCrit.Sts2.Core.Entities.Players; |
9 | 10 | using MegaCrit.Sts2.Core.Models; |
10 | 11 | using MegaCrit.Sts2.Core.Rooms; |
11 | 12 | using MegaCrit.Sts2.Core.Runs; |
@@ -161,15 +162,54 @@ DateTimeOffset OccurredAtUtc |
161 | 162 | /// <summary> |
162 | 163 | /// A card was retained for the next turn. |
163 | 164 | /// </summary> |
| 165 | + /// <remarks> |
| 166 | + /// On host API 0.105.0 and newer the underlying <c>Hook.AfterCardRetained</c> callback no longer exists; this event |
| 167 | + /// is replayed per retained card from <c>Hook.AfterFlush</c> for backward compatibility. Subscribe to |
| 168 | + /// <see cref="CardsFlushedEvent" /> instead to also observe the matching flushed cards and the player. |
| 169 | + /// </remarks> |
164 | 170 | /// <param name="CombatState">Active combat state.</param> |
165 | 171 | /// <param name="Card">Retained card.</param> |
166 | 172 | /// <param name="OccurredAtUtc">When the event was raised.</param> |
| 173 | + [Obsolete( |
| 174 | + "Use CardsFlushedEvent. CardRetainedEvent is replayed from Hook.AfterFlush on host API 0.105.0 and newer.")] |
167 | 175 | public readonly record struct CardRetainedEvent( |
168 | 176 | CombatStateCompat CombatState, |
169 | 177 | CardModel Card, |
170 | 178 | DateTimeOffset OccurredAtUtc |
171 | 179 | ) : IFrameworkLifecycleEvent; |
172 | 180 |
|
| 181 | + /// <summary> |
| 182 | + /// A flush sequence is about to run for the given player. Mirrors <c>Hook.BeforeFlush</c>. |
| 183 | + /// </summary> |
| 184 | + /// <param name="CombatState">Active combat state.</param> |
| 185 | + /// <param name="Player">Player whose hand is about to be flushed.</param> |
| 186 | + /// <param name="OccurredAtUtc">When the event was raised.</param> |
| 187 | + public readonly record struct BeforeFlushEvent( |
| 188 | + CombatStateCompat CombatState, |
| 189 | + Player Player, |
| 190 | + DateTimeOffset OccurredAtUtc |
| 191 | + ) : IFrameworkLifecycleEvent; |
| 192 | + |
| 193 | + /// <summary> |
| 194 | + /// Hand flush completed for the given player. |
| 195 | + /// </summary> |
| 196 | + /// <remarks> |
| 197 | + /// Fired from <c>Hook.AfterFlush</c> on host API 0.105.0 and newer. On older host APIs <c>Hook.AfterFlush</c> does |
| 198 | + /// not exist and this event is not raised; use the legacy <see cref="CardRetainedEvent" /> there. |
| 199 | + /// </remarks> |
| 200 | + /// <param name="CombatState">Active combat state.</param> |
| 201 | + /// <param name="Player">Player whose hand was flushed.</param> |
| 202 | + /// <param name="FlushedCards">Cards that left the hand during flush (non-retained).</param> |
| 203 | + /// <param name="RetainedCards">Cards that stayed in the hand (retain semantics).</param> |
| 204 | + /// <param name="OccurredAtUtc">When the event was raised.</param> |
| 205 | + public readonly record struct CardsFlushedEvent( |
| 206 | + CombatStateCompat CombatState, |
| 207 | + Player Player, |
| 208 | + IReadOnlyCollection<CardModel> FlushedCards, |
| 209 | + IReadOnlyCollection<CardModel> RetainedCards, |
| 210 | + DateTimeOffset OccurredAtUtc |
| 211 | + ) : IFrameworkLifecycleEvent; |
| 212 | + |
173 | 213 | /// <summary> |
174 | 214 | /// A creature is dying (HP reached zero or equivalent). |
175 | 215 | /// </summary> |
|
0 commit comments