Skip to content

Commit 0385ea3

Browse files
authored
Merge pull request #326 from HumabHatterZed/main
2.23.4 - Act 1 Gemify visuals and misc bug fixes
2 parents 2e9caa6 + d56a9c8 commit 0385ea3

18 files changed

+478
-205
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# 2.23.4
2+
- 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
5+
- Fixed Gemify affecting Blood cost when it shouldn't
6+
- Fixed emission textures appearing stretched on Giant cards
7+
- Added Gems Cost support for ExtendedActivatedAbilityBehaviour class
8+
- Added extension AbilityManager.FullAbility.FlipYIfOpponent
9+
- Add config option to prevent Act 1 card emissions from rendering above the play costs
10+
111
# 2.23.3
212
- Fixed custom deck exhaust sequence not performing the requisite checks
313
- Added 'CanAppearRandomly' bool and associated extension method for custom regions

InscryptionAPI/Card/AbilityExtensions.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,16 @@ public static AbilityInfo SetFlipYIfOpponent(this AbilityInfo abilityInfo, bool
424424
return abilityInfo;
425425
}
426426
/// <summary>
427+
/// Sets whether or not the ability's icon should be flipped upside-down when it's on an opponent card.
428+
/// </summary>
429+
/// <param name="abilityInfo">The instance of AbilityInfo.</param>
430+
/// <param name="flipY">If the icon should be flipped.</param>
431+
/// <returns>The same AbilityInfo so a chain can continue.</returns>
432+
public static FullAbility SetFlipYIfOpponent(this FullAbility fullAbility, bool flipY = true) {
433+
fullAbility.Info.SetFlipYIfOpponent(flipY);
434+
return fullAbility;
435+
}
436+
/// <summary>
427437
/// Sets whether or not the ability's icon's colour should be overridden, and what the override colour should be.
428438
/// The colour override only applies to the default ability icons; totem and merge icons are unaffected.
429439
/// </summary>

InscryptionAPI/Card/CostProperties.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public static List<GemType> ImprovedGemsCost(CardInfo instance)
128128

129129
public static bool ReduceGemifiedBlood(PlayableCard card, int? bloodCost = null)
130130
{
131-
return (bloodCost ?? OriginalBloodCost(card.Info)) > 0 && !ReduceGemifiedMox(card) && !ReduceGemifiedBones(card) && !ReduceGemifiedMox(card);
131+
return (bloodCost ?? OriginalBloodCost(card.Info)) > 0 && !ReduceGemifiedEnergy(card) && !ReduceGemifiedBones(card) && !ReduceGemifiedMox(card);
132132
}
133133
public static bool ReduceGemifiedMox(PlayableCard card, List<GemType> gemsCost = null)
134134
{

InscryptionAPI/Card/DamageShieldBehaviour.cs

Lines changed: 50 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using DiskCardGame;
22
using GBC;
3+
using InscryptionAPI.Helpers;
34
using InscryptionAPI.Helpers.Extensions;
45
using System.Collections;
56
using UnityEngine;
@@ -87,20 +88,34 @@ public abstract class ActivatedDamageShieldBehaviour : DamageShieldBehaviour
8788
public int bloodCostMod;
8889
public int bonesCostMod;
8990
public int energyCostMod;
91+
public List<GemType> gemsCostMod;
9092
public int healthCostMod;
9193

9294
public virtual int StartingBloodCost { get; }
9395
public virtual int StartingBonesCost { get; }
9496
public virtual int StartingEnergyCost { get; }
97+
public virtual List<GemType> StartingGemsCost { get; }
9598
public virtual int StartingHealthCost { get; }
9699
public virtual int OnActivateBloodCostMod { get; set; }
97100
public virtual int OnActivateBonesCostMod { get; set; }
98101
public virtual int OnActivateEnergyCostMod { get; set; }
102+
public virtual List<GemType> OnActivateGemsCostMod { get; set; }
103+
public virtual bool OnActivateGemsCostModRemovesGems { get; set; }
99104
public virtual int OnActivateHealthCostMod { get; set; }
100105

101106
public int BloodCost => Mathf.Max(0, StartingBloodCost + bloodCostMod);
102107
public int BonesCost => Mathf.Max(0, StartingBonesCost + bonesCostMod);
103108
public int EnergyCost => Mathf.Max(0, StartingEnergyCost + energyCostMod);
109+
public List<GemType> GemsCost {
110+
get {
111+
List<GemType> retval = new();
112+
if (StartingGemsCost != null && StartingGemsCost.Count > 0) {
113+
retval.AddRange(StartingGemsCost);
114+
}
115+
retval.AddRange(gemsCostMod);
116+
return retval;
117+
}
118+
}
104119
public int HealthCost => Mathf.Max(0, StartingHealthCost + healthCostMod);
105120

106121
public Dictionary<CardInfo, CardSlot> currentSacrificedCardInfos = new();
@@ -187,12 +202,29 @@ public sealed override IEnumerator OnActivatedAbility()
187202
yield break;
188203
}
189204
}
190-
if (OnActivateEnergyCostMod != 0)
191-
energyCostMod += OnActivateEnergyCostMod;
192-
if (OnActivateBonesCostMod != 0)
193-
bonesCostMod += OnActivateBonesCostMod;
194-
if (OnActivateHealthCostMod != 0)
195-
healthCostMod += OnActivateHealthCostMod;
205+
206+
int energyMod = OnActivateEnergyCostMod;
207+
int bonesMod = OnActivateBonesCostMod;
208+
List<GemType> gemsMod = OnActivateGemsCostMod;
209+
int healthMod = OnActivateHealthCostMod;
210+
211+
if (energyMod != 0)
212+
energyCostMod += energyMod;
213+
214+
if (bonesMod != 0)
215+
bonesCostMod += bonesMod;
216+
217+
if (gemsMod != null && gemsMod.Count > 0) {
218+
if (OnActivateGemsCostModRemovesGems) {
219+
gemsMod.ForEach(x => gemsCostMod.Remove(x));
220+
}
221+
else {
222+
gemsCostMod.AddRange(gemsMod);
223+
}
224+
}
225+
226+
if (healthMod != 0)
227+
healthCostMod += healthMod;
196228

197229
yield return PostActivate();
198230
currentSacrificedCardInfos.Clear();
@@ -296,18 +328,22 @@ private IEnumerator ChooseSacrifices()
296328
manager.currentSacrifices.Clear();
297329
}
298330

299-
private bool CanAfford()
300-
{
301-
if (BloodCost <= 0 || SacrificeValue() >= BloodCost)
302-
{
303-
if (base.Card.Health >= HealthCost)
304-
{
305-
if (Singleton<ResourcesManager>.Instance.PlayerEnergy >= EnergyCost)
306-
return Singleton<ResourcesManager>.Instance.PlayerBones >= BonesCost;
331+
private bool CanAfford() {
332+
// if no blood cost or we can fulfill our blood cost
333+
if (BloodCost < 1 || SacrificeValue() >= BloodCost) {
334+
// if we have enough health, Energy, and Bones
335+
if (base.Card.Health >= HealthCost && ResourcesManager.Instance.PlayerEnergy >= EnergyCost && ResourcesManager.Instance.PlayerBones >= BonesCost) {
336+
bool enoughOrange = ResourcesManagerHelpers.GemCount(!base.Card.OpponentCard, GemType.Orange) >= GemsCost.Count(x => x == GemType.Orange);
337+
bool enoughGreen = ResourcesManagerHelpers.GemCount(!base.Card.OpponentCard, GemType.Green) >= GemsCost.Count(x => x == GemType.Green);
338+
bool enoughBlue = ResourcesManagerHelpers.GemCount(!base.Card.OpponentCard, GemType.Blue) >= GemsCost.Count(x => x == GemType.Blue);
339+
340+
// if we have enough gems
341+
return enoughOrange && enoughGreen && enoughBlue;
307342
}
308343
}
309344
return false;
310345
}
346+
311347
private bool LearnMechanic() => SaveManager.SaveFile.IsPart2 && !ProgressionData.LearnedMechanic(MechanicsConcept.GBCActivatedAbilities);
312348
private int SacrificeValue()
313349
{

InscryptionAPI/Card/ExtendedActivatedAbilityBehaviour.cs

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using DiskCardGame;
22
using GBC;
33
using HarmonyLib;
4+
using InscryptionAPI.Helpers;
45
using InscryptionAPI.Helpers.Extensions;
56
using System.Collections;
67
using UnityEngine;
@@ -11,20 +12,34 @@ public abstract class ExtendedActivatedAbilityBehaviour : AbilityBehaviour
1112
public int bloodCostMod;
1213
public int bonesCostMod;
1314
public int energyCostMod;
15+
public List<GemType> gemsCostMod = new();
1416
public int healthCostMod;
1517

1618
public virtual int StartingBloodCost { get; }
1719
public virtual int StartingBonesCost { get; }
1820
public virtual int StartingEnergyCost { get; }
21+
public virtual List<GemType> StartingGemsCost { get; }
1922
public virtual int StartingHealthCost { get; }
2023
public virtual int OnActivateBloodCostMod { get; set; }
2124
public virtual int OnActivateBonesCostMod { get; set; }
2225
public virtual int OnActivateEnergyCostMod { get; set; }
26+
public virtual List<GemType> OnActivateGemsCostMod { get; set; }
27+
public virtual bool OnActivateGemsCostModRemovesGems { get; set; }
2328
public virtual int OnActivateHealthCostMod { get; set; }
2429

2530
public int BloodCost => Mathf.Max(0, StartingBloodCost + bloodCostMod);
2631
public int BonesCost => Mathf.Max(0, StartingBonesCost + bonesCostMod);
2732
public int EnergyCost => Mathf.Max(0, StartingEnergyCost + energyCostMod);
33+
public List<GemType> GemsCost {
34+
get {
35+
List<GemType> retval = new();
36+
if (StartingGemsCost != null && StartingGemsCost.Count > 0) {
37+
retval.AddRange(StartingGemsCost);
38+
}
39+
retval.AddRange(gemsCostMod);
40+
return retval;
41+
}
42+
}
2843
public int HealthCost => Mathf.Max(0, StartingHealthCost + healthCostMod);
2944

3045
public Dictionary<CardInfo, CardSlot> currentSacrificedCardInfos = new();
@@ -93,8 +108,9 @@ public sealed override IEnumerator OnActivatedAbility()
93108
}
94109
}
95110
}
96-
if (BonesCost > 0)
111+
if (BonesCost > 0) {
97112
yield return Singleton<ResourcesManager>.Instance.SpendBones(BonesCost);
113+
}
98114

99115
yield return new WaitForSeconds(0.1f);
100116
yield return base.PreSuccessfulTriggerSequence();
@@ -111,12 +127,28 @@ public sealed override IEnumerator OnActivatedAbility()
111127
yield break;
112128
}
113129
}
114-
if (OnActivateEnergyCostMod != 0)
115-
energyCostMod += OnActivateEnergyCostMod;
116-
if (OnActivateBonesCostMod != 0)
117-
bonesCostMod += OnActivateBonesCostMod;
118-
if (OnActivateHealthCostMod != 0)
119-
healthCostMod += OnActivateHealthCostMod;
130+
int energyMod = OnActivateEnergyCostMod;
131+
int bonesMod = OnActivateBonesCostMod;
132+
List<GemType> gemsMod = OnActivateGemsCostMod;
133+
int healthMod = OnActivateHealthCostMod;
134+
135+
if (energyMod != 0)
136+
energyCostMod += energyMod;
137+
138+
if (bonesMod != 0)
139+
bonesCostMod += bonesMod;
140+
141+
if (gemsMod != null && gemsMod.Count > 0) {
142+
if (OnActivateGemsCostModRemovesGems) {
143+
gemsMod.ForEach(x => gemsCostMod.Remove(x));
144+
}
145+
else {
146+
gemsCostMod.AddRange(gemsMod);
147+
}
148+
}
149+
150+
if (healthMod != 0)
151+
healthCostMod += healthMod;
120152

