Skip to content

Commit 8553504

Browse files
- Fixed Act 2 Tutor sequence softlocking when there are no cards to display
- Fixed Act 2 Tutor sequence not displaying cards when you have less than 7 cards remaining in your deck
1 parent 0394d8e commit 8553504

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# 2.23.4
22
- Fixed GemsDraw only considering the player's slots when determining how many cards to draw
3+
- Fixed Act 2 Tutor sequence softlocking when there are no cards to display
4+
- Fixed Act 2 Tutor sequence not displaying cards when you have less than 7 cards remaining in your deck
35
- Fixed Gemify affecting Blood cost when it shouldn't
46
- Added Gems Cost support for ExtendedActivatedAbilityBehaviour class
57
- Added extension AbilityManager.FullAbility.FlipYIfOpponent

InscryptionCommunityPatch/PixelTutor/PixelPlayableCardArray.cs

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,11 @@ protected IEnumerator CleanUpCards()
235235

236236
protected IEnumerator SpawnAndPlaceCards(List<CardInfo> cards, int numRows, int pageIndex, bool isDeckReview = false, bool forPositiveEffect = true)
237237
{
238+
if (numRows < 1) {
239+
PatchPlugin.Logger.LogDebug($"NumRows for PixelPlayableCardArray is 0, displaying no cards");
240+
yield break;
241+
}
242+
238243
SetOverlayEnabled(true);
239244
SetBoardEnabled(false);
240245
displayedCards.ForEach(delegate (PixelPlayableCard x)
@@ -244,11 +249,6 @@ protected IEnumerator SpawnAndPlaceCards(List<CardInfo> cards, int numRows, int
244249
});
245250
displayedCards.Clear();
246251

247-
if (numRows < 1)
248-
{
249-
PatchPlugin.Logger.LogDebug($"NumRows for PixelPlayableCardArray is 0, displaying no cards");
250-
yield break;
251-
}
252252
// can only show 42 cards per page
253253
int maxPerPage = maxRows * maxCardsPerRow;
254254
int startingIndex = maxPerPage * pageIndex;
@@ -296,18 +296,17 @@ private void InitializeGamepadGrid()
296296
private PixelPlayableCard CreateAndPlaceCard(CardInfo info, Vector3 cardPos)
297297
{
298298
PixelPlayableCard component = Instantiate(gameObjectReference, base.transform);
299+
component.transform.position = Vector3.zeroVector;
300+
component.SetInfo(info);
301+
component.SetFaceDown(false, true);
302+
component.SetEnabled(enabled: false);
299303

300304
PixelCardAnimationController controller = component.Anim as PixelCardAnimationController;
301305
controller.cardRenderer.sortingGroupID = gameObjectReference.Anim.cardRenderer.sortingGroupID;
302306
controller.cardbackRenderer.sortingGroupID = gameObjectReference.Anim.cardRenderer.sortingGroupID;
303307
controller.cardRenderer.sortingOrder = -9000;
304308
controller.cardbackRenderer.sortingOrder = -8000;
305309

306-
component.SetFaceDown(false, true);
307-
component.SetInfo(info);
308-
component.SetEnabled(enabled: false);
309-
component.transform.position = Vector3.zeroVector;
310-
311310
gamepadGrid.Rows[0].interactables.Add(component);
312311
displayedCards.Add(component);
313312
TweenInCard(component.transform, cardPos);
@@ -338,7 +337,15 @@ private void SetOverlayEnabled(bool enabled)
338337
}
339338
}
340339

341-
private int GetNumRows(int numCards) => Mathf.Min(maxRows, numCards / maxCardsPerRow);
340+
private int GetNumRows(int numCards) {
341+
if (numCards == 0)
342+
return 0;
343+
344+
if (numCards < maxCardsPerRow)
345+
return 1;
346+
347+
return Mathf.Min(maxRows, numCards / maxCardsPerRow);
348+
}
342349
private void SetCardsEnabled(bool enabled) => displayedCards.ForEach(x => x.SetEnabled(enabled));
343350
private void SetBoardEnabled(bool enabled)
344351
{

0 commit comments

Comments
 (0)