Skip to content

Commit 343d12c

Browse files
2.23.2
1 parent d56bf5b commit 343d12c

37 files changed

+139
-62
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 2.23.2
2+
- Fixed error when trying to create cards that evolve/transform in 4 or more turns
3+
- Fixed Fledgling and Transformer sigil appearing as black boxes when a card evolves/transform in 4 or more turns
4+
- Evolve and Transformer icons now show support cards that evolve in 4 or more turns
5+
- Added extension methods for PlayableCard and CardInfo: ProvidesBlueGem, ProvidesGreenGem, ProvidesOrangeGem
6+
17
# 2.23.1
28
- Fixed non-CardModificationInfo shields not breaking
39
- Fixed ShieldGeneratorItem not correclty updating visuals
647 Bytes
Loading
654 Bytes
Loading
658 Bytes
Loading
689 Bytes
Loading
694 Bytes
Loading
703 Bytes
Loading

InscryptionAPI/Card/AbilityManager.cs

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ private static List<FullAbility> GenBaseGameAbilityList()
245245
}
246246

247247
List<FullAbility> baseGame = new();
248-
var gameAsm = typeof(AbilityInfo).Assembly;
248+
Assembly gameAsm = typeof(AbilityInfo).Assembly;
249249
foreach (var ability in Resources.LoadAll<AbilityInfo>("Data/Abilities"))
250250
{
251251
string name = ability.ability.ToString();
@@ -719,18 +719,44 @@ private static IEnumerable<CodeInstruction> EvolveOnUpkeepPatches(IEnumerable<Co
719719

720720
return codes;
721721
}
722+
[HarmonyPrefix, HarmonyPatch(typeof(AbilityIconInteractable), nameof(AbilityIconInteractable.LoadIcon))]
723+
private static bool OverrideTransformIcon(ref Texture __result, AbilityIconInteractable __instance, CardInfo info, AbilityInfo ability) {
724+
if (ability.ability == Ability.Transformer && info?.evolveParams?.turnsToEvolve > 1) {
725+
__result = TextureHelper.GetImageAsTexture($"ability_transformer_{Mathf.Min(info.evolveParams.turnsToEvolve, 6)}.png", InscryptionAPIPlugin.APIAssembly);
726+
return false;
727+
}
728+
if (ability.ability == Ability.Evolve && info?.evolveParams?.turnsToEvolve > 3) {
729+
__result = TextureHelper.GetImageAsTexture($"ability_evolve_{Mathf.Min(info.evolveParams.turnsToEvolve, 6)}.png", InscryptionAPIPlugin.APIAssembly);
730+
return false;
731+
}
732+
return true;
733+
}
734+
[HarmonyPrefix, HarmonyPatch(typeof(AbilitiesUtil), nameof(AbilitiesUtil.LoadAbilityIcon))]
735+
private static bool OverrideEvolveAndTransformerIcon(ref Texture __result, string abilityName) {
736+
if (abilityName.StartsWith("Evolve") || abilityName.StartsWith("Transformer")) {
737+
return false;
738+
}
739+
return true;
740+
}
722741
private static void OverrideEvolveDerivedIcon(Evolve evolve, int turnsLeftToEvolve)
723742
{
724743
if (evolve.Ability == Ability.Evolve)
725744
{
726-
evolve.Card.RenderInfo.OverrideAbilityIcon(
727-
Ability.Evolve, ResourceBank.Get<Texture>("Art/Cards/AbilityIcons/ability_evolve_" + turnsLeftToEvolve)
728-
);
745+
if (turnsLeftToEvolve > 3) {
746+
evolve.Card.RenderInfo.OverrideAbilityIcon(
747+
Ability.Evolve, TextureHelper.GetImageAsTexture($"ability_evolve_{Mathf.Min(turnsLeftToEvolve, 6)}.png", InscryptionAPIPlugin.APIAssembly)
748+
);
749+
}
750+
else {
751+
evolve.Card.RenderInfo.OverrideAbilityIcon(
752+
Ability.Evolve, ResourceBank.Get<Texture>("Art/Cards/AbilityIcons/ability_evolve_" + turnsLeftToEvolve)
753+
);
754+
}
729755
}
730756
else if (evolve.Ability == Ability.Transformer && (evolve.Card.Info.evolveParams?.turnsToEvolve ?? 1) != 1)
731757
{
732758
evolve.Card.RenderInfo.OverrideAbilityIcon(
733-
Ability.Transformer, TextureHelper.GetImageAsTexture($"ability_transformer_{turnsLeftToEvolve}.png", typeof(AbilityManager).Assembly)
759+
Ability.Transformer, TextureHelper.GetImageAsTexture($"ability_transformer_{Mathf.Min(turnsLeftToEvolve, 6)}.png", InscryptionAPIPlugin.APIAssembly)
734760
);
735761
}
736762
}
@@ -808,7 +834,7 @@ private static void LoadTransformerIcon(ref Texture __result, CardInfo info, Abi
808834
if (turnsToEvolve <= 1)
809835
return;
810836

811-
__result = TextureHelper.GetImageAsTexture($"ability_transformer_{turnsToEvolve}.png", typeof(AbilityManager).Assembly);
837+
__result = TextureHelper.GetImageAsTexture($"ability_transformer_{turnsToEvolve}.png", InscryptionAPIPlugin.APIAssembly);
812838
}
813839
#endregion
814840

InscryptionAPI/Card/CardAppearanceBehaviourManager.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using DiskCardGame;
22
using InscryptionAPI.Guid;
33
using System.Collections.ObjectModel;
4+
using System.Reflection;
45

56
namespace InscryptionAPI.Card;
67

@@ -36,10 +37,10 @@ static CardAppearanceBehaviourManager()
3637
private static List<FullCardAppearanceBehaviour> GenBaseGameAppearanceList()
3738
{
3839
List<FullCardAppearanceBehaviour> baseGame = new();
39-
var gameAsm = typeof(CardAppearanceBehaviour).Assembly;
40+
Assembly gameAsm = typeof(CardAppearanceBehaviour).Assembly;
4041
foreach (CardAppearanceBehaviour.Appearance ability in Enum.GetValues(typeof(CardAppearanceBehaviour.Appearance)))
4142
{
42-
var name = ability.ToString();
43+
string name = ability.ToString();
4344
baseGame.Add(new FullCardAppearanceBehaviour(ability, gameAsm.GetType($"DiskCardGame.{name}")));
4445
}
4546
return baseGame;

InscryptionAPI/Card/CardExtensionsCosts.cs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,54 @@ public static bool OwnerHasBlueGem(this PlayableCard card)
109109
return card.OpponentCard ? OpponentGemsManager.Instance.HasGem(GemType.Blue) : ResourcesManager.Instance.HasGem(GemType.Blue);
110110
}
111111
public static bool IsUsingBlueGem(this PlayableCard card) => card.IsGemified() && card.OwnerHasBlueGem();
112+
113+
/// <summary>
114+
/// Determines if this card provides its owner with a blue gem.
115+
/// </summary>
116+
/// <param name="card">Card to check</param>
117+
public static bool ProvidesBlueGem(this PlayableCard card)
118+
{
119+
return card.HasAbility(Ability.GainGemTriple) || card.HasAbility(Ability.GainGemBlue);
120+
}
121+
/// <summary>
122+
/// Determines if this card provides its owner with a green gem.
123+
/// </summary>
124+
/// <param name="card">Card to check</param>
125+
public static bool ProvidesGreenGem(this PlayableCard card)
126+
{
127+
return card.HasAbility(Ability.GainGemTriple) || card.HasAbility(Ability.GainGemGreen);
128+
}
129+
/// <summary>
130+
/// Determines if this card provides its owner with a orange gem.
131+
/// </summary>
132+
/// <param name="card">Card to check</param>
133+
public static bool ProvidesOrangeGem(this PlayableCard card)
134+
{
135+
return card.HasAbility(Ability.GainGemTriple) || card.HasAbility(Ability.GainGemOrange);
136+
}
137+
138+
/// <summary>
139+
/// Determines if this card provides its owner with a blue gem.
140+
/// </summary>
141+
/// <param name="card">CardInfo to check</param>
142+
public static bool ProvidesBlueGem(this CardInfo card)
143+
{
144+
return card.HasAbility(Ability.GainGemTriple) || card.HasAbility(Ability.GainGemBlue);
145+
}
146+
/// <summary>
147+
/// Determines if this card provides its owner with a green gem.
148+
/// </summary>
149+
/// <param name="card">CardInfo to check</param>
150+
public static bool ProvidesGreenGem(this CardInfo card)
151+
{
152+
return card.HasAbility(Ability.GainGemTriple) || card.HasAbility(Ability.GainGemGreen);
153+
}
154+
/// <summary>
155+
/// Determines if this card provides its owner with a orange gem.
156+
/// </summary>
157+
/// <param name="card">CardInfo to check</param>
158+
public static bool ProvidesOrangeGem(this CardInfo card)
159+
{
160+
return card.HasAbility(Ability.GainGemTriple) || card.HasAbility(Ability.GainGemOrange);
161+
}
112162
}

0 commit comments

Comments
 (0)