public static CustomElite TestElite() { LoadAssets(); var eliteDef = new EliteDef { modifierToken = "Cloaky", color = new Color32(255, 105, 180, 255) }; var equipDef = new EquipmentDef { cooldown = 10f, pickupModelPath = "", pickupIconPath = "", nameToken = "Cloaky", pickupToken = "Cloaky", descriptionToken = "Cloaky", canDrop = false, enigmaCompatible = false }; var buffDef = new BuffDef { buffColor = eliteDef.color, canStack = false }; var equip = new CustomEquipment(equipDef, _prefab, _icon, _itemDisplayRules); var buff = new CustomBuff("Affix_Cloaky", buffDef, null); var elite = new CustomElite("Cloaky", eliteDef, equip, buff, 1); return(elite); }
private static void CopyBasicAttributes(EliteDef target, EliteDef copyFrom) { target.modifierToken = copyFrom.modifierToken; target.eliteEquipmentDef = copyFrom.eliteEquipmentDef; target.color = copyFrom.color; target.shaderEliteRampIndex = copyFrom.shaderEliteRampIndex; }
public CustomElite(string name, EliteDef eliteDef, CustomEquipment equipment, CustomBuff buff, int tier = 1) { Name = name; EliteDef = eliteDef; Equipment = equipment; Buff = buff; Tier = tier; }
public StormElitesManager() { var eliteDef = new EliteDef { modifierToken = EliteName, color = new Color32(162, 179, 241, 255) }; var equipDef = new EquipmentDef { cooldown = 10f, pickupModelPath = "", pickupIconPath = HailstormAssets.IconStormElite, nameToken = EquipName, pickupToken = "Storm Bringer", descriptionToken = "Storm Bringer", canDrop = false, enigmaCompatible = false }; var buffDef = new BuffDef { buffColor = eliteDef.color, iconPath = HailstormAssets.IconStormElite, canStack = false }; var equip = new CustomEquipment(equipDef, new ItemDisplayRule[0]); var buff = new CustomBuff(BuffName, buffDef); var elite = new CustomElite(EliteName, eliteDef, equip, buff, 1); EliteIndex = (EliteIndex)ItemAPI.AddCustomElite(elite); BuffIndex = (BuffIndex)ItemAPI.AddCustomBuff(buff); EquipIndex = (EquipmentIndex)ItemAPI.AddCustomEquipment(equip); eliteDef.eliteEquipmentIndex = EquipIndex; equipDef.passiveBuff = BuffIndex; buffDef.eliteIndex = EliteIndex; //Storm elites are immune to twisters TwisterProjectileController.ImmunityBuff = BuffIndex; TornadoLauncher.StormBuff = BuffIndex; //Storm elites are tier 2 elites, on the same order as malachites //They're a bit less tanky than malachites, but even more dangerous in terms of damage var card = new EliteAffixCard { spawnWeight = 1.0f, costMultiplier = 30.0f, damageBoostCoeff = 6.0f, healthBoostCoeff = 20.0f, eliteType = EliteIndex, isAvailable = () => Run.instance.loopClearCount > 0, onSpawned = OnSpawned }; //Register the card for spawning if ESO is enabled EsoLib.Cards.Add(card); Card = card; }
/// <summary> /// Registers an EliteDef to the EliteCatalog /// </summary> /// <param name="eliteDef">The EliteDef to register.</param> public static void RegisterElite(EliteDef eliteDef) { //Check if the SurvivorDef has already been registered. if (EliteDefDefinitions.Contains(eliteDef)) { LogCore.LogE(eliteDef + " has already been registered, please do not register the same EliteDef twice."); return; } //If not, add it to our SurvivorDefinitions EliteDefDefinitions.Add(eliteDef); }
/// <summary> /// You can omit the index references for the EliteDef, as those will be filled in automatically by the API. /// If you are doing an equipment for a custom elite, don't forget to register your CustomEquipment before too to fill the equipmentIndex field ! /// Also, don't forget to give it a valid eliteTier so that your custom elite correctly get spawned. /// You can also make a totally new tier, by using OverrideCombatDirectorEliteTiers for example. /// </summary> public CustomElite(string name, EquipmentIndex equipmentIndex, Color32 color, string modifierToken, int eliteTier) { EliteDef = new EliteDef { name = name, eliteEquipmentIndex = equipmentIndex, color = color, modifierToken = modifierToken }; EliteTier = eliteTier; }
public BarrierElitesManager() { var eliteDef = new EliteDef { modifierToken = BarrierElitesManager.EliteName, color = new Color32(162, 179, 241, 255) }; var equipDef = new EquipmentDef { cooldown = 10f, pickupModelPath = "", pickupIconPath = HailstormAssets.IconBarrierElite, nameToken = EquipName, pickupToken = "Shield-Bearer", descriptionToken = "Shield-Bearer", canDrop = false, enigmaCompatible = false }; var buffDef = new BuffDef { buffColor = eliteDef.color, iconPath = HailstormAssets.IconBarrierElite, canStack = false }; var equip = new CustomEquipment(equipDef, new ItemDisplayRule[0]); var buff = new CustomBuff(BuffName, buffDef); var elite = new CustomElite(EliteName, eliteDef, equip, buff, 1); _eliteIndex = (EliteIndex)ItemAPI.AddCustomElite(elite); _buffIndex = (BuffIndex)ItemAPI.AddCustomBuff(buff); _equipIndex = (EquipmentIndex)ItemAPI.AddCustomEquipment(equip); eliteDef.eliteEquipmentIndex = _equipIndex; equipDef.passiveBuff = _buffIndex; buffDef.eliteIndex = _eliteIndex; //Barrier elites are a bit more uncommon than regular tier 1 elites //They're also a bit tankier than usual, but not more damaging var card = new EliteAffixCard { spawnWeight = 0.5f, costMultiplier = 10.0f, damageBoostCoeff = 1.0f, healthBoostCoeff = 10.0f, eliteType = _eliteIndex }; //Register the card for spawning if ESO is enabled EsoLib.Cards.Add(card); Card = card; }
public override void SetupAttributes() { base.SetupAttributes(); equipmentDef.canDrop = false; equipmentDef.enigmaCompatible = false; equipmentDef.cooldown = 40; var buffDef = new 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 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 our own, uncomment the one below. EliteMaterial = Resources.Load <Material>("@Aetherium:Assets/Textures/Materials/ApollosBrillianceMain.mat"); }
//EliteDefs should be added by EliteAPI, but this method is here purely for completion sake. /// <summary> /// Adds an EliteDef to your Mod's ContentPack /// <para>EliteDef should be added by EliteAPI's Add methods.</para> /// </summary> /// <param name="eliteDef">The EliteDef to Add</param> /// <returns>true if valid and added, false if one of the requirements is not met</returns> public static bool AddEliteDef(EliteDef eliteDef) { var asm = Assembly.GetCallingAssembly(); if (CatalogBlockers.GetAvailability <EliteDef>()) { R2API.Logger.LogInfo($"Assembly {asm.GetName().Name} is adding an {eliteDef} via {nameof(ContentAddition)}.{nameof(AddEliteDef)}()" + $"The assembly should ideally add them via {nameof(EliteAPI)} so that they can use EliteAPI's elite tier systems, adding the elite anyways as Tier1 elite."); EliteAPI.AddInternal(new CustomElite(eliteDef, new List <CombatDirector.EliteTierDef> { EliteAPI.VanillaEliteTiers[1], EliteAPI.VanillaEliteTiers[2] }), asm); return(true); } RejectContent(eliteDef, asm, "EliteDef", "but the EliteCatalog has already initialized!"); return(false); }
public static void Create() { if (ZetArtifactsPlugin.LoopifactEnable.Value != 0) { PoisonEarly = ScriptableObject.CreateInstance <EliteDef>(); eliteDefs.Add(PoisonEarly); HauntedEarly = ScriptableObject.CreateInstance <EliteDef>(); eliteDefs.Add(HauntedEarly); if (ZetArtifactsPlugin.PluginLoaded("com.arimah.PerfectedLoop")) { LunarEarly = ScriptableObject.CreateInstance <EliteDef>(); eliteDefs.Add(LunarEarly); } } }
protected override void OnEnable() { base.OnEnable(); eliteDef = TargetType.eliteDef; networkSoundEventDef = TargetType.startSfx; prefix = Settings.GetPrefix1stUpperRestLower(); prefixUsesTokenPrefix = true; OnVisualTreeCopy += () => { header = Find <VisualElement>("Header"); inspectorData = Find <VisualElement>("InspectorData"); messages = Find <VisualElement>("Messages"); buffColor = Find <ColorField>(inspectorData, "buffColor"); Find <Button>(buffColor, "colorSetter").clicked += () => TargetType.buffColor = eliteDef.color; }; }
/* * public static EliteDef GetEquipmentEliteDef(EquipmentDef equipDef) * { * if (equipDef == null) return null; * if (equipDef.passiveBuffDef == null) return null; * return equipDef.passiveBuffDef.eliteDef; * } */ internal static void ApplyEarlyEliteProperties() { EliteDef t2Elite = RoR2Content.Elites.Poison; CopyBasicAttributes(ZetArtifactsContent.Elites.PoisonEarly, RoR2Content.Elites.Poison); ApplyStatBoosts(ZetArtifactsContent.Elites.PoisonEarly, t2Elite); CopyBasicAttributes(ZetArtifactsContent.Elites.HauntedEarly, RoR2Content.Elites.Haunted); ApplyStatBoosts(ZetArtifactsContent.Elites.HauntedEarly, t2Elite); if (ZetArtifactsPlugin.PluginLoaded("com.arimah.PerfectedLoop")) { CopyBasicAttributes(ZetArtifactsContent.Elites.LunarEarly, RoR2Content.Elites.Lunar); ApplyStatBoosts(ZetArtifactsContent.Elites.LunarEarly, t2Elite); } Debug.LogWarning("ZetArtifact [ZetLoopifact] - ApplyEarlyEliteProperties"); }
private static void doMultiElite(GameObject gameObject, CombatDirector self) { DirectorCard card = self.lastAttemptedMonsterCard; float credit = self.monsterCredit; CharacterBody body = gameObject.GetComponentInChildren <CharacterMaster>().GetBody(); CombatDirector.EliteTierDef[] eliteDefs = typeof(CombatDirector).GetFieldValue <CombatDirector.EliteTierDef[]>("eliteTiers"); int currentEliteTypes = 1; foreach (BuffIndex buff in BuffCatalog.eliteBuffIndices) { BuffDef buffDef = BuffCatalog.GetBuffDef(buff); if (body.HasBuff(buff)) { currentEliteTypes += 1; } } if (currentEliteTypes > 1) { foreach (CombatDirector.EliteTierDef tierDef in eliteDefs) { foreach (EliteIndex eliteIndex in tierDef.eliteTypes) { if (credit > card.cost * tierDef.costMultiplier * currentEliteTypes) { BuffDef buffDef = BuffCatalog.GetBuffDef(BuffIndex.None); foreach (BuffIndex buff in BuffCatalog.eliteBuffIndices) { BuffDef tempDef = BuffCatalog.GetBuffDef(buff); if (tempDef.eliteIndex == eliteIndex) { buffDef = tempDef; } } if (buffDef != null) { if (!(body.HasBuff(buffDef.buffIndex))) { body.AddBuff(buffDef.buffIndex); self.monsterCredit -= card.cost * tierDef.costMultiplier * currentEliteTypes; credit -= card.cost * tierDef.costMultiplier * currentEliteTypes; currentEliteTypes++; float num3 = tierDef.healthBoostCoefficient; float damageBoostCoefficient = tierDef.damageBoostCoefficient; if (self.combatSquad) { int livingPlayerCount = Run.instance.livingPlayerCount; num3 *= Mathf.Pow((float)livingPlayerCount, 1f); } body.inventory.GiveItem(ItemIndex.BoostHp, Mathf.RoundToInt((num3 - 1f) * 10f)); body.inventory.GiveItem(ItemIndex.BoostDamage, Mathf.RoundToInt((damageBoostCoefficient - 1f) * 10f)); EliteDef eliteDef = EliteCatalog.GetEliteDef(eliteIndex); EquipmentIndex equipmentIndex = (eliteDef != null) ? eliteDef.eliteEquipmentIndex : EquipmentIndex.None; if (equipmentIndex != EquipmentIndex.None) { if (body.inventory.GetEquipmentIndex() == EquipmentIndex.None) { body.inventory.SetEquipmentIndex(equipmentIndex); } } } } } } } } }
public static bool Init() { On.RoR2.GlobalEventManager.ServerDamageDealt += GlobalEventManager_ServerDamageDealt; var equipDef = new EquipmentDef { name = EquipName, cooldown = 10f, pickupModelPath = "", pickupIconPath = "", nameToken = EquipName, pickupToken = "Pickup_Blightborne", descriptionToken = "Description_Blightborne", canDrop = false, enigmaCompatible = false }; var equip = new CustomEquipment(equipDef, new ItemDisplayRule[0]); var buffDef = new BuffDef { name = BuffName, buffColor = new Color32(141, 51, 19, 255), iconPath = "", canStack = false }; var buff = new CustomBuff(buffDef); var eliteDef = new EliteDef { name = EliteName, modifierToken = "ELITE_MODIFIER_BLIGHTBORNE", color = buffDef.buffColor, eliteEquipmentIndex = _equipIndex }; var elite = new CustomElite(eliteDef, 1); _eliteIndex = EliteAPI.Add(elite); _buffIndex = BuffAPI.Add(buff); _equipIndex = ItemAPI.Add(equip); eliteDef.eliteEquipmentIndex = _equipIndex; equipDef.passiveBuff = _buffIndex; buffDef.eliteIndex = _eliteIndex; On.RoR2.CharacterBody.OnEquipmentLost += CharacterBody_OnEquipmentLost; On.RoR2.CharacterBody.OnEquipmentGained += CharacterBody_OnEquipmentGained; var card = new EliteAffixCard { spawnWeight = 0.5f, costMultiplier = 16f, damageBoostCoeff = 2.0f, healthBoostCoeff = 8.0f, eliteOnlyScaling = 1f, eliteType = _eliteIndex, onSpawned = OnSpawned, isAvailable = new Func <bool>(() => Run.instance.stageClearCount > 3 && Run.instance.selectedDifficulty != DifficultyIndex.Easy) }; //Register the card for spawning if ESO is enabled EsoLib.Cards.Add(card); Card = card; //Description of elite in UI when boss LanguageAPI.Add(eliteDef.modifierToken, "Blightborne {0}"); LanguageAPI.Add(equipDef.pickupToken, "Blight's Embrace"); LanguageAPI.Add(equipDef.descriptionToken, "Become an aspect of Blight"); return(true); }
public static bool Init() { On.RoR2.GlobalEventManager.OnCharacterDeath += GlobalEventManager_OnCharacterDeath; var equipDef = new EquipmentDef { name = EquipName, cooldown = 10f, pickupModelPath = "", pickupIconPath = "", nameToken = EquipName, pickupToken = "Pickup_Tarborne", descriptionToken = "Description_Tarborne", canDrop = false, enigmaCompatible = false }; On.RoR2.CharacterBody.OnEquipmentLost += CharacterBody_OnEquipmentLost; On.RoR2.CharacterBody.OnEquipmentGained += CharacterBody_OnEquipmentGained; var equip = new CustomEquipment(equipDef, new ItemDisplayRule[0]); var buffDef = new BuffDef { name = BuffName, buffColor = new Color32(41, 41, 41, 255), iconPath = "", canStack = false }; var buff = new CustomBuff(buffDef); var eliteDef = new EliteDef { name = EliteName, modifierToken = "ELITE_MODIFIER_TARBORNE", color = buffDef.buffColor, eliteEquipmentIndex = _equipIndex }; var elite = new CustomElite(eliteDef, 1); _eliteIndex = EliteAPI.Add(elite); _buffIndex = BuffAPI.Add(buff); _equipIndex = ItemAPI.Add(equip); eliteDef.eliteEquipmentIndex = _equipIndex; equipDef.passiveBuff = _buffIndex; buffDef.eliteIndex = _eliteIndex; var card = new EliteAffixCard { spawnWeight = 1f, costMultiplier = 6f, damageBoostCoeff = 2.0f, healthBoostCoeff = 4.0f, eliteOnlyScaling = 1f, eliteType = _eliteIndex, onSpawned = OnSpawned, isAvailable = new Func <bool>(() => true) }; //Register the card for spawning if ESO is enabled EsoLib.Cards.Add(card); Card = card; //Description of elite in UI when boss LanguageAPI.Add(eliteDef.modifierToken, "Tarborne {0}"); LanguageAPI.Add(equipDef.pickupToken, "Dunestrider's Dominion"); LanguageAPI.Add(equipDef.descriptionToken, "Become an aspect of Tar"); return(true); }
public DarkElitesManager() { _rng = new Xoroshiro128Plus((ulong)DateTime.Now.Ticks); var eliteDef = new EliteDef { modifierToken = EliteName, color = new Color32(0, 0, 0, 255), }; var equipDef = new EquipmentDef { cooldown = 10f, pickupModelPath = "", pickupIconPath = HailstormAssets.IconDarkElite, nameToken = EquipName, pickupToken = "Darkness", descriptionToken = "Night-bringer", canDrop = false, enigmaCompatible = false }; var buffDef = new BuffDef { buffColor = new Color32(255, 255, 255, 255), iconPath = HailstormAssets.IconDarkElite, canStack = false }; var equip = new CustomEquipment(equipDef, new ItemDisplayRule[0]); var buff = new CustomBuff(BuffName, buffDef); var elite = new CustomElite(EliteName, eliteDef, equip, buff, 1); _eliteIndex = (EliteIndex)ItemAPI.AddCustomElite(elite); _buffIndex = (BuffIndex)ItemAPI.AddCustomBuff(buff); _equipIndex = (EquipmentIndex)ItemAPI.AddCustomEquipment(equip); eliteDef.eliteEquipmentIndex = _equipIndex; equipDef.passiveBuff = _buffIndex; buffDef.eliteIndex = _eliteIndex; //When the camera starts up, hook in our darkness effect On.RoR2.CameraRigController.Start += CameraRigControllerOnStart; //Update elite materials On.RoR2.CharacterModel.InstanceUpdate += CharacterModelOnInstanceUpdate; //Dark elites spawn much less frequently, but are only slightly stronger/costlier than tier 1s var card = new EliteAffixCard { spawnWeight = 0.3f, costMultiplier = 10.0f, damageBoostCoeff = 2.0f, healthBoostCoeff = 6.0f, eliteType = _eliteIndex }; //Register the card for spawning if ESO is enabled EsoLib.Cards.Add(card); Card = card; //Create random walk trackers for dark elite material texture animation _walkerU = new AnimatedFloat { Accel = 0.3f, MaxSpeed = 0.6f }; _walkerV = new AnimatedFloat { Accel = 0.3f, MaxSpeed = 0.6f }; //Whenever scene changes, stop the breathing sound SceneManager.sceneUnloaded += s => AkSoundEngine.PostEvent(SoundEvents.StopLargeBreathing, null); }
public CustomElite(string nameUnusedObsolete, EliteDef eliteDef, CustomEquipment equipmentUnusedObsolete, CustomBuff buffUnusedObsolete, int tierUnusedObsolete = 1) { EliteDef = eliteDef; }
/// <summary> /// You can omit the index references for the EliteDef, as those will be filled in automatically by the API. /// But don't forget to give it a valid eliteTier so that your custom elite correctly get spawned. /// You can also make a totally new tier, by using OverrideCombatDirectorEliteTiers for example. /// </summary> public CustomElite(EliteDef eliteDef, int eliteTier) { EliteDef = eliteDef; EliteTier = eliteTier; }
private static void ApplyStatBoosts(EliteDef target, EliteDef copyFrom) { target.damageBoostCoefficient = Mathf.LerpUnclamped(1f, copyFrom.damageBoostCoefficient, 0.35f); target.healthBoostCoefficient = Mathf.LerpUnclamped(1f, copyFrom.healthBoostCoefficient, 0.35f); }