121153
yield return PostActivate();
122154
currentSacrificedCardInfos.Clear();
@@ -220,14 +252,17 @@ private IEnumerator ChooseSacrifices()
220252
manager.currentSacrifices.Clear();
221253
}
222254

223-
private bool CanAfford()
224-
{
225-
if (BloodCost <= 0 || SacrificeValue() >= BloodCost)
226-
{
227-
if (base.Card.Health >= HealthCost)
228-
{
229-
if (Singleton<ResourcesManager>.Instance.PlayerEnergy >= EnergyCost)
230-
return Singleton<ResourcesManager>.Instance.PlayerBones >= BonesCost;
255+
private bool CanAfford() {
256+
// if no blood cost or we can fulfill our blood cost
257+
if (BloodCost < 1 || SacrificeValue() >= BloodCost) {
258+
// if we have enough health, Energy, and Bones
259+
if (base.Card.Health >= HealthCost && ResourcesManager.Instance.PlayerEnergy >= EnergyCost && ResourcesManager.Instance.PlayerBones >= BonesCost) {
260+
bool enoughOrange = ResourcesManagerHelpers.GemCount(!base.Card.OpponentCard, GemType.Orange) >= GemsCost.Count(x => x == GemType.Orange);
261+
bool enoughGreen = ResourcesManagerHelpers.GemCount(!base.Card.OpponentCard, GemType.Green) >= GemsCost.Count(x => x == GemType.Green);
262+
bool enoughBlue = ResourcesManagerHelpers.GemCount(!base.Card.OpponentCard, GemType.Blue) >= GemsCost.Count(x => x == GemType.Blue);
263+
264+
// if we have enough gems
265+
return enoughOrange && enoughGreen && enoughBlue;
231266
}
232267
}
233268
return false;

0 commit comments

Comments
 (0)