Exemple #1
0
        public void CreateElite()
        {
            var eliteDef = new RoR2.EliteDef
            {
                name                = "Hypercharged",
                modifierToken       = "ARES_HYPERCHARGED",
                color               = Color.white,
                eliteEquipmentIndex = AffixEquipmentIndex
            };

            EliteIndex = EliteAPI.Add(new CustomElite(eliteDef, 2));
            LanguageAPI.Add(eliteDef.modifierToken, eliteDef.name + " {0}");

            EliteBuffDef.eliteIndex       = EliteIndex;
            EliteBuffIndex                = BuffAPI.Add(new CustomBuff(EliteBuffDef));
            AffixEquipmentDef.passiveBuff = EliteBuffIndex;

            EliteAffixCard = new EliteAffixCard
            {
                spawnWeight      = 0.5f,
                costMultiplier   = 30.0f,
                damageBoostCoeff = 2.0f,
                healthBoostCoeff = 4.5f,
                eliteOnlyScaling = 0.5f,
                eliteType        = EliteIndex
            };
            EsoLib.Cards.Add(EliteAffixCard);
        }
Exemple #2
0
 // Token: 0x0600056D RID: 1389 RVA: 0x000160D8 File Offset: 0x000142D8
 private static void RegisterElite(EliteIndex eliteIndex, EliteDef eliteDef)
 {
     if (eliteIndex < EliteIndex.Count)
     {
         eliteDef.name = eliteIndex.ToString();
     }
     eliteDef.eliteIndex = eliteIndex;
     EliteCatalog.eliteList.Add(eliteIndex);
     EliteCatalog.eliteDefs[(int)eliteIndex] = eliteDef;
 }
