private static void Init() { EliteCatalog.eliteDefs = new EliteDef[6]; EliteCatalog.RegisterElite(EliteIndex.Fire, new EliteDef { eliteEquipmentIndex = EquipmentIndex.AffixRed, color = Color.red, modifierToken = "ELITE_MODIFIER_FIRE" }); EliteCatalog.RegisterElite(EliteIndex.Lightning, new EliteDef { eliteEquipmentIndex = EquipmentIndex.AffixBlue, color = Color.blue, modifierToken = "ELITE_MODIFIER_LIGHTNING" }); EliteCatalog.RegisterElite(EliteIndex.Ice, new EliteDef { eliteEquipmentIndex = EquipmentIndex.AffixWhite, color = Color.white, modifierToken = "ELITE_MODIFIER_ICE" }); EliteCatalog.RegisterElite(EliteIndex.Poison, new EliteDef { eliteEquipmentIndex = EquipmentIndex.AffixPoison, color = Color.black, modifierToken = "ELITE_MODIFIER_POISON" }); EliteCatalog.RegisterElite(EliteIndex.Haunted, new EliteDef { eliteEquipmentIndex = EquipmentIndex.AffixHaunted, color = Color.white, modifierToken = "ELITE_MODIFIER_HAUNTED" }); EliteCatalog.RegisterElite(EliteIndex.Gold, new EliteDef { eliteEquipmentIndex = EquipmentIndex.AffixGold, color = Color.yellow, modifierToken = "ELITE_MODIFIER_GOLD" }); EliteCatalog.modHelper.CollectAndRegisterAdditionalEntries(ref EliteCatalog.eliteDefs); }
// Token: 0x06000ADC RID: 2780 RVA: 0x0003599C File Offset: 0x00033B9C static EliteCatalog() { EliteCatalog.RegisterElite(EliteIndex.Fire, new EliteDef { eliteEquipmentIndex = EquipmentIndex.AffixRed, color = Color.red, prefix = "Blazing " }); EliteCatalog.RegisterElite(EliteIndex.Lightning, new EliteDef { eliteEquipmentIndex = EquipmentIndex.AffixBlue, color = Color.blue, prefix = "Overloading " }); EliteCatalog.RegisterElite(EliteIndex.Ice, new EliteDef { eliteEquipmentIndex = EquipmentIndex.AffixWhite, color = Color.white, prefix = "Glacial " }); }
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); }
// 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: 0x06000D25 RID: 3365 RVA: 0x000412A8 File Offset: 0x0003F4A8 private void UpdateOverlays() { for (int i = 0; i < this.overlaysCount; i++) { this.currentOverlays[i] = null; } this.overlaysCount = 0; if (this.visibility == VisibilityLevel.Invisible) { return; } EliteIndex eliteIndex = EliteCatalog.IsEquipmentElite(this.inventoryEquipmentIndex); this.myEliteIndex = (int)eliteIndex; if (this.myEliteIndex >= 0) { if (this.body) { AkSoundEngine.SetRTPCValue("eliteEnemy", 1f, this.body.gameObject); } } else if (this.body) { AkSoundEngine.SetRTPCValue("eliteEnemy", 0f, this.body.gameObject); } if (this.body) { bool flag = this.body.HasBuff(BuffIndex.ClayGoo); Inventory inventory = this.body.inventory; this.isGhost = (inventory != null && inventory.GetItemCount(ItemIndex.Ghost) > 0); if (this.body.HasBuff(BuffIndex.RepairMode)) { Material[] array = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array[j] = CharacterModel.repairModeMaterial; } if (this.body.HasBuff(BuffIndex.AttackSpeedOnCrit)) { Material[] array2 = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array2[j] = CharacterModel.wolfhatMaterial; } if (this.body.healthComponent && this.body.healthComponent.shield > 0f) { Material[] array3 = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array3[j] = CharacterModel.energyShieldMaterial; } if (this.body.HasBuff(BuffIndex.FullCrit)) { Material[] array4 = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array4[j] = CharacterModel.fullCritMaterial; } if (this.body.HasBuff(BuffIndex.BeetleJuice)) { Material[] array5 = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array5[j] = CharacterModel.beetleJuiceMaterial; } if (this.body.HasBuff(BuffIndex.Immune)) { Material[] array6 = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array6[j] = CharacterModel.immuneMaterial; } if (this.body.HasBuff(BuffIndex.Slow80)) { Material[] array7 = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array7[j] = CharacterModel.slow80Material; } if (this.body.HasBuff(BuffIndex.Invincibility)) { Material[] array8 = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array8[j] = CharacterModel.bellBuffMaterial; } if (flag) { Material[] array9 = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array9[j] = CharacterModel.clayGooMaterial; } if (this.body.inventory && this.body.inventory.GetItemCount(ItemIndex.LunarDagger) > 0) { Material[] array10 = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array10[j] = CharacterModel.brittleMaterial; } if (this.isGhost) { Material[] array11 = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array11[j] = CharacterModel.ghostMaterial; } if (this.body.equipmentSlot) { if (this.body.equipmentSlot.equipmentIndex == EquipmentIndex.AffixGold) { if (!this.goldAffixEffect) { this.goldAffixEffect = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/GoldAffixEffect"), base.transform); ParticleSystem component = this.goldAffixEffect.GetComponent <ParticleSystem>(); SkinnedMeshRenderer skinnedMeshRenderer = null; foreach (CharacterModel.RendererInfo rendererInfo in this.rendererInfos) { if (rendererInfo.renderer is SkinnedMeshRenderer) { skinnedMeshRenderer = (SkinnedMeshRenderer)rendererInfo.renderer; break; } } ParticleSystem.ShapeModule shape = component.shape; if (skinnedMeshRenderer) { shape.shapeType = ParticleSystemShapeType.SkinnedMeshRenderer; shape.skinnedMeshRenderer = skinnedMeshRenderer; } } } else if (this.goldAffixEffect) { UnityEngine.Object.Destroy(this.goldAffixEffect); } } if (this.wasPreviouslyClayGooed && !flag) { TemporaryOverlay temporaryOverlay = base.gameObject.AddComponent <TemporaryOverlay>(); temporaryOverlay.duration = 0.6f; temporaryOverlay.animateShaderAlpha = true; temporaryOverlay.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f); temporaryOverlay.destroyComponentOnEnd = true; temporaryOverlay.originalMaterial = CharacterModel.clayGooMaterial; temporaryOverlay.AddToCharacerModel(this); } this.wasPreviouslyClayGooed = this.body.HasBuff(BuffIndex.ClayGoo); } for (int k = 0; k < this.temporaryOverlays.Count; k++) { Material[] array13 = this.currentOverlays; int j = this.overlaysCount; this.overlaysCount = j + 1; array13[j] = this.temporaryOverlays[k].materialInstance; } this.materialsDirty = true; }
// 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); }