bool IsHircineRingItem(DaggerfallUnityItem item) { return (item != null && item.IsArtifact && item.ContainsEnchantment(EnchantmentTypes.SpecialArtifactEffect, (short)ArtifactsSubTypes.Hircine_Ring)); }
/// <summary> /// Attempt to trap a soul. /// </summary> /// <returns>True if entity is allowed to die after trap attempt.</returns> bool AttemptSoulTrap() { // Must have a peered DaggerfallEntityBehaviour and EntityEffectManager EntityEffectManager manager = (EntityBehaviour) ? EntityBehaviour.GetComponent <EntityEffectManager>() : null; if (!manager) { return(true); } // Find the soul trap incumbent SoulTrap soulTrapEffect = (SoulTrap)manager.FindIncumbentEffect <SoulTrap>(); if (soulTrapEffect == null) { return(true); } // Roll chance for trap, or always succeed if Azura's Star is equipped. // If trap fails then entity should die as normal without trapping a soul // If trap succeeds and player has a free soul gem then entity should die after storing soul // If trap succeeds and player has no free soul gems then entity will not die until effect expires or fails bool azurasStarEquipped = false; DaggerfallUnityItem azurasStar = GameManager.Instance.PlayerEntity.ItemEquipTable.GetItem(EquipSlots.Amulet0); if (azurasStar != null && azurasStar.ContainsEnchantment(EnchantmentTypes.SpecialArtifactEffect, (short)ArtifactsSubTypes.Azuras_Star)) { azurasStarEquipped = true; } else { azurasStar = GameManager.Instance.PlayerEntity.ItemEquipTable.GetItem(Game.Items.EquipSlots.Amulet1); if (azurasStar != null && azurasStar.ContainsEnchantment(EnchantmentTypes.SpecialArtifactEffect, (short)ArtifactsSubTypes.Azuras_Star)) { azurasStarEquipped = true; } } if (azurasStarEquipped || soulTrapEffect.RollTrapChance()) { // Attempt to fill an empty soul trap if (soulTrapEffect.FillEmptyTrapItem((MobileTypes)mobileEnemy.ID)) { // Trap filled, allow entity to die normally DaggerfallUI.AddHUDText(TextManager.Instance.GetText("ClassicEffects", "trapSuccess"), 1.5f); return(true); } else { // No empty gems, keep entity tethered to life - player is alerted so they know what's happening currentHealth = 1; DaggerfallUI.AddHUDText(TextManager.Instance.GetText("ClassicEffects", "trapNoneEmpty")); return(false); } } else { // Trap failed DaggerfallUI.AddHUDText(TextManager.Instance.GetText("ClassicEffects", "trapFail"), 1.5f); return(true); } }
private static bool IsRingOfNamira(DaggerfallUnityItem item) { return(item != null && item.ContainsEnchantment(DaggerfallConnect.FallExe.EnchantmentTypes.SpecialArtifactEffect, (int)ArtifactsSubTypes.Ring_of_Namira)); }