private void AddMonsterType()
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.ArenaMissionController::AddMonsterType()' called on client");
                return;
            }
            if (this.availableMonsterCards.Count == 0)
            {
                Debug.Log("Out of monster types! Aborting.");
                return;
            }
            int          num   = this.availableMonsterCards.EvaluteToChoiceIndex(this.rng.nextNormalizedFloat);
            DirectorCard value = this.availableMonsterCards.choices[num].value;

            this.activeMonsterCards.Add(value);
            SyncList <int>  syncList  = this.syncActiveMonsterBodies;
            CharacterMaster component = value.spawnCard.prefab.GetComponent <CharacterMaster>();
            int?            num2;

            if (component == null)
            {
                num2 = null;
            }
            else
            {
                CharacterBody component2 = component.bodyPrefab.GetComponent <CharacterBody>();
                num2 = ((component2 != null) ? new int?(component2.bodyIndex) : null);
            }
            syncList.Add(num2 ?? -1);
            this.availableMonsterCards.RemoveChoice(num);
            CharacterBody component3 = value.spawnCard.prefab.GetComponent <CharacterMaster>().bodyPrefab.GetComponent <CharacterBody>();

            Chat.SendBroadcastChat(new Chat.SubjectFormatChatMessage
            {
                baseToken   = "ARENA_ADD_MONSTER",
                paramTokens = new string[]
                {
                    component3.baseNameToken
                }
            });
        }