Exemple #3
0
        public override void SetupAttributes()
        {
            base.SetupAttributes();
            equipmentDef.canDrop          = false;
            equipmentDef.enigmaCompatible = false;

            var buffDef = new RoR2.BuffDef
            {
                name      = EliteBuffName,
                buffColor = new Color32(255, 255, 255, byte.MaxValue),
                iconPath  = EliteBuffIconPath,
                canStack  = false,
            };

            buffDef.eliteIndex = EliteIndex;
            var buffIndex = new CustomBuff(buffDef);

            EliteBuffIndex           = BuffAPI.Add(buffIndex);
            equipmentDef.passiveBuff = EliteBuffIndex;

            var eliteDef = new RoR2.EliteDef
            {
                name          = ElitePrefixName,
                modifierToken = EliteModifierString,
                color         = buffDef.buffColor,
            };

            eliteDef.eliteEquipmentIndex = equipmentDef.equipmentIndex;
            var eliteIndex = new CustomElite(eliteDef, EliteTier);

            EliteIndex = EliteAPI.Add(eliteIndex);

            var card = new EliteAffixCard
            {
                spawnWeight      = 0.5f,
                costMultiplier   = 15.0f,
                damageBoostCoeff = 2.0f,
                healthBoostCoeff = 2.0f,
                eliteOnlyScaling = 0.5f,
                eliteType        = EliteIndex
            };

            EsoLib.Cards.Add(card);
            EliteCard = card;

            LanguageAPI.Add(eliteDef.modifierToken, ElitePrefixName + " {0}");

            EliteMaterial = Resources.Load <Material>("@Aetherium:Assets/Textures/Materials/HisCourage.mat");
        }
        public override void SetupAttributes()
        {
            base.SetupAttributes();
            equipmentDef.canDrop          = false;
            equipmentDef.enigmaCompatible = false;
            equipmentDef.cooldown         = 60;

            var buffDef = new RoR2.BuffDef
            {
                name      = EliteBuffName,
                buffColor = new Color32(255, 255, 255, byte.MaxValue),
                iconPath  = EliteBuffIconPath,
                canStack  = false,
            };

            buffDef.eliteIndex = EliteIndex;
            var buffIndex = new CustomBuff(buffDef);

            EliteBuffIndex           = BuffAPI.Add(buffIndex);
            equipmentDef.passiveBuff = EliteBuffIndex;

            var eliteDef = new RoR2.EliteDef
            {
                name          = ElitePrefixName,
                modifierToken = EliteModifierString,
                color         = buffDef.buffColor,
            };

            eliteDef.eliteEquipmentIndex = equipmentDef.equipmentIndex;
            var eliteIndex = new CustomElite(eliteDef, EliteTier);

            EliteIndex = EliteAPI.Add(eliteIndex);

            var card = new EliteAffixCard
            {
                spawnWeight      = 0.5f,
                costMultiplier   = 30.0f,
                damageBoostCoeff = 2.0f,
                healthBoostCoeff = 4.5f,
                eliteOnlyScaling = 0.5f,
                eliteType        = EliteIndex
            };

            EsoLib.Cards.Add(card);
            EliteCard = card;

            LanguageAPI.Add(eliteDef.modifierToken, ElitePrefixName + " {0}");

            //If we want to load a base game material, then we use this.

            /*GameObject worm = Resources.Load<GameObject>("Prefabs/characterbodies/ElectricWormBody");
             * Debug.Log($"WORM: {worm}");
             * var modelLocator = worm.GetComponent<ModelLocator>();
             * Debug.Log($"MODEL LOCATOR: {modelLocator}");
             * var model = modelLocator.modelTransform.GetComponent<CharacterModel>();
             * Debug.Log($"MODEL: {model}");
             * if (model)
             * {
             *  var rendererInfos = model.baseRendererInfos;
             *  foreach (CharacterModel.RendererInfo renderer in rendererInfos)
             *  {
             *      if (renderer.defaultMaterial.name == "matElectricWorm")
             *      {
             *          HyperchargedMaterial = renderer.defaultMaterial;
             *      }
             *  }
             * }*/

            //If we want to load our own, uncomment the one below.
            EliteMaterial = Resources.Load <Material>("@Aetherium:Assets/Textures/Materials/TheirReminder.mat");
        }
        public override void SetupAttributes()
        {
            base.SetupAttributes();
            equipmentDef.canDrop          = false;
            equipmentDef.enigmaCompatible = false;
            equipmentDef.cooldown         = 60;

            var buffDef = new RoR2.BuffDef
            {
                name      = EliteBuffName,
                buffColor = new Color32(255, 255, 255, byte.MaxValue),
                iconPath  = EliteBuffIconPath,
                canStack  = false,
            };

            buffDef.eliteIndex = EliteIndex;
            var buffIndex = new CustomBuff(buffDef);

            EliteBuffIndex           = BuffAPI.Add(buffIndex);
            equipmentDef.passiveBuff = EliteBuffIndex;

            var eliteDef = new RoR2.EliteDef
            {
                name          = ElitePrefixName,
                modifierToken = EliteModifierString,
                color         = buffDef.buffColor,
            };

            eliteDef.eliteEquipmentIndex = equipmentDef.equipmentIndex;
            var eliteIndex = new CustomElite(eliteDef, EliteTier);

            EliteIndex = EliteAPI.Add(eliteIndex);

            var card = new EliteAffixCard
            {
                spawnWeight      = 0.5f,
                costMultiplier   = 30.0f,
                damageBoostCoeff = 2.0f,
                healthBoostCoeff = 4.5f,
                eliteOnlyScaling = 0.5f,
                eliteType        = EliteIndex
            };

            EsoLib.Cards.Add(card);
            EliteCard = card;

            LanguageAPI.Add(eliteDef.modifierToken, ElitePrefixName + " {0}");

            //If we want to load a base game material, then we use this.

            /*GameObject worm = Resources.Load<GameObject>("Prefabs/characterbodies/ElectricWormBody");
             * Debug.Log($"WORM: {worm}");
             * var modelLocator = worm.GetComponent<ModelLocator>();
             * Debug.Log($"MODEL LOCATOR: {modelLocator}");
             * var model = modelLocator.modelTransform.GetComponent<CharacterModel>();
             * Debug.Log($"MODEL: {model}");
             * if (model)
             * {
             *  var rendererInfos = model.baseRendererInfos;
             *  foreach (CharacterModel.RendererInfo renderer in rendererInfos)
             *  {
             *      if (renderer.defaultMaterial.name == "matElectricWorm")
             *      {
             *          HyperchargedMaterial = renderer.defaultMaterial;
             *      }
             *  }
             * }*/

            //If we want to load our own, uncomment the one below.
            EliteMaterial = Resources.Load <Material>("@Aetherium:Assets/Textures/Materials/TheirReminder.mat");

            HyperchargedProjectile = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/Projectiles/LightningStake"), "HyperchargedProjectile", true);

            var controller = HyperchargedProjectile.GetComponent <ProjectileController>();

            controller.startSound = "Play_titanboss_shift_shoot";

            var impactExplosion = HyperchargedProjectile.GetComponent <RoR2.Projectile.ProjectileImpactExplosion>();

            impactExplosion.lifetime        = 0.5f;
            impactExplosion.impactEffect    = Resources.Load <GameObject>("Prefabs/Effects/ImpactEffects/LightningStrikeImpact");
            impactExplosion.blastRadius     = 7f;
            impactExplosion.bonusBlastForce = new Vector3(0, 750, 0);

            // register it for networking
            if (HyperchargedProjectile)
            {
                PrefabAPI.RegisterNetworkPrefab(HyperchargedProjectile);
            }

            // add it to the projectile catalog or it won't work in multiplayer
            RoR2.ProjectileCatalog.getAdditionalEntries += list =>
            {
                list.Add(HyperchargedProjectile);
            };
        }
        public override void SetupAttributes()
        {
            base.SetupAttributes();
            equipmentDef.canDrop          = false;
            equipmentDef.enigmaCompatible = false;
            equipmentDef.cooldown         = 40;

            var buffDef = new RoR2.BuffDef
            {
                name      = EliteBuffName,
                buffColor = new Color32(255, 255, 255, byte.MaxValue),
                iconPath  = EliteBuffIconPath,
                canStack  = false,
            };

            buffDef.eliteIndex = EliteIndex;
            var buffIndex = new CustomBuff(buffDef);

            EliteBuffIndex           = BuffAPI.Add(buffIndex);
            equipmentDef.passiveBuff = EliteBuffIndex;

            var eliteDef = new RoR2.EliteDef
            {
                name          = ElitePrefixName,
                modifierToken = EliteModifierString,
                color         = buffDef.buffColor,
            };

            eliteDef.eliteEquipmentIndex = equipmentDef.equipmentIndex;
            var eliteIndex = new CustomElite(eliteDef, EliteTier);

            EliteIndex = EliteAPI.Add(eliteIndex);

            var card = new EliteAffixCard
            {
                spawnWeight      = 0.5f,
                costMultiplier   = 30.0f,
                damageBoostCoeff = 2.0f,
                healthBoostCoeff = 4.5f,
                eliteOnlyScaling = 0.5f,
                eliteType        = EliteIndex
            };

            EsoLib.Cards.Add(card);
            EliteCard = card;

            LanguageAPI.Add(eliteDef.modifierToken, ElitePrefixName + " {0}");

            RadiantProjectile = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/Projectiles/Thermite"), "RadiantProjectile", true);

            var damage = RadiantProjectile.GetComponent <RoR2.Projectile.ProjectileDamage>();

            damage.damageType = DamageType.IgniteOnHit;

            var simpleProjectile = RadiantProjectile.GetComponent <ProjectileSimple>();

            simpleProjectile.velocity           = 100;
            simpleProjectile.oscillateMagnitude = 0;

            if (RadiantProjectile)
            {
                PrefabAPI.RegisterNetworkPrefab(RadiantProjectile);
            }

            RoR2.ProjectileCatalog.getAdditionalEntries += list =>
            {
                list.Add(RadiantProjectile);
            };

            //If we want to load a base game material, then we use this.

            /*GameObject worm = Resources.Load<GameObject>("Prefabs/characterbodies/ElectricWormBody");
             * Debug.Log($"WORM: {worm}");
             * var modelLocator = worm.GetComponent<ModelLocator>();
             * Debug.Log($"MODEL LOCATOR: {modelLocator}");
             * var model = modelLocator.modelTransform.GetComponent<CharacterModel>();
             * Debug.Log($"MODEL: {model}");
             * if (model)
             * {
             *  var rendererInfos = model.baseRendererInfos;
             *  foreach (CharacterModel.RendererInfo renderer in rendererInfos)
             *  {
             *      if (renderer.defaultMaterial.name == "matElectricWorm")
             *      {
             *          HyperchargedMaterial = renderer.defaultMaterial;
             *      }
             *  }
             * }*/

            //If we want to load our own, uncomment the one below.
            EliteMaterial = Resources.Load <Material>("@Aetherium:Assets/Textures/Materials/ApollosBrillianceMain.mat");
            //Shader hotpoo = Resources.Load<Shader>("Shaders/Deferred/hgstandard");
        }
 // Token: 0x06000ADD RID: 2781 RVA: 0x00035A46 File Offset: 0x00033C46
 private static void RegisterElite(EliteIndex eliteIndex, EliteDef eliteDef)
 {
     eliteDef.eliteIndex = eliteIndex;
     EliteCatalog.eliteList.Add(eliteIndex);
     EliteCatalog.eliteDefs[(int)eliteIndex] = eliteDef;
 }
        public override void SetupAttributes()
        {
            if (ItemBodyModelPrefab == null)
            {
                ItemBodyModelPrefab          = Resources.Load <GameObject>("@Aetherium:Assets/Models/Prefabs/HisVengeanceDisplay.prefab");
                SecondaryItemBodyModelPrefab = Resources.Load <GameObject>("@Aetherium:Assets/Models/Prefabs/HisVengeanceCluster.prefab");
                displayRules = GenerateItemDisplayRules();
            }
            base.SetupAttributes();
            equipmentDef.canDrop          = false;
            equipmentDef.enigmaCompatible = false;

            var buffDef = new RoR2.BuffDef
            {
                name      = EliteBuffName,
                buffColor = new Color32(255, 255, 255, byte.MaxValue),
                iconPath  = EliteBuffIconPath,
                canStack  = false,
            };

            buffDef.eliteIndex = EliteIndex;
            var buffIndex = new CustomBuff(buffDef);

            EliteBuffIndex           = BuffAPI.Add(buffIndex);
            equipmentDef.passiveBuff = EliteBuffIndex;

            var eliteDef = new RoR2.EliteDef
            {
                name          = ElitePrefixName,
                modifierToken = EliteModifierString,
                color         = buffDef.buffColor,
            };

            eliteDef.eliteEquipmentIndex = equipmentDef.equipmentIndex;
            var eliteIndex = new CustomElite(eliteDef, EliteTier);

            EliteIndex = EliteAPI.Add(eliteIndex);

            var card = new EliteAffixCard
            {
                spawnWeight      = 0.5f,
                costMultiplier   = 15.0f,
                damageBoostCoeff = 2.0f,
                healthBoostCoeff = 2.0f,
                eliteOnlyScaling = 0.5f,
                eliteType        = EliteIndex
            };

            EsoLib.Cards.Add(card);
            EliteCard = card;

            LanguageAPI.Add(eliteDef.modifierToken, ElitePrefixName + " {0}");

            EliteMaterial = Resources.Load <Material>("@Aetherium:Assets/Textures/Materials/HisVengeanceBody.mat");

            SplinteringProjectile = PrefabAPI.InstantiateClone(Resources.Load <GameObject>("Prefabs/Projectiles/ImpVoidspikeProjectile"), "SplinteringProjectile", true);

            var model = Resources.Load <GameObject>("@Aetherium:Assets/Models/Prefabs/HisVengeanceProjectile.prefab");

            model.AddComponent <NetworkIdentity>();
            var ghost = model.AddComponent <RoR2.Projectile.ProjectileGhostController>();

            var controller = SplinteringProjectile.GetComponent <RoR2.Projectile.ProjectileController>();

            controller.procCoefficient = 0.25f;
            controller.ghostPrefab     = model;

            var damage = SplinteringProjectile.GetComponent <RoR2.Projectile.ProjectileDamage>();

            damage.damageType = DamageType.Generic;

            var impactExplosion = SplinteringProjectile.GetComponent <ProjectileImpactExplosion>();

            impactExplosion.impactEffect = Resources.Load <GameObject>("Prefabs/Effects/ImpactEffects/ImpactCrowbar");

            var stickOnImpact = SplinteringProjectile.GetComponent <RoR2.Projectile.ProjectileStickOnImpact>();

            stickOnImpact.stickSoundString = "Play_bellBody_attackLand";

            if (SplinteringProjectile)
            {
                PrefabAPI.RegisterNetworkPrefab(SplinteringProjectile);
            }

            RoR2.ProjectileCatalog.getAdditionalEntries += list =>
            {
                list.Add(SplinteringProjectile);
            };
        }
        // 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);
        }