diff --git a/InscryptionAPI/Card/CardExtensionsPortraits.cs b/InscryptionAPI/Card/CardExtensionsPortraits.cs index f7fd9a69..706353f3 100644 --- a/InscryptionAPI/Card/CardExtensionsPortraits.cs +++ b/InscryptionAPI/Card/CardExtensionsPortraits.cs @@ -328,6 +328,71 @@ public static CardInfo SetLostTailPortrait(this CardInfo info, Texture2D portrai return info; } + /// + /// Sets the card's lost tail portrait. This portrait is used when the card has the TailOnHit ability and has dodged a hit. + /// + /// CardInfo to access. + /// The sprite containing the card portrait. + /// The same CardInfo so a chain can continue. + public static CardInfo SetLostTailPortrait(this CardInfo info, Sprite portrait) + { + if (info.tailParams == null) + throw new InvalidOperationException("Cannot set lost tail portrait without tail params being set first"); + + info.tailParams.SetLostTailPortrait(portrait, info); + + return info; + } + + /// + /// Sets the emissive lost tail portrait for the card. This can only be done after the default lost tail portrait has been set (SetLostTailPortrait). + /// + /// CardInfo to access. + /// The path to the .png file containing the portrait artwork (relative to the Plugins directory). + /// The same CardInfo so a chain can continue. + public static CardInfo SetEmissiveLostTailPortrait(this CardInfo info, string pathToArt) + { + if (info.tailParams == null) + throw new InvalidOperationException("Cannot set emissive lost tail portrait without tail params being set first"); + + info.tailParams.SetEmissiveLostTailPortrait(pathToArt); + + return info; + } + + /// + /// Sets the emissive lost tail portrait for the card. This can only be done after the default lost tail portrait has been set (SetLostTailPortrait). + /// + /// CardInfo to access. + /// The texture containing the card portrait. + /// The filter mode for the texture, or null if no change. + /// The same CardInfo so a chain can continue. + public static CardInfo SetEmissiveLostTailPortrait(this CardInfo info, Texture2D portrait, FilterMode? filterMode = null) + { + if (info.tailParams == null) + throw new InvalidOperationException("Cannot set emissive lost tail portrait without tail params being set first"); + + info.tailParams.SetEmissiveLostTailPortrait(portrait, filterMode); + + return info; + } + + /// + /// Sets the emissive lost tail portrait for the card. This can only be done after the default lost tail portrait has been set (SetLostTailPortrait). + /// + /// CardInfo to access. + /// The sprite containing the card portrait. + /// The same CardInfo so a chain can continue. + public static CardInfo SetEmissiveLostTailPortrait(this CardInfo info, Sprite portrait) + { + if (info.tailParams == null) + throw new InvalidOperationException("Cannot set emissive lost tail portrait without tail params being set first"); + + info.tailParams.SetEmissiveLostTailPortrait(portrait); + + return info; + } + /// /// Sets the card's lost tail portrait. This portrait is used when the card has the TailOnHit ability and has dodged a hit. /// @@ -377,6 +442,46 @@ public static TailParams SetLostTailPortrait(this TailParams info, Sprite portra return info; } + /// + /// Sets the emissive lost tail portrait for the card. This can only be done after the default lost tail portrait has been set (SetLostTailPortrait). + /// + /// Tail to access. + /// The path to the .png file containing the artwork (relative to the Plugins directory). + /// The same TailParams so a chain can continue. + public static TailParams SetEmissiveLostTailPortrait(this TailParams info, string pathToArt) + { + return info.SetEmissiveLostTailPortrait(TextureHelper.GetImageAsTexture(pathToArt)); + } + + /// + /// Sets the emissive lost tail portrait for the card. This can only be done after the default lost tail portrait has been set (SetLostTailPortrait). + /// + /// Tail to access. + /// The texture containing the card portrait. + /// The filter mode for the texture, or null if no change. + /// The same TailParams so a chain can continue. + public static TailParams SetEmissiveLostTailPortrait(this TailParams info, Texture2D portrait, FilterMode? filterMode = null) + { + return info.SetEmissiveLostTailPortrait(GetPortrait(portrait, TextureHelper.SpriteType.CardPortrait, filterMode)); + } + + /// + /// Sets the emissive lost tail portrait for the card. This can only be done after the default lost tail portrait has been set (SetLostTailPortrait). + /// + /// Tail to access. + /// The sprite containing the card portrait. + /// The filter mode for the texture, or null if no change. + /// The same TailParams so a chain can continue. + public static TailParams SetEmissiveLostTailPortrait(this TailParams info, Sprite portrait) + { + if (info.tailLostPortrait == null) + throw new InvalidOperationException($"Cannot set the emissive portrait before setting the default lost tail portrait!"); + + info.tailLostPortrait.RegisterEmissionForSprite(portrait); + return info; + } + public static Sprite GetEmissiveTailLostPortrait(this TailParams info) => info.tailLostPortrait?.GetEmissionSprite(); + #endregion #region Pixel Alt @@ -635,13 +740,13 @@ public static CardInfo SetEmissiveSacrificablePortrait(this CardInfo info, Textu } public static CardInfo SetEmissiveSacrificablePortrait(this CardInfo info, Sprite portrait) { - if (info.SteelTrapPortrait() == null) + if (info.SacrificablePortrait() == null) throw new InvalidOperationException($"Cannot set emissive portrait before setting the default sacrifice portrait!"); - info.SteelTrapPortrait().RegisterEmissionForSprite(portrait); + info.SacrificablePortrait().RegisterEmissionForSprite(portrait); return info; } - public static Sprite GetEmissiveSacrificablePortrait(this CardInfo info) => info.SteelTrapPortrait().GetEmissionSprite(); + public static Sprite GetEmissiveSacrificablePortrait(this CardInfo info) => info.SacrificablePortrait().GetEmissionSprite(); #endregion ///