@@ -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
0 commit comments