Exemplo n.º 2
0
        // Token: 0x06001592 RID: 5522 RVA: 0x00067604 File Offset: 0x00065804
        private void InitCombatShrineValues()
        {
            WeightedSelection <DirectorCard> monsterSelection  = ClassicStageInfo.instance.monsterSelection;
            WeightedSelection <DirectorCard> weightedSelection = new WeightedSelection <DirectorCard>(8);

            for (int i = 0; i < monsterSelection.Count; i++)
            {
                DirectorCard value = monsterSelection.choices[i].value;
                if ((float)value.cost <= this.monsterCredit && (float)value.cost * CombatDirector.maximumNumberToSpawnBeforeSkipping * CombatDirector.eliteMultiplierCost / 2f > this.monsterCredit && value.CardIsValid())
                {
                    weightedSelection.AddChoice(value, monsterSelection.choices[i].weight);
                }
            }
            if (weightedSelection.Count == 0)
            {
                if (this.chosenDirectorCard == null)
                {
                    Debug.Log("Could not find appropriate spawn card for Combat Shrine");
                    this.purchaseInteraction.SetAvailable(false);
                }
                return;
            }
            this.chosenDirectorCard = weightedSelection.Evaluate(this.rng.nextNormalizedFloat);
        }
        // Token: 0x06001294 RID: 4756 RVA: 0x0004FF00 File Offset: 0x0004E100
        private void PopulateScene()
        {
            ClassicStageInfo component = SceneInfo.instance.GetComponent <ClassicStageInfo>();

            this.PlaceTeleporter();
            Action action = new Action(this.DefaultPlayerSpawnPointGenerator);

            SceneDirector.GenerateSpawnPointsDelegate generateSpawnPointsDelegate = SceneDirector.onPreGeneratePlayerSpawnPointsServer;
            if (generateSpawnPointsDelegate != null)
            {
                generateSpawnPointsDelegate(this, ref action);
            }
            if (action != null)
            {
                action();
            }
            Run.instance.OnPlayerSpawnPointsPlaced(this);
            while (this.interactableCredit > 0)
            {
                DirectorCard directorCard = this.SelectCard(component.interactableSelection, this.interactableCredit);
                if (directorCard == null)
                {
                    break;
                }
                if (directorCard.CardIsValid())
                {
                    this.interactableCredit -= directorCard.cost;
                    if (Run.instance)
                    {
                        int i = 0;
                        while (i < 10)
                        {
                            DirectorPlacementRule placementRule = new DirectorPlacementRule
                            {
                                placementMode = DirectorPlacementRule.PlacementMode.Random
                            };
                            GameObject gameObject = this.directorCore.TrySpawnObject(new DirectorSpawnRequest(directorCard.spawnCard, placementRule, this.rng));
                            if (gameObject)
                            {
                                PurchaseInteraction component2 = gameObject.GetComponent <PurchaseInteraction>();
                                if (component2 && component2.costType == CostTypeIndex.Money)
                                {
                                    component2.Networkcost = Run.instance.GetDifficultyScaledCost(component2.cost);
                                    break;
                                }
                                break;
                            }
                            else
                            {
                                i++;
                            }
                        }
                    }
                }
            }
            if (Run.instance && Run.instance.stageClearCount == 0)
            {
                this.monsterCredit = 0;
            }
            int num = 0;

            while (this.monsterCredit > 0 && num < 40)
            {
                DirectorCard directorCard2 = this.SelectCard(component.monsterSelection, this.monsterCredit);
                if (directorCard2 == null)
                {
                    break;
                }
                if (directorCard2.CardIsValid())
                {
                    this.monsterCredit -= directorCard2.cost;
                    int j = 0;
                    while (j < 10)
                    {
                        DirectorSpawnRequest directorSpawnRequest = new DirectorSpawnRequest(directorCard2.spawnCard, new DirectorPlacementRule
                        {
                            placementMode = DirectorPlacementRule.PlacementMode.Random
                        }, this.rng);
                        directorSpawnRequest.teamIndexOverride = new TeamIndex?(TeamIndex.Monster);
                        GameObject gameObject2 = this.directorCore.TrySpawnObject(directorSpawnRequest);
                        if (gameObject2)
                        {
                            num++;
                            CharacterMaster component3 = gameObject2.GetComponent <CharacterMaster>();
                            if (component3)
                            {
                                GameObject bodyObject = component3.GetBodyObject();
                                if (bodyObject)
                                {
                                    DeathRewards component4 = bodyObject.GetComponent <DeathRewards>();
                                    if (component4)
                                    {
                                        component4.expReward  = (uint)((float)directorCard2.cost * this.expRewardCoefficient * Run.instance.difficultyCoefficient);
                                        component4.goldReward = (uint)((float)directorCard2.cost * this.expRewardCoefficient * 2f * Run.instance.difficultyCoefficient);
                                    }
                                    foreach (EntityStateMachine entityStateMachine in bodyObject.GetComponents <EntityStateMachine>())
                                    {
                                        entityStateMachine.initialStateType = entityStateMachine.mainStateType;
                                    }
                                }
                                num++;
                                break;
                            }
                            break;
                        }
                        else
                        {
                            j++;
                        }
                    }
                }
            }
            Xoroshiro128Plus xoroshiro128Plus = new Xoroshiro128Plus(this.rng.nextUlong);

            if (SceneInfo.instance.countsAsStage)
            {
                int num2 = 0;
                foreach (CharacterMaster characterMaster in CharacterMaster.readOnlyInstancesList)
                {
                    num2 += characterMaster.inventory.GetItemCount(ItemIndex.TreasureCache);
                }
                if (num2 > 0)
                {
                    GameObject gameObject3 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(Resources.Load <SpawnCard>("SpawnCards/InteractableSpawnCard/iscLockbox"), new DirectorPlacementRule
                    {
                        placementMode = DirectorPlacementRule.PlacementMode.Random
                    }, xoroshiro128Plus));
                    if (gameObject3)
                    {
                        ChestBehavior component5 = gameObject3.GetComponent <ChestBehavior>();
                        if (component5)
                        {
                            component5.tier2Chance *= (float)num2;
                            component5.tier3Chance *= Mathf.Pow((float)num2, 2f);
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
 // Token: 0x06000915 RID: 2325 RVA: 0x000274D4 File Offset: 0x000256D4
 private static bool CardIsChampion(DirectorCard card)
 {
     return(card.spawnCard.prefab.GetComponent <CharacterMaster>().bodyPrefab.GetComponent <CharacterBody>().isChampion);
 }
        public void BeginRound()
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.ArenaMissionController::BeginRound()' called on client");
                return;
            }
            int currentRound = this.currentRound;

            this.currentRound = currentRound + 1;
            switch (this.currentRound)
            {
            case 1:
                this.AddMonsterType();
                break;

            case 2:
                this.AddItemType(ItemTier.Tier1);
                break;

            case 3:
                this.AddMonsterType();
                break;

            case 4:
                this.AddItemType(ItemTier.Tier1);
                break;

            case 5:
                this.AddMonsterType();
                break;

            case 6:
                this.AddItemType(ItemTier.Tier2);
                break;

            case 7:
                this.AddMonsterType();
                break;

            case 8:
                this.AddItemType(ItemTier.Tier2);
                break;

            case 9:
                this.AddItemType(ItemTier.Tier3);
                break;
            }
            UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/NetworkedObjects/Encounters/ArenaRoundEncounter"));
            for (int i = 0; i < this.activeMonsterCards.Count; i++)
            {
                DirectorCard directorCard     = this.activeMonsterCards[i];
                float        num              = this.creditsThisRound / (float)this.activeMonsterCards.Count;
                float        creditMultiplier = this.creditMultiplierPerRound * (float)this.currentRound / (float)this.activeMonsterCards.Count;
                if (i > this.combatDirectors.Length)
                {
                    Debug.LogError("Trying to activate more combat directors than available. Aborting.");
                    return;
                }
                CombatDirector combatDirector = this.combatDirectors[i];
                combatDirector.monsterCredit     += num;
                combatDirector.creditMultiplier   = creditMultiplier;
                combatDirector.currentSpawnTarget = this.monsterSpawnPosition;
                combatDirector.OverrideCurrentMonsterCard(directorCard);
                combatDirector.monsterSpawnTimer = 0f;
                combatDirector.enabled           = true;
                Debug.LogFormat("Enabling director {0} with {1} credits to spawn {2}", new object[]
                {
                    i,
                    num,
                    directorCard.spawnCard.name
                });
            }
        }
Exemplo n.º 6
0
        // Token: 0x06000913 RID: 2323 RVA: 0x00027444 File Offset: 0x00025644
        private static bool CardIsChest(DirectorCard card)
        {
            string name = card.spawnCard.prefab.name;

            return(name == "EquipmentBarrel" || name.Contains("Chest") || card.spawnCard.prefab.name.Contains("TripleShop"));
        }
Exemplo n.º 7
0
        // Token: 0x06000914 RID: 2324 RVA: 0x0002749C File Offset: 0x0002569C
        private static bool CardIsBarrel(DirectorCard card)
        {
            string name = card.spawnCard.prefab.name;

            return(name != "EquipmentBarrel" && name.Contains("Barrel"));
        }
Exemplo n.º 8
0
        // Token: 0x06000912 RID: 2322 RVA: 0x000273F0 File Offset: 0x000255F0
        private static bool CardIsMiniBoss(DirectorCard card)
        {
            string name = card.spawnCard.prefab.name;

            return(name == "GolemMaster" || name == "BisonMaster" || name == "GreaterWispMaster" || name == "BeetleGuardMaster");
        }
Exemplo n.º 9
0
 // Token: 0x06000E7D RID: 3709 RVA: 0x000475E8 File Offset: 0x000457E8
 public GameObject TrySpawnObject(DirectorCard directorCard, DirectorPlacementRule placementRule, [NotNull] Xoroshiro128Plus rng)
 {
     return(this.TrySpawnObject(directorCard.spawnCard, placementRule, rng));
 }
Exemplo n.º 10
0
 // Token: 0x06000DBB RID: 3515 RVA: 0x000436B9 File Offset: 0x000418B9
 public void OverrideCurrentMonsterCard(DirectorCard overrideMonsterCard)
 {
     this.currentMonsterCard = overrideMonsterCard;
 }
 // Token: 0x06000933 RID: 2355 RVA: 0x00027CB8 File Offset: 0x00025EB8
 private unsafe void PrepareNewMonsterWave(DirectorCard monsterCard)
 {
     if (CombatDirector.cvDirectorCombatEnableInternalLogs.value)
     {
         Debug.LogFormat("Preparing monster wave {0}", new object[]
         {
             monsterCard.spawnCard
         });
     }
     this.currentMonsterCard     = monsterCard;
     this.currentActiveEliteTier = CombatDirector.eliteTiers[0];
     if (!(this.currentMonsterCard.spawnCard as CharacterSpawnCard).noElites)
     {
         for (int i = 1; i < CombatDirector.eliteTiers.Length; i++)
         {
             CombatDirector.EliteTierDef eliteTierDef = CombatDirector.eliteTiers[i];
             if (!eliteTierDef.isAvailable())
             {
                 if (CombatDirector.cvDirectorCombatEnableInternalLogs.value)
                 {
                     Debug.LogFormat("Elite tier index {0} is unavailable", new object[]
                     {
                         i
                     });
                 }
             }
             else
             {
                 float num = (float)this.currentMonsterCard.cost * eliteTierDef.costMultiplier * this.eliteBias;
                 if (num <= this.monsterCredit)
                 {
                     this.currentActiveEliteTier = eliteTierDef;
                     if (CombatDirector.cvDirectorCombatEnableInternalLogs.value)
                     {
                         Debug.LogFormat("Found valid elite tier index {0}", new object[]
                         {
                             i
                         });
                     }
                 }
                 else if (CombatDirector.cvDirectorCombatEnableInternalLogs.value)
                 {
                     Debug.LogFormat("Elite tier index {0} is too expensive ({1}/{2})", new object[]
                     {
                         i,
                         num,
                         this.monsterCredit
                     });
                 }
             }
         }
     }
     else if (CombatDirector.cvDirectorCombatEnableInternalLogs.value)
     {
         Debug.LogFormat("Card {0} cannot be elite. Skipping elite procedure.", new object[]
         {
             this.currentMonsterCard.spawnCard
         });
     }
     this.currentActiveEliteIndex = *this.rng.NextElementUniform <EliteIndex>(this.currentActiveEliteTier.eliteTypes);
     if (CombatDirector.cvDirectorCombatEnableInternalLogs.value)
     {
         Debug.LogFormat("Assigned elite index {0}", new object[]
         {
             this.currentActiveEliteIndex
         });
     }
     this.lastAttemptedMonsterCard = this.currentMonsterCard;
     this.spawnCountInCurrentWave  = 0;
 }
 // Token: 0x0600092C RID: 2348 RVA: 0x0002796D File Offset: 0x00025B6D
 public void OverrideCurrentMonsterCard(DirectorCard overrideMonsterCard)
 {
     this.PrepareNewMonsterWave(overrideMonsterCard);
 }