Esempio n. 1
0
 // Token: 0x06000E24 RID: 3620 RVA: 0x0003F15C File Offset: 0x0003D35C
 private void TeleportBody(CharacterBody characterBody)
 {
     if (!Util.HasEffectiveAuthority(characterBody.gameObject))
     {
         return;
     }
     if (!Physics.GetIgnoreLayerCollision(base.gameObject.layer, characterBody.gameObject.layer))
     {
         SpawnCard spawnCard = ScriptableObject.CreateInstance <SpawnCard>();
         spawnCard.hullSize      = characterBody.hullClassification;
         spawnCard.nodeGraphType = MapNodeGroup.GraphType.Ground;
         spawnCard.prefab        = Resources.Load <GameObject>("SpawnCards/HelperPrefab");
         GameObject gameObject = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(spawnCard, new DirectorPlacementRule
         {
             placementMode = DirectorPlacementRule.PlacementMode.NearestNode,
             position      = characterBody.transform.position
         }, RoR2Application.rng));
         if (gameObject)
         {
             Debug.Log("tp back");
             TeleportHelper.TeleportBody(characterBody, gameObject.transform.position);
             GameObject teleportEffectPrefab = Run.instance.GetTeleportEffectPrefab(characterBody.gameObject);
             if (teleportEffectPrefab)
             {
                 EffectManager.SimpleEffect(teleportEffectPrefab, gameObject.transform.position, Quaternion.identity, true);
             }
             UnityEngine.Object.Destroy(gameObject);
         }
         UnityEngine.Object.Destroy(spawnCard);
     }
 }
        // Token: 0x0600092D RID: 2349 RVA: 0x00027978 File Offset: 0x00025B78
        public void SetNextSpawnAsBoss()
        {
            WeightedSelection <DirectorCard> weightedSelection = new WeightedSelection <DirectorCard>(8);
            bool flag  = !Run.instance.ShouldAllowNonChampionBossSpawn() || this.rng.nextNormalizedFloat > 0.1f;
            int  i     = 0;
            int  count = this.monsterCards.Count;

            while (i < count)
            {
                WeightedSelection <DirectorCard> .ChoiceInfo choice = this.monsterCards.GetChoice(i);
                SpawnCard          spawnCard          = choice.value.spawnCard;
                bool               isChampion         = spawnCard.prefab.GetComponent <CharacterMaster>().bodyPrefab.GetComponent <CharacterBody>().isChampion;
                CharacterSpawnCard characterSpawnCard = spawnCard as CharacterSpawnCard;
                bool               flag2 = characterSpawnCard != null && characterSpawnCard.forbiddenAsBoss;
                if (isChampion == flag && !flag2 && choice.value.CardIsValid())
                {
                    weightedSelection.AddChoice(choice);
                }
                i++;
            }
            if (weightedSelection.Count > 0)
            {
                this.PrepareNewMonsterWave(weightedSelection.Evaluate(this.rng.nextNormalizedFloat));
            }
            this.monsterSpawnTimer = -600f;
        }
Esempio n. 3
0
 // Token: 0x06000A1E RID: 2590 RVA: 0x0002C2AF File Offset: 0x0002A4AF
 public DirectorSpawnRequest(SpawnCard spawnCard, DirectorPlacementRule placementRule, Xoroshiro128Plus rng)
 {
     this.spawnCard     = spawnCard;
     this.placementRule = placementRule;
     this.rng           = rng;
 }
Esempio n. 4
0
 static public string GetSpawnCardName(RoR2.SpawnCard givenSpawncard)
 {
     return(givenSpawncard.name.Substring(prefixLength, givenSpawncard.name.Length - prefixLength));
 }
        // Token: 0x06000A25 RID: 2597 RVA: 0x0002C404 File Offset: 0x0002A604
        public GameObject TrySpawnObject([NotNull] DirectorSpawnRequest directorSpawnRequest)
        {
            SpawnCard             spawnCard     = directorSpawnRequest.spawnCard;
            DirectorPlacementRule placementRule = directorSpawnRequest.placementRule;
            Xoroshiro128Plus      rng           = directorSpawnRequest.rng;
            NodeGraph             nodeGraph     = SceneInfo.instance.GetNodeGraph(spawnCard.nodeGraphType);
            GameObject            result        = null;

            switch (placementRule.placementMode)
            {
            case DirectorPlacementRule.PlacementMode.Direct:
                result = spawnCard.DoSpawn(placementRule.spawnOnTarget ? placementRule.spawnOnTarget.position : directorSpawnRequest.placementRule.position, Quaternion.identity, directorSpawnRequest);
                break;

            case DirectorPlacementRule.PlacementMode.Approximate:
            {
                List <NodeGraph.NodeIndex> list = nodeGraph.FindNodesInRangeWithFlagConditions(placementRule.targetPosition, placementRule.minDistance, placementRule.maxDistance, (HullMask)(1 << (int)spawnCard.hullSize), spawnCard.requiredFlags, spawnCard.forbiddenFlags, placementRule.preventOverhead);
                while (list.Count > 0)
                {
                    int index = rng.RangeInt(0, list.Count);
                    NodeGraph.NodeIndex nodeIndex = list[index];
                    Vector3             position;
                    nodeGraph.GetNodePosition(nodeIndex, out position);
                    if (this.CheckPositionFree(nodeGraph, nodeIndex, spawnCard))
                    {
                        result = spawnCard.DoSpawn(position, Quaternion.identity, directorSpawnRequest);
                        if (spawnCard.occupyPosition)
                        {
                            this.AddOccupiedNode(nodeGraph, nodeIndex);
                            break;
                        }
                        break;
                    }
                    else
                    {
                        list.RemoveAt(index);
                    }
                }
                break;
            }

            case DirectorPlacementRule.PlacementMode.ApproximateSimple:
            {
                NodeGraph.NodeIndex nodeIndex2 = nodeGraph.FindClosestNodeWithFlagConditions(placementRule.targetPosition, spawnCard.hullSize, spawnCard.requiredFlags, spawnCard.forbiddenFlags, placementRule.preventOverhead);
                Vector3             position2;
                if (nodeGraph.GetNodePosition(nodeIndex2, out position2))
                {
                    if (this.CheckPositionFree(nodeGraph, nodeIndex2, spawnCard))
                    {
                        result = spawnCard.DoSpawn(position2, Quaternion.identity, directorSpawnRequest);
                        if (spawnCard.occupyPosition)
                        {
                            this.AddOccupiedNode(nodeGraph, nodeIndex2);
                        }
                    }
                    else
                    {
                        Debug.Log("Position not free.");
                    }
                }
                else
                {
                    Debug.Log("Could not find node.");
                }
                break;
            }

            case DirectorPlacementRule.PlacementMode.NearestNode:
            {
                NodeGraph.NodeIndex nodeIndex3 = nodeGraph.FindClosestNodeWithFlagConditions(placementRule.targetPosition, spawnCard.hullSize, spawnCard.requiredFlags, spawnCard.forbiddenFlags, placementRule.preventOverhead);
                Vector3             position3;
                if (nodeGraph.GetNodePosition(nodeIndex3, out position3))
                {
                    result = spawnCard.DoSpawn(position3, Quaternion.identity, directorSpawnRequest);
                    if (spawnCard.occupyPosition)
                    {
                        this.AddOccupiedNode(nodeGraph, nodeIndex3);
                    }
                }
                break;
            }

            case DirectorPlacementRule.PlacementMode.Random:
            {
                List <NodeGraph.NodeIndex> activeNodesForHullMaskWithFlagConditions = nodeGraph.GetActiveNodesForHullMaskWithFlagConditions((HullMask)(1 << (int)spawnCard.hullSize), spawnCard.requiredFlags, spawnCard.forbiddenFlags);
                while (activeNodesForHullMaskWithFlagConditions.Count > 0)
                {
                    int index2 = rng.RangeInt(0, activeNodesForHullMaskWithFlagConditions.Count);
                    NodeGraph.NodeIndex nodeIndex4 = activeNodesForHullMaskWithFlagConditions[index2];
                    Vector3             position4;
                    if (nodeGraph.GetNodePosition(nodeIndex4, out position4) && this.CheckPositionFree(nodeGraph, nodeIndex4, spawnCard))
                    {
                        result = spawnCard.DoSpawn(position4, Quaternion.identity, directorSpawnRequest);
                        if (spawnCard.occupyPosition)
                        {
                            this.AddOccupiedNode(nodeGraph, nodeIndex4);
                            break;
                        }
                        break;
                    }
                    else
                    {
                        activeNodesForHullMaskWithFlagConditions.RemoveAt(index2);
                    }
                }
                break;
            }
            }
            return(result);
        }
        // Token: 0x06000A24 RID: 2596 RVA: 0x0002C358 File Offset: 0x0002A558
        private bool CheckPositionFree(NodeGraph nodeGraph, NodeGraph.NodeIndex nodeIndex, SpawnCard spawnCard)
        {
            DirectorCore.NodeReference value = new DirectorCore.NodeReference(nodeGraph, nodeIndex);
            if (Array.IndexOf <DirectorCore.NodeReference>(this.occupiedNodes, value) != -1)
            {
                return(false);
            }
            float   num = HullDef.Find(spawnCard.hullSize).radius * 0.7f;
            Vector3 vector;

            nodeGraph.GetNodePosition(nodeIndex, out vector);
            if (spawnCard.nodeGraphType == MapNodeGroup.GraphType.Ground)
            {
                vector += Vector3.up * (num + 0.25f);
            }
            return(Physics.OverlapSphere(vector, num, LayerIndex.world.mask | LayerIndex.defaultLayer.mask | LayerIndex.fakeActor.mask).Length == 0);
        }
        public bool AlternateSpawnBehavior(GameObject spawnTarget, bool canBeElite)
        {
            if (this.currentMonsterCard.CardIsValid() && this.monsterCredit >= (float)this.currentMonsterCard.cost)
            {
                SpawnCard             spawnCard             = this.currentMonsterCard.spawnCard;
                DirectorPlacementRule directorPlacementRule = new DirectorPlacementRule
                {
                    placementMode   = DirectorPlacementRule.PlacementMode.Approximate,
                    spawnOnTarget   = spawnTarget.transform,
                    preventOverhead = this.currentMonsterCard.preventOverhead
                };
                DirectorCore.GetMonsterSpawnDistance(this.currentMonsterCard.spawnDistance, out directorPlacementRule.minDistance, out directorPlacementRule.maxDistance);
                directorPlacementRule.minDistance *= this.spawnDistanceMultiplier;
                directorPlacementRule.maxDistance *= this.spawnDistanceMultiplier;
                GameObject gameObject = DirectorCore.instance.TrySpawnObject(spawnCard, directorPlacementRule, this.rng);
                if (gameObject)
                {
                    int             cost          = this.currentMonsterCard.cost;
                    float           num3          = 1f;
                    float           num4          = 1f;
                    CharacterMaster component     = gameObject.GetComponent <CharacterMaster>();
                    GameObject      bodyObject    = component.GetBodyObject();
                    CharacterBody   characterBody = bodyObject.GetComponent <CharacterBody>();
                    if (this.isBoss)
                    {
                        if (!this.bossGroup)
                        {
                            GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/NetworkedObjects/BossGroup"));
                            NetworkServer.Spawn(gameObject2);
                            this.bossGroup = gameObject2.GetComponent <BossGroup>();
                            this.bossGroup.dropPosition = this.dropPosition;
                        }
                        this.bossGroup.AddMember(component);
                    }
                    // assumes CombatDirector.maximumNumberToSpawnBeforeSkipping == 4f; maybe add a check for this?
                    if (canBeElite) //try to make the mob elite before adding bonus items
                    {
                        if ((float)cost * CombatDirector.eliteMultiplierCost <= this.monsterCredit)
                        {
                            num3 = 4.7f;
                            num4 = 2f;
                            component.inventory.SetEquipmentIndex(EliteCatalog.GetEliteDef(this.currentActiveEliteIndex).eliteEquipmentIndex);
                            cost = (int)((float)cost * CombatDirector.eliteMultiplierCost);

                            //This is where we add the bonus items
                            var minCost = ((int)this.monsterCredit) / 4;  //CombatDirector.maximumNumberToSpawnBeforeSkipping
                            while (cost < minCost)
                            {
                                var newItem   = BalanceMod.Hooks.mobItemSelection.Evaluate(this.rng.nextNormalizedFloat);
                                var itemIndex = newItem.itemIndex;
                                var itemCount = newItem.itemCount;
                                // Debug.Log($"Giving {itemCount} of item {itemIndex}");
                                if (BalanceMod.Hooks.PatchLateGameMonsterSpawns_EnemyItemsInChat)
                                {
                                    Chat.AddPickupMessage(characterBody, ItemCatalog.GetItemDef(itemIndex).nameToken, BalanceMod.Hooks.GetItemColor(itemIndex), (uint)itemCount);
                                }
                                component.inventory.GiveItem(itemIndex, itemCount);
                                cost *= 2;
                            }
                        }
                    }
                    else
                    {                                                //This is where we add the bonus items
                        var minCost = ((int)this.monsterCredit) / 4; //CombatDirector.maximumNumberToSpawnBeforeSkipping
                        while (cost < minCost)
                        {
                            var newItem   = BalanceMod.Hooks.mobItemSelection.Evaluate(this.rng.nextNormalizedFloat);
                            var itemIndex = newItem.itemIndex;
                            var itemCount = newItem.itemCount;
                            // Debug.Log($"Giving {itemCount} of item {itemIndex}");
                            if (BalanceMod.Hooks.PatchLateGameMonsterSpawns_EnemyItemsInChat)
                            {
                                Chat.AddPickupMessage(characterBody, ItemCatalog.GetItemDef(itemIndex).nameToken, BalanceMod.Hooks.GetItemColor(itemIndex), (uint)itemCount);
                            }
                            component.inventory.GiveItem(itemIndex, itemCount);
                            cost *= 2;
                        }
                    }
                    this.monsterCredit -= (float)cost;
                    if (this.isBoss)
                    {
                        int livingPlayerCount = Run.instance.livingPlayerCount;
                        num3 *= Mathf.Pow((float)livingPlayerCount, 1f);
                    }
                    //elites have +400% hp and +100% damage
                    component.inventory.GiveItem(ItemIndex.BoostHp, Mathf.RoundToInt((num3 - 1f) * 10f));
                    component.inventory.GiveItem(ItemIndex.BoostDamage, Mathf.RoundToInt((num4 - 1f) * 10f));
                    DeathRewards component2 = bodyObject.GetComponent <DeathRewards>();
                    if (component2)
                    {
                        component2.expReward  = (uint)((float)cost * this.expRewardCoefficient * Run.instance.compensatedDifficultyCoefficient);
                        component2.goldReward = (uint)((float)cost * this.expRewardCoefficient * 2f * Run.instance.compensatedDifficultyCoefficient);
                    }
                    if (this.spawnEffectPrefab && NetworkServer.active)
                    {
                        Vector3 origin = gameObject.transform.position;
                        if (characterBody)
                        {
                            origin = characterBody.corePosition;
                        }
                        EffectManager.instance.SpawnEffect(this.spawnEffectPrefab, new EffectData
                        {
                            origin = origin
                        }, true);
                    }
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 8
0
        // Token: 0x06000E7C RID: 3708 RVA: 0x00047510 File Offset: 0x00045710
        private bool CheckPositionFree(NodeGraph nodeGraph, NodeGraph.NodeIndex nodeIndex, SpawnCard spawnCard)
        {
            for (int i = 0; i < this.occupiedNodes.Length; i++)
            {
                if (this.occupiedNodes[i].nodeGraph == nodeGraph && this.occupiedNodes[i].nodeIndex == nodeIndex)
                {
                    return(false);
                }
            }
            float   num = HullDef.Find(spawnCard.hullSize).radius * 0.7f;
            Vector3 vector;

            nodeGraph.GetNodePosition(nodeIndex, out vector);
            if (spawnCard.nodeGraphType == MapNodeGroup.GraphType.Ground)
            {
                vector += Vector3.up * (num + 0.25f);
            }
            return(Physics.OverlapSphere(vector, num, LayerIndex.world.mask | LayerIndex.defaultLayer.mask | LayerIndex.fakeActor.mask).Length == 0);
        }
Esempio n. 9
0
 // Token: 0x06000DBF RID: 3519 RVA: 0x00043984 File Offset: 0x00041B84
 private bool AttemptSpawnOnTarget(GameObject spawnTarget)
 {
     if (spawnTarget)
     {
         if (this.currentMonsterCard == null)
         {
             this.currentMonsterCard       = this.monsterCards.Evaluate(this.rng.nextNormalizedFloat);
             this.lastAttemptedMonsterCard = this.currentMonsterCard;
             this.currentActiveEliteIndex  = EliteCatalog.eliteList[this.rng.RangeInt(0, EliteCatalog.eliteList.Count)];
         }
         bool  flag = !(this.currentMonsterCard.spawnCard as CharacterSpawnCard).noElites;
         float num  = CombatDirector.maximumNumberToSpawnBeforeSkipping * (flag ? CombatDirector.eliteMultiplierCost : 1f);
         if (this.currentMonsterCard.CardIsValid() && this.monsterCredit >= (float)this.currentMonsterCard.cost && (!this.skipSpawnIfTooCheap || this.monsterCredit <= (float)this.currentMonsterCard.cost * num))
         {
             SpawnCard             spawnCard             = this.currentMonsterCard.spawnCard;
             DirectorPlacementRule directorPlacementRule = new DirectorPlacementRule
             {
                 placementMode   = DirectorPlacementRule.PlacementMode.Approximate,
                 spawnOnTarget   = spawnTarget.transform,
                 preventOverhead = this.currentMonsterCard.preventOverhead
             };
             DirectorCore.GetMonsterSpawnDistance(this.currentMonsterCard.spawnDistance, out directorPlacementRule.minDistance, out directorPlacementRule.maxDistance);
             directorPlacementRule.minDistance *= this.spawnDistanceMultiplier;
             directorPlacementRule.maxDistance *= this.spawnDistanceMultiplier;
             GameObject gameObject = DirectorCore.instance.TrySpawnObject(spawnCard, directorPlacementRule, this.rng);
             if (gameObject)
             {
                 int             num2       = this.currentMonsterCard.cost;
                 float           num3       = 1f;
                 float           num4       = 1f;
                 CharacterMaster component  = gameObject.GetComponent <CharacterMaster>();
                 GameObject      bodyObject = component.GetBodyObject();
                 if (this.isBoss)
                 {
                     if (!this.bossGroup)
                     {
                         GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/NetworkedObjects/BossGroup"));
                         NetworkServer.Spawn(gameObject2);
                         this.bossGroup = gameObject2.GetComponent <BossGroup>();
                         this.bossGroup.dropPosition = this.dropPosition;
                     }
                     this.bossGroup.AddMember(component);
                 }
                 if (flag && (float)num2 * CombatDirector.eliteMultiplierCost <= this.monsterCredit)
                 {
                     num3 = 4.7f;
                     num4 = 2f;
                     component.inventory.SetEquipmentIndex(EliteCatalog.GetEliteDef(this.currentActiveEliteIndex).eliteEquipmentIndex);
                     num2 = (int)((float)num2 * CombatDirector.eliteMultiplierCost);
                 }
                 int num5 = num2;
                 this.monsterCredit -= (float)num5;
                 if (this.isBoss)
                 {
                     int livingPlayerCount = Run.instance.livingPlayerCount;
                     num3 *= Mathf.Pow((float)livingPlayerCount, 1f);
                 }
                 component.inventory.GiveItem(ItemIndex.BoostHp, Mathf.RoundToInt((num3 - 1f) * 10f));
                 component.inventory.GiveItem(ItemIndex.BoostDamage, Mathf.RoundToInt((num4 - 1f) * 10f));
                 DeathRewards component2 = bodyObject.GetComponent <DeathRewards>();
                 if (component2)
                 {
                     component2.expReward  = (uint)((float)num2 * this.expRewardCoefficient * Run.instance.compensatedDifficultyCoefficient);
                     component2.goldReward = (uint)((float)num2 * this.expRewardCoefficient * 2f * Run.instance.compensatedDifficultyCoefficient);
                 }
                 if (this.spawnEffectPrefab && NetworkServer.active)
                 {
                     Vector3       origin     = gameObject.transform.position;
                     CharacterBody component3 = bodyObject.GetComponent <CharacterBody>();
                     if (component3)
                     {
                         origin = component3.corePosition;
                     }
                     EffectManager.instance.SpawnEffect(this.spawnEffectPrefab, new EffectData
                     {
                         origin = origin
                     }, true);
                 }
                 return(true);
             }
         }
     }
     return(false);
 }
        // Token: 0x06000934 RID: 2356 RVA: 0x00027E88 File Offset: 0x00026088
        private bool AttemptSpawnOnTarget(GameObject spawnTarget)
        {
            if (this.currentMonsterCard == null)
            {
                if (CombatDirector.cvDirectorCombatEnableInternalLogs.value)
                {
                    Debug.Log("Current monster card is null, pick new one.");
                }
                this.PrepareNewMonsterWave(this.monsterCards.Evaluate(this.rng.nextNormalizedFloat));
            }
            if (!spawnTarget)
            {
                if (CombatDirector.cvDirectorCombatEnableInternalLogs.value)
                {
                    Debug.LogFormat("Spawn target {0} is invalid.", new object[]
                    {
                        spawnTarget
                    });
                }
                return(false);
            }
            if (this.spawnCountInCurrentWave >= this.maximumNumberToSpawnBeforeSkipping)
            {
                this.spawnCountInCurrentWave = 0;
                if (CombatDirector.cvDirectorCombatEnableInternalLogs.value)
                {
                    Debug.LogFormat("Spawn count has hit the max ({0}/{1}). Aborting spawn.", new object[]
                    {
                        this.spawnCountInCurrentWave,
                        this.maximumNumberToSpawnBeforeSkipping
                    });
                }
                return(false);
            }
            int cost = this.currentMonsterCard.cost;
            int num  = this.currentMonsterCard.cost;
            int num2 = this.currentMonsterCard.cost;

            CombatDirector.EliteTierDef eliteTierDef = this.currentActiveEliteTier;
            EliteIndex eliteIndex = this.currentActiveEliteIndex;

            num2 = (int)((float)num * this.currentActiveEliteTier.costMultiplier);
            if ((float)num2 <= this.monsterCredit)
            {
                num          = num2;
                eliteTierDef = this.currentActiveEliteTier;
                eliteIndex   = this.currentActiveEliteIndex;
            }
            else
            {
                eliteTierDef = CombatDirector.eliteTiers[0];
                eliteIndex   = EliteIndex.None;
            }
            if (!this.currentMonsterCard.CardIsValid())
            {
                if (CombatDirector.cvDirectorCombatEnableInternalLogs.value)
                {
                    Debug.LogFormat("Spawn card {0} is invalid, aborting spawn.", new object[]
                    {
                        this.currentMonsterCard.spawnCard
                    });
                }
                return(false);
            }
            if (this.monsterCredit < (float)num)
            {
                if (CombatDirector.cvDirectorCombatEnableInternalLogs.value)
                {
                    Debug.LogFormat("Spawn card {0} is too expensive, aborting spawn.", new object[]
                    {
                        this.currentMonsterCard.spawnCard
                    });
                }
                return(false);
            }
            if (this.skipSpawnIfTooCheap && (float)(num2 * this.maximumNumberToSpawnBeforeSkipping) < this.monsterCredit)
            {
                if (CombatDirector.cvDirectorCombatEnableInternalLogs.value)
                {
                    Debug.LogFormat("Card {0} seems too cheap ({1}/{2}). Comparing against most expensive possible ({3})", new object[]
                    {
                        this.currentMonsterCard.spawnCard,
                        num * this.maximumNumberToSpawnBeforeSkipping,
                        this.monsterCredit,
                        this.mostExpensiveMonsterCostInDeck
                    });
                }
                if (this.mostExpensiveMonsterCostInDeck > num)
                {
                    if (CombatDirector.cvDirectorCombatEnableInternalLogs.value)
                    {
                        Debug.LogFormat("Spawn card {0} is too cheap, aborting spawn.", new object[]
                        {
                            this.currentMonsterCard.spawnCard
                        });
                    }
                    return(false);
                }
            }
            SpawnCard             spawnCard             = this.currentMonsterCard.spawnCard;
            DirectorPlacementRule directorPlacementRule = new DirectorPlacementRule
            {
                placementMode   = DirectorPlacementRule.PlacementMode.Approximate,
                spawnOnTarget   = spawnTarget.transform,
                preventOverhead = this.currentMonsterCard.preventOverhead
            };

            DirectorCore.GetMonsterSpawnDistance(this.currentMonsterCard.spawnDistance, out directorPlacementRule.minDistance, out directorPlacementRule.maxDistance);
            directorPlacementRule.minDistance *= this.spawnDistanceMultiplier;
            directorPlacementRule.maxDistance *= this.spawnDistanceMultiplier;
            DirectorSpawnRequest directorSpawnRequest = new DirectorSpawnRequest(spawnCard, directorPlacementRule, this.rng);

            directorSpawnRequest.ignoreTeamMemberLimit = true;
            directorSpawnRequest.teamIndexOverride     = new TeamIndex?(TeamIndex.Monster);
            GameObject gameObject = DirectorCore.instance.TrySpawnObject(directorSpawnRequest);

            if (!gameObject)
            {
                Debug.LogFormat("Spawn card {0} failed to spawn. Aborting cost procedures.", new object[]
                {
                    spawnCard
                });
                return(false);
            }
            this.monsterCredit -= (float)num;
            this.spawnCountInCurrentWave++;
            CharacterMaster component  = gameObject.GetComponent <CharacterMaster>();
            GameObject      bodyObject = component.GetBodyObject();

            if (this.combatSquad)
            {
                this.combatSquad.AddMember(component);
            }
            float          num3 = eliteTierDef.healthBoostCoefficient;
            float          damageBoostCoefficient = eliteTierDef.damageBoostCoefficient;
            EliteDef       eliteDef       = EliteCatalog.GetEliteDef(eliteIndex);
            EquipmentIndex equipmentIndex = (eliteDef != null) ? eliteDef.eliteEquipmentIndex : EquipmentIndex.None;

            if (equipmentIndex != EquipmentIndex.None)
            {
                component.inventory.SetEquipmentIndex(equipmentIndex);
            }
            if (this.combatSquad)
            {
                int livingPlayerCount = Run.instance.livingPlayerCount;
                num3 *= Mathf.Pow((float)livingPlayerCount, 1f);
            }
            component.inventory.GiveItem(ItemIndex.BoostHp, Mathf.RoundToInt((num3 - 1f) * 10f));
            component.inventory.GiveItem(ItemIndex.BoostDamage, Mathf.RoundToInt((damageBoostCoefficient - 1f) * 10f));
            DeathRewards component2 = bodyObject.GetComponent <DeathRewards>();

            if (component2)
            {
                component2.expReward  = (uint)((float)num * this.expRewardCoefficient * Run.instance.compensatedDifficultyCoefficient);
                component2.goldReward = (uint)((float)num * this.expRewardCoefficient * 2f * Run.instance.compensatedDifficultyCoefficient);
            }
            if (this.spawnEffectPrefab && NetworkServer.active)
            {
                Vector3       origin     = gameObject.transform.position;
                CharacterBody component3 = bodyObject.GetComponent <CharacterBody>();
                if (component3)
                {
                    origin = component3.corePosition;
                }
                EffectManager.SpawnEffect(this.spawnEffectPrefab, new EffectData
                {
                    origin = origin
                }, true);
            }
            CombatDirector.OnSpawnedServer onSpawnedServer = this.onSpawnedServer;
            if (onSpawnedServer != null)
            {
                onSpawnedServer.Invoke(gameObject);
            }
            return(true);
        }