Skip to content

Commit

Permalink
Reverted Act 1 check from resource drone
Browse files Browse the repository at this point in the history
  • Loading branch information
HumabHatterZed committed Nov 28, 2023
1 parent 20bea46 commit 0801017
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 44 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
<summary>View Changelog</summary>

## 2.18.5
- Added some null checks
- Added missing null checks
- Added PlayableCard.GetStatIconHealthBuffs()
- Added PlayableCard.TransformIntoCardAboveHand() - variant of TransformIntoCardInHand that incorporates MoveCardAboveHand
- Added FullAbility.SetExtendedProperty for setting an AbilityInfo's custom property during ability creation
- Fixed the camera view locking during the Trapper boss final phase after choosing a talking card
- Fixed DrawCopyOnDeath creating warnings in the console
- Fixed talking cards locking the camera view when obtained during the Trapper boss's final phase
- Fixed ResourceDrone softlocking during Leshy's goodbye sequence if ConfigDefaultDrone is false
- Improved fix for the full pack Pack Rat sequence
- Reverted change to resource drone preventing it from being parented to the scale outside of Act 1
- Improved visual fix for the full pack Pack Rat sequence

## 2.18.4
- Fixed Sniper sigil targeting the wrong side of the board
Expand Down
62 changes: 26 additions & 36 deletions InscryptionAPI/Card/TribeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,28 @@ private static void UpdateTribeIcon(CardDisplayer3D __instance, CardInfo info)
{
if (info != null)
{
foreach (TribeInfo tribe in tribes)
foreach (TribeInfo tribeInfo in tribes)
{
if (tribe?.icon != null)
if (tribeInfo?.icon == null || info.IsNotOfTribe(tribeInfo.tribe))
continue;

bool foundSpriteRenderer = false;
foreach (SpriteRenderer spriteRenderer in __instance.tribeIconRenderers)
{
if (info.IsOfTribe(tribe.tribe))
if (spriteRenderer.sprite == null)
{
bool foundSpriteRenderer = false;
foreach (SpriteRenderer spriteRenderer in __instance.tribeIconRenderers)
{
if (spriteRenderer.sprite == null)
{
foundSpriteRenderer = true;
spriteRenderer.sprite = tribe.icon;
break;
}
}
if (!foundSpriteRenderer)
{
SpriteRenderer last = __instance.tribeIconRenderers.Last();
SpriteRenderer spriteRenderer = UnityObject.Instantiate(last);
spriteRenderer.transform.parent = last.transform.parent;
spriteRenderer.transform.localPosition = last.transform.localPosition + (__instance.tribeIconRenderers[1].transform.localPosition - __instance.tribeIconRenderers[0].transform.localPosition);
}
spriteRenderer.sprite = tribeInfo.icon;
foundSpriteRenderer = true;
break;
}
}
if (!foundSpriteRenderer)
{
SpriteRenderer last = __instance.tribeIconRenderers.Last();
SpriteRenderer spriteRenderer = UnityObject.Instantiate(last);
spriteRenderer.transform.parent = last.transform.parent;
spriteRenderer.transform.localPosition = last.transform.localPosition + (__instance.tribeIconRenderers[1].transform.localPosition - __instance.tribeIconRenderers[0].transform.localPosition);
}
}
}
}
Expand Down Expand Up @@ -190,10 +187,7 @@ public static Tribe Add(string guid, string name, string pathToTribeIcon = null,
return Add(guid, name, pathToTribeIcon is not null ? TextureHelper.GetImageAsTexture(pathToTribeIcon) : null, appearInTribeChoices, pathToChoiceCardBackTexture is not null ? TextureHelper.GetImageAsTexture(pathToChoiceCardBackTexture) : null);
}

public static bool IsCustomTribe(Tribe tribe)
{
return tribeTypes.Contains(tribe);
}
public static bool IsCustomTribe(Tribe tribe) => tribeTypes.Contains(tribe);

public static Texture2D GetTribeIcon(Tribe tribe, bool useMissingIconIfNull = true)
{
Expand All @@ -202,14 +196,13 @@ public static Texture2D GetTribeIcon(Tribe tribe, bool useMissingIconIfNull = tr
{
foreach (TribeInfo tribeInfo in NewTribes)
{
if (tribeInfo.tribe == tribe)
{
if (tribeInfo.icon != null && tribeInfo.icon.texture != null)
{
texture2D = tribeInfo.icon.texture;
}
break;
}
if (tribeInfo.tribe != tribe)
continue;

if (tribeInfo.icon != null && tribeInfo.icon.texture != null)
texture2D = tribeInfo.icon.texture;

break;
}
}
else
Expand All @@ -218,15 +211,12 @@ public static Texture2D GetTribeIcon(Tribe tribe, bool useMissingIconIfNull = tr
string str = "Art/Cards/TribeIcons/tribeicon_" + tribe.ToString().ToLowerInvariant();
Sprite sprite = ResourceBank.Get<Sprite>(str);
if (sprite != null)
{
texture2D = sprite.texture;
}
}

if (texture2D == null && useMissingIconIfNull)
{
texture2D = TribeIconMissing;
}

return texture2D;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class EnergyConfigInfo
{
public bool ConfigEnergy => PoolHasEnergy || PatchPlugin.configEnergy.Value;
public bool ConfigDrone => PoolHasEnergy || ConfigDroneMox || PatchPlugin.configDrone.Value;
public bool ConfigDefaultDrone => PatchPlugin.configDefaultDrone.Value || !SaveManager.SaveFile.IsPart1; // only parent drone to scale if it's Act 1
public bool ConfigDefaultDrone => PatchPlugin.configDefaultDrone.Value;
public bool ConfigMox => PoolHasGems || PatchPlugin.configMox.Value;
public bool ConfigDroneMox => PoolHasGems || PatchPlugin.configDroneMox.Value;
}
Expand Down Expand Up @@ -68,13 +68,12 @@ private static EnergyConfigInfo EnergyConfig

private static bool CardIsVisible(this CardInfo info, CardTemple targetTemple)
{
if (info.temple != targetTemple) // Non-nature cards can't be selected in Act 1
// if the CardInfo can't appear in this part of the game - Act 1 = Nature, Grimora = Undead, Magnificus = Wizard
if (info.temple != targetTemple)
return false;

// Now we check metacategories
// If the card's metacategories are set such that it can't actually appear, don't count it
return info.metaCategories.Exists((CardMetaCategory x) =>
x == CardMetaCategory.ChoiceNode || x == CardMetaCategory.TraderOffer || x == CardMetaCategory.Rare);
return info.HasAnyOfCardMetaCategories(CardMetaCategory.ChoiceNode, CardMetaCategory.TraderOffer, CardMetaCategory.Rare);
}

internal static void TryEnableEnergy(string sceneName)
Expand Down

0 comments on commit 0801017

Please sign in to comment.