Esempio n. 1
0
        /// <summary>
        /// Spawn a particular elite type with the specified monster type at the specified location.  This will
        /// apply appropriate HP and Dmg scaling per the specifications on the affix card, as well as calling the affix onSpawned.
        /// This is primarily intended for testing, but could also be used to easily spawn elites for other purposes.
        /// Note that this does not set XP and Gold rewards, as it does not have access to the cost function; you will need to
        /// add those yourself if you want these.
        /// </summary>
        /// <param name="spawnCard">Card describing the type of monster to spawn</param>
        /// <param name="affixCard">Card describing the type of elite to spawn; may pass null to spawn a non-elite</param>
        /// <param name="placement">How to place the elite in the scene</param>
        /// <param name="rng">Random number generator to use for placement</param>
        /// <returns></returns>
        public static CharacterMaster TrySpawnElite(CharacterSpawnCard spawnCard, EliteAffixCard affixCard, DirectorPlacementRule placement, Xoroshiro128Plus rng)
        {
            var spawnRequest = new DirectorSpawnRequest(spawnCard, placement, rng)
            {
                teamIndexOverride     = TeamIndex.Monster,
                ignoreTeamMemberLimit = true
            };
            var spawned = DirectorCore.instance.TrySpawnObject(spawnRequest);

            if (spawned == null)
            {
                return(null);
            }

            //Configure as the chosen elite
            var spawnedMaster = spawned.GetComponent <CharacterMaster>();

            if (affixCard != null)
            {
                //Elites are boosted
                var healthBoost = affixCard.healthBoostCoeff;
                var damageBoost = affixCard.damageBoostCoeff;

                spawnedMaster.inventory.GiveItem(ItemIndex.BoostHp, Mathf.RoundToInt((float)((healthBoost - 1.0) * 10.0)));
                spawnedMaster.inventory.GiveItem(ItemIndex.BoostDamage, Mathf.RoundToInt((float)((damageBoost - 1.0) * 10.0)));
                var eliteDef = EliteCatalog.GetEliteDef(affixCard.eliteType);
                if (eliteDef != null)
                {
                    spawnedMaster.inventory.SetEquipmentIndex(eliteDef.eliteEquipmentIndex);
                }

                affixCard.onSpawned?.Invoke(spawnedMaster);
            }
            return(spawnedMaster);
        }
Esempio n. 2
0
        private static void CharacterModelOnUpdateMaterials(On.RoR2.CharacterModel.orig_UpdateMaterials orig, CharacterModel self)
        {
            orig(self);

            //Vanilla elites aren't adjusted
            var eliteIndex = self.GetFieldValue <EliteIndex>("myEliteIndex");

            if (eliteIndex < EliteIndex.Count)
            {
                return;
            }

            var eliteDef        = EliteCatalog.GetEliteDef(eliteIndex);
            var rendererInfos   = self.baseRendererInfos;
            var propertyStorage = self.GetFieldValue <MaterialPropertyBlock>("propertyStorage");

            for (int i = rendererInfos.Length - 1; i >= 0; --i)
            {
                var      baseRendererInfo = rendererInfos[i];
                Renderer renderer         = baseRendererInfo.renderer;
                renderer.GetPropertyBlock(propertyStorage);
                propertyStorage.SetInt((int)CommonShaderProperties._EliteIndex, 0);
                propertyStorage.SetColor("_Color", eliteDef.color);
                renderer.SetPropertyBlock(propertyStorage);
            }
        }
Esempio n. 3
0
 // Token: 0x060021E2 RID: 8674 RVA: 0x000A0630 File Offset: 0x0009E830
 private static HUDBossHealthBarController.BossMemory GetBossMemory(CharacterMaster bossMaster)
 {
     if (!bossMaster)
     {
         return(null);
     }
     for (int i = 0; i < HUDBossHealthBarController.bossMemoryList.Count; i++)
     {
         if (HUDBossHealthBarController.bossMemoryList[i].master == bossMaster)
         {
             return(HUDBossHealthBarController.bossMemoryList[i]);
         }
     }
     HUDBossHealthBarController.BossMemory bossMemory = new HUDBossHealthBarController.BossMemory
     {
         master = bossMaster
     };
     HUDBossHealthBarController.bossMemoryList.Add(bossMemory);
     if (HUDBossHealthBarController.bossMemoryList.Count == 1)
     {
         HUDBossHealthBarController.bossNameString = Language.GetString(bossMaster.bodyPrefab.GetComponent <CharacterBody>().baseNameToken);
         string text = bossMaster.bodyPrefab.GetComponent <CharacterBody>().GetSubtitle();
         if (text.Length == 0)
         {
             text = Language.GetString("NULL_SUBTITLE");
         }
         HUDBossHealthBarController.bossSubtitleResolvedString = "<sprite name=\"CloudLeft\" tint=1> " + text + "<sprite name=\"CloudRight\" tint=1>";
         EliteIndex eliteIndex = EliteCatalog.IsEquipmentElite(bossMaster.inventory.currentEquipmentIndex);
         if (eliteIndex != EliteIndex.None)
         {
             HUDBossHealthBarController.bossNameString = EliteCatalog.GetEliteDef(eliteIndex).prefix + HUDBossHealthBarController.bossNameString;
         }
     }
     return(bossMemory);
 }
Esempio n. 4
0
        private static void CCSpawnAI(ConCommandArgs args)
        {
            string prefabString    = ArgsHelper.GetValue(args.userArgs, 0);
            string eliteString     = ArgsHelper.GetValue(args.userArgs, 1);
            string teamString      = ArgsHelper.GetValue(args.userArgs, 2);
            string braindeadString = ArgsHelper.GetValue(args.userArgs, 3);

            var character = Character.GetCharacter(prefabString);

            if (character == null)
            {
                Debug.LogFormat("Could not spawn {0}, Try: spawn_ai GolemBody", character.body);
                return;
            }

            var prefab = MasterCatalog.FindMasterPrefab(character.master);
            var body   = BodyCatalog.FindBodyPrefab(character.body);


            var             bodyGameObject = Instantiate <GameObject>(prefab, args.sender.master.GetBody().transform.position, Quaternion.identity);
            CharacterMaster master         = bodyGameObject.GetComponent <CharacterMaster>();

            NetworkServer.Spawn(bodyGameObject);
            master.SpawnBody(body, args.sender.master.GetBody().transform.position, Quaternion.identity);

            EliteIndex eliteIndex = EliteIndex.None;

            if (Enum.TryParse <EliteIndex>(eliteString, true, out eliteIndex))
            {
                if ((int)eliteIndex > (int)EliteIndex.None && (int)eliteIndex < (int)EliteIndex.Count)
                {
                    master.inventory.SetEquipmentIndex(EliteCatalog.GetEliteDef(eliteIndex).eliteEquipmentIndex);
                }
            }

            TeamIndex teamIndex = TeamIndex.Neutral;

            if (Enum.TryParse <TeamIndex>(teamString, true, out teamIndex))
            {
                if ((int)teamIndex >= (int)TeamIndex.None && (int)teamIndex < (int)TeamIndex.Count)
                {
                    master.teamIndex = teamIndex;
                }
            }

            bool braindead;

            if (bool.TryParse(braindeadString, out braindead))
            {
                if (braindead)
                {
                    Destroy(master.GetComponent <BaseAI>());
                }
            }
            Debug.Log("Attempting to spawn " + character.body);
        }
 public static void AffixOrange()
 {
     if (CloudburstPlugin.EnableElites.Value)
     {
         if (EliteAspectsChanges.AffixOrangeEquip == EquipmentIndex.None)
         {
             EliteAspectsChanges.AffixOrangeEquip = EquipmentCatalog.FindEquipmentIndex("AffixOrange");
             if (EliteAspectsChanges.AffixOrangeEquip != EquipmentIndex.None)
             {
                 EliteAspectsChanges.AffixOrangeIndex = EliteCatalog.GetEquipmentEliteIndex(EliteAspectsChanges.AffixOrangeEquip);
                 EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(EliteAspectsChanges.AffixOrangeEquip);
                 EliteAspectsChanges.AffixOrangeBuff = equipmentDef.passiveBuff;
             }
         }
     }
 }
 public static void AffixVoid()
 {
     if (Starstorm.EnableElites.Value)
     {
         if (EliteAspectsChanges.AffixVoidEquip == EquipmentIndex.None)
         {
             EliteAspectsChanges.AffixVoidEquip = EquipmentCatalog.FindEquipmentIndex("AffixVoid");
             if (EliteAspectsChanges.AffixVoidEquip != EquipmentIndex.None)
             {
                 EliteAspectsChanges.AffixVoidIndex = EliteCatalog.GetEquipmentEliteIndex(EliteAspectsChanges.AffixVoidEquip);
                 EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(EliteAspectsChanges.AffixVoidEquip);
                 EliteAspectsChanges.AffixVoidBuff = equipmentDef.passiveBuff;
             }
         }
     }
 }
Esempio n. 7
0
        private static void CCSpawnAI(ConCommandArgs args)
        {
            if (args.Count == 0)
            {
                Log.Message(MagicVars.SPAWNAI_ARGS);
                return;
            }

            string character = Alias.Instance.GetMasterName(args[0]);

            if (character == null)
            {
                Log.Message(MagicVars.SPAWN_ERROR + character);
                return;
            }
            var masterprefab = MasterCatalog.FindMasterPrefab(character);
            var body         = masterprefab.GetComponent <CharacterMaster>().bodyPrefab;

            var             bodyGameObject = Instantiate <GameObject>(masterprefab, args.sender.master.GetBody().transform.position, Quaternion.identity);
            CharacterMaster master         = bodyGameObject.GetComponent <CharacterMaster>();

            NetworkServer.Spawn(bodyGameObject);
            master.SpawnBody(body, args.sender.master.GetBody().transform.position, Quaternion.identity);

            if (args.Count > 1)
            {
                var eliteIndex = Alias.GetEnumFromPartial <EliteIndex>(args[1]);
                master.inventory.SetEquipmentIndex(EliteCatalog.GetEliteDef(eliteIndex).eliteEquipmentIndex);
                master.inventory.GiveItem(ItemIndex.BoostHp, Mathf.RoundToInt((GetTierDef(eliteIndex).healthBoostCoefficient - 1) * 10));
                master.inventory.GiveItem(ItemIndex.BoostDamage, Mathf.RoundToInt((GetTierDef(eliteIndex).damageBoostCoefficient - 1) * 10));
            }

            if (args.Count > 2 && Enum.TryParse <TeamIndex>(Alias.GetEnumFromPartial <TeamIndex>(args[2]).ToString(), true, out TeamIndex teamIndex))
            {
                if ((int)teamIndex >= (int)TeamIndex.None && (int)teamIndex < (int)TeamIndex.Count)
                {
                    master.teamIndex = teamIndex;
                }
            }

            if (args.Count > 3 && bool.TryParse(args[3], out bool braindead) && braindead)
            {
                Destroy(master.GetComponent <BaseAI>());
            }
            Log.Message(MagicVars.SPAWN_ATTEMPT + character);
        }
Esempio n. 8
0
        private static void Spawn(ConCommandArgs args)
        {
            var spawnCardStr = args.userArgs[0];
            var eliteStr     = args.userArgs.Count > 1 ? args.userArgs[1] : "";

            var spawnCard = Resources.Load <CharacterSpawnCard>("SpawnCards/CharacterSpawnCards/" + spawnCardStr);

            if (spawnCard == null)
            {
                Debug.LogWarning($"Could not locate character spawn card asset with name {spawnCardStr}; should be 'cscBeetle' for spawning a beetle, for instance");
                return;
            }

            EliteAffixCard affixCard = null;

            if (!string.IsNullOrEmpty(eliteStr))
            {
                affixCard = EsoLib.Cards.FirstOrDefault(c => EliteCatalog
                                                        .GetEliteDef(c.eliteType).modifierToken.ToLower()
                                                        .Contains(eliteStr.ToLower()));
            }

            var user = LocalUserManager.GetFirstLocalUser();
            var body = user.cachedBody;

            if (body?.master == null)
            {
                Debug.LogError("Cannot find local user body!");
                return;
            }

            var placement = new DirectorPlacementRule
            {
                spawnOnTarget   = body.transform,
                maxDistance     = 40,
                placementMode   = DirectorPlacementRule.PlacementMode.Approximate,
                preventOverhead = false
            };

            var rng = new Xoroshiro128Plus((ulong)DateTime.Now.Ticks);

            if (EsoLib.TrySpawnElite(spawnCard, affixCard, placement, rng) == null)
            {
                Debug.LogWarning("Failed to spawn elite; try again somewhere less crowded");
            }
        }
Esempio n. 9
0
        private static void CCSpawnAI(ConCommandArgs args)
        {
            GameObject prefab;
            GameObject body;
            GameObject gameObject = null;

            string prefabString    = ArgsHelper.GetValue(args.userArgs, 0);
            string eliteString     = ArgsHelper.GetValue(args.userArgs, 1);
            string teamString      = ArgsHelper.GetValue(args.userArgs, 2);
            string braindeadString = ArgsHelper.GetValue(args.userArgs, 3);

            string bodyString   = GetBodyMasterLink(prefabString, 0); //prefabString.Replace("Master", "");
            string masterString = GetBodyMasterLink(prefabString, 1); //prefabString.Replace("Body", "");

            prefab = MasterCatalog.FindMasterPrefab(masterString);
            body   = BodyCatalog.FindBodyPrefab(bodyString);
            if (prefab == null)
            {
                List <string> array = new List <string>();
                foreach (var item in MasterCatalog.allMasters)
                {
                    array.Add(item.name);
                }
                string list = string.Join("\n", array);
                Debug.LogFormat("Could not spawn {0}, Try: spawn_ai GolemBody   --- \n{1}", prefabString, list);
                return;
            }

            gameObject = Instantiate <GameObject>(prefab, args.sender.master.GetBody().transform.position, Quaternion.identity);
            CharacterMaster master = gameObject.GetComponent <CharacterMaster>();

            NetworkServer.Spawn(gameObject);
            master.SpawnBody(body, args.sender.master.GetBody().transform.position, Quaternion.identity);

            EliteIndex eliteIndex = EliteIndex.None;

            if (Enum.TryParse <EliteIndex>(eliteString, true, out eliteIndex))
            {
                if ((int)eliteIndex > (int)EliteIndex.None && (int)eliteIndex < (int)EliteIndex.Count)
                {
                    master.inventory.SetEquipmentIndex(EliteCatalog.GetEliteDef(eliteIndex).eliteEquipmentIndex);
                }
            }

            TeamIndex teamIndex = TeamIndex.Neutral;

            if (Enum.TryParse <TeamIndex>(teamString, true, out teamIndex))
            {
                if ((int)teamIndex >= (int)TeamIndex.None && (int)teamIndex < (int)TeamIndex.Count)
                {
                    master.teamIndex = teamIndex;
                }
            }

            bool braindead;

            if (bool.TryParse(braindeadString, out braindead))
            {
                if (braindead)
                {
                    Destroy(master.GetComponent <BaseAI>());
                }
            }
            Debug.Log("Attempting to spawn " + prefabString);
        }
Esempio n. 10
0
 public static bool IsElite(this EquipmentDef equipmentDef)
 {
     return(EliteCatalog.GetEquipmentEliteIndex(equipmentDef.equipmentIndex) != EliteIndex.None);
 }
Esempio n. 11
0
        private static void CCSpawnAI(ConCommandArgs args)
        {
            //- Spawns the specified CharacterMaster. Requires 1 argument: spawn_ai 0:{localised_objectname} 1:[Count:1] 2:[EliteIndex:-1/None] 3:[Braindead:0/false(0|1)] 4:[TeamIndex:0/Neutral]

            if (args.sender == null)
            {
                Log.Message(Lang.DS_NOTYETIMPLEMENTED, LogLevel.Error);
                return;
            }
            if (args.Count == 0)
            {
                Log.MessageNetworked(Lang.SPAWNAI_ARGS, args, LogLevel.MessageClientOnly);
                return;
            }

            string character = StringFinder.Instance.GetMasterName(args[0]);

            if (character == null)
            {
                Log.MessageNetworked(Lang.SPAWN_ERROR + character, args, LogLevel.MessageClientOnly);
                return;
            }
            var masterprefab = MasterCatalog.FindMasterPrefab(character);
            var body         = masterprefab.GetComponent <CharacterMaster>().bodyPrefab;

            int amount = 1;

            if (args.Count > 1)
            {
                if (int.TryParse(args[1], out amount) == false)
                {
                    Log.MessageNetworked(Lang.SPAWNAI_ARGS, args, LogLevel.MessageClientOnly);
                    return;
                }
            }
            Vector3 location = args.sender.master.GetBody().transform.position;

            Log.MessageNetworked(string.Format(Lang.SPAWN_ATTEMPT_2, amount, character), args);
            for (int i = 0; i < amount; i++)
            {
                var             bodyGameObject = UnityEngine.Object.Instantiate <GameObject>(masterprefab, location, Quaternion.identity);
                CharacterMaster master         = bodyGameObject.GetComponent <CharacterMaster>();
                NetworkServer.Spawn(bodyGameObject);
                master.SpawnBody(body, args.sender.master.GetBody().transform.position, Quaternion.identity);

                if (args.Count > 2)
                {
                    var eliteIndex = StringFinder.GetEnumFromPartial <EliteIndex>(args[2]);
                    if (eliteIndex != EliteIndex.None)
                    {
                        master.inventory.SetEquipmentIndex(EliteCatalog.GetEliteDef(eliteIndex).eliteEquipmentIndex);
                        master.inventory.GiveItem(ItemIndex.BoostHp, Mathf.RoundToInt((GetTierDef(eliteIndex).healthBoostCoefficient - 1) * 10));
                        master.inventory.GiveItem(ItemIndex.BoostDamage, Mathf.RoundToInt((GetTierDef(eliteIndex).damageBoostCoefficient - 1) * 10));
                    }
                }

                if (args.Count > 3 && Util.TryParseBool(args[3], out bool braindead) && braindead)
                {
                    UnityEngine.Object.Destroy(master.GetComponent <BaseAI>());
                }

                TeamIndex teamIndex = TeamIndex.Monster;
                if (args.Count > 4)
                {
                    StringFinder.TryGetEnumFromPartial(args[4], out teamIndex);
                }

                if (teamIndex >= TeamIndex.None && teamIndex < TeamIndex.Count)
                {
                    master.teamIndex = teamIndex;
                    master.GetBody().teamComponent.teamIndex = teamIndex;
                }
            }
        }
        private static Boolean ShouldInheritEquipment(EquipmentIndex index)
        {
            EliteIndex eliteInd = EliteCatalog.GetEquipmentEliteIndex(index);

            return(eliteInd != EliteIndex.None);
        }
Esempio n. 13
0
        // Token: 0x060021C0 RID: 8640 RVA: 0x0009F160 File Offset: 0x0009D360
        private void UpdateHealthbar(float deltaTime)
        {
            float num  = 0f;
            float num2 = 1f;
            float num3 = 1f;

            if (this.source)
            {
                CharacterBody component = this.source.GetComponent <CharacterBody>();
                if (component)
                {
                    float num4 = component.CalcLunarDaggerPower();
                    num3 /= num4;
                }
                float fullHealth = this.source.fullHealth;
                float f          = this.source.health + this.source.shield;
                float num5       = this.source.fullHealth + this.source.fullShield;
                num = Mathf.Clamp01(this.source.health / num5 * num3);
                float num6 = Mathf.Clamp01(this.source.shield / num5 * num3);
                if (!this.hasCachedInitialValue)
                {
                    this.cachedFractionalValue = num;
                    this.hasCachedInitialValue = true;
                }
                if (this.eliteBackdropRectTransform)
                {
                    if (component.equipmentSlot && EliteCatalog.IsEquipmentElite(component.equipmentSlot.equipmentIndex) != EliteIndex.None)
                    {
                        num2 += 1f;
                        this.eliteBackdropRectTransform.gameObject.SetActive(true);
                    }
                    else
                    {
                        this.eliteBackdropRectTransform.gameObject.SetActive(false);
                    }
                }
                if (this.frozenCullThresholdRectTransform)
                {
                    this.frozenCullThresholdRectTransform.gameObject.SetActive(this.source.isFrozen);
                }
                bool active = false;
                if (this.source.fullShield > 0f)
                {
                    active = true;
                }
                this.shieldFillRectTransform.gameObject.SetActive(active);
                if (this.scaleHealthbarWidth && component)
                {
                    float num7 = Util.Remap(Mathf.Clamp((component.baseMaxHealth + component.baseMaxShield) * num2, 0f, this.maxHealthbarHealth), this.minHealthbarHealth, this.maxHealthbarHealth, this.minHealthbarWidth, this.maxHealthbarWidth);
                    this.healthbarScale          = num7 / this.minHealthbarWidth;
                    this.rectTransform.sizeDelta = new Vector2(num7, this.rectTransform.sizeDelta.y);
                }
                Color           color  = this.originalFillColor;
                CharacterMaster master = component.master;
                if (master && (master.isBoss || master.inventory.GetItemCount(ItemIndex.Infusion) > 0))
                {
                    color = ColorCatalog.GetColor(ColorCatalog.ColorIndex.Teleporter);
                }
                this.fillImage.color = color;
                if (this.fillRectTransform)
                {
                    this.fillRectTransform.anchorMin        = new Vector2(0f, 0f);
                    this.fillRectTransform.anchorMax        = new Vector2(num, 1f);
                    this.fillRectTransform.anchoredPosition = Vector2.zero;
                    this.fillRectTransform.sizeDelta        = new Vector2(1f, 1f);
                }
                if (this.shieldFillRectTransform)
                {
                    this.shieldFillRectTransform.anchorMin        = new Vector2(num, 0f);
                    this.shieldFillRectTransform.anchorMax        = new Vector2(num + num6, 1f);
                    this.shieldFillRectTransform.anchoredPosition = Vector2.zero;
                    this.shieldFillRectTransform.sizeDelta        = new Vector2(1f, 1f);
                }
                if (this.delayfillRectTransform)
                {
                    this.delayfillRectTransform.anchorMin        = new Vector2(0f, 0f);
                    this.delayfillRectTransform.anchorMax        = new Vector2(this.cachedFractionalValue, 1f);
                    this.delayfillRectTransform.anchoredPosition = Vector2.zero;
                    this.delayfillRectTransform.sizeDelta        = new Vector2(1f, 1f);
                }
                if (this.flashRectTransform)
                {
                    this.flashRectTransform.anchorMin = new Vector2(0f, 0f);
                    this.flashRectTransform.anchorMax = new Vector2(num, 1f);
                    float num8 = 1f - num;
                    float num9 = 2f * num8;
                    this.theta += deltaTime * num9;
                    if (this.theta > 1f)
                    {
                        this.theta -= this.theta - this.theta % 1f;
                    }
                    float num10 = 1f - Mathf.Cos(this.theta * 3.1415927f * 0.5f);
                    this.flashRectTransform.sizeDelta = new Vector2(num10 * 20f * num8, num10 * 20f * num8);
                    Image component2 = this.flashRectTransform.GetComponent <Image>();
                    if (component2)
                    {
                        Color color2 = component2.color;
                        color2.a         = (1f - num10) * num8 * 0.7f;
                        component2.color = color2;
                    }
                }
                if (this.currentHealthText)
                {
                    float num11 = Mathf.Ceil(f);
                    if (num11 != this.displayStringCurrentHealth)
                    {
                        this.displayStringCurrentHealth = num11;
                        this.currentHealthText.text     = num11.ToString();
                    }
                }
                if (this.fullHealthText)
                {
                    float num12 = Mathf.Ceil(fullHealth);
                    if (num12 != this.displayStringFullHealth)
                    {
                        this.displayStringFullHealth = num12;
                        this.fullHealthText.text     = num12.ToString();
                    }
                }
                if (this.criticallyHurtImage)
                {
                    if (num + num6 < HealthBar.criticallyHurtThreshold && this.source.alive)
                    {
                        this.criticallyHurtImage.enabled = true;
                        this.criticallyHurtImage.color   = HealthBar.GetCriticallyHurtColor();
                        this.fillImage.color             = HealthBar.GetCriticallyHurtColor();
                    }
                    else
                    {
                        this.criticallyHurtImage.enabled = false;
                    }
                }
                if (this.deadImage)
                {
                    this.deadImage.enabled = !this.source.alive;
                }
            }
            this.cachedFractionalValue = Mathf.SmoothDamp(this.cachedFractionalValue, num, ref this.healthFractionVelocity, 0.05f, float.PositiveInfinity, deltaTime);
        }
        private static void doMultiElite(GameObject gameObject, CombatDirector self)
        {
            DirectorCard card = self.lastAttemptedMonsterCard;

            float credit = self.monsterCredit;

            CharacterBody body = gameObject.GetComponentInChildren <CharacterMaster>().GetBody();

            CombatDirector.EliteTierDef[] eliteDefs = typeof(CombatDirector).GetFieldValue <CombatDirector.EliteTierDef[]>("eliteTiers");

            int currentEliteTypes = 1;

            foreach (BuffIndex buff in BuffCatalog.eliteBuffIndices)
            {
                BuffDef buffDef = BuffCatalog.GetBuffDef(buff);
                if (body.HasBuff(buff))
                {
                    currentEliteTypes += 1;
                }
            }
            if (currentEliteTypes > 1)
            {
                foreach (CombatDirector.EliteTierDef tierDef in eliteDefs)
                {
                    foreach (EliteIndex eliteIndex in tierDef.eliteTypes)
                    {
                        if (credit > card.cost * tierDef.costMultiplier * currentEliteTypes)
                        {
                            BuffDef buffDef = BuffCatalog.GetBuffDef(BuffIndex.None);

                            foreach (BuffIndex buff in BuffCatalog.eliteBuffIndices)
                            {
                                BuffDef tempDef = BuffCatalog.GetBuffDef(buff);

                                if (tempDef.eliteIndex == eliteIndex)
                                {
                                    buffDef = tempDef;
                                }
                            }

                            if (buffDef != null)
                            {
                                if (!(body.HasBuff(buffDef.buffIndex)))
                                {
                                    body.AddBuff(buffDef.buffIndex);
                                    self.monsterCredit -= card.cost * tierDef.costMultiplier * currentEliteTypes;
                                    credit             -= card.cost * tierDef.costMultiplier * currentEliteTypes;
                                    currentEliteTypes++;

                                    float num3 = tierDef.healthBoostCoefficient;
                                    float damageBoostCoefficient = tierDef.damageBoostCoefficient;
                                    if (self.combatSquad)
                                    {
                                        int livingPlayerCount = Run.instance.livingPlayerCount;
                                        num3 *= Mathf.Pow((float)livingPlayerCount, 1f);
                                    }
                                    body.inventory.GiveItem(ItemIndex.BoostHp, Mathf.RoundToInt((num3 - 1f) * 10f));
                                    body.inventory.GiveItem(ItemIndex.BoostDamage, Mathf.RoundToInt((damageBoostCoefficient - 1f) * 10f));

                                    EliteDef       eliteDef       = EliteCatalog.GetEliteDef(eliteIndex);
                                    EquipmentIndex equipmentIndex = (eliteDef != null) ? eliteDef.eliteEquipmentIndex : EquipmentIndex.None;
                                    if (equipmentIndex != EquipmentIndex.None)
                                    {
                                        if (body.inventory.GetEquipmentIndex() == EquipmentIndex.None)
                                        {
                                            body.inventory.SetEquipmentIndex(equipmentIndex);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }