public void FixedUpdate(RoR2.CharacterBody characterBody) { TimeLeft -= Time.fixedDeltaTime; if (TimeLeft <= 0) { TimeLeft += StashedTimeLeft; TicksLeft -= 1; DamageDealt += DamagePerTick; if (DamageDealt >= 1) { DamageInfo damageInfo = new DamageInfo(); damageInfo.attacker = Attacker; damageInfo.crit = false; damageInfo.damage = DamageDealt; damageInfo.force = Vector3.zero; damageInfo.inflictor = SharkTeeth.instance.BleedInflictor; damageInfo.position = characterBody.corePosition; damageInfo.procCoefficient = 0f; damageInfo.damageColorIndex = DamageColorIndex.Bleed; damageInfo.damageType = DamageType; //var healthBefore = characterBody.healthComponent.health; //debug characterBody.healthComponent.TakeDamage(damageInfo); DamageDealt = 0; //Chat.AddMessage($"Actual Tick Damage: {healthBefore - characterBody.healthComponent.health}"); //debug } } }
public static void ImmediateWarWardUpdate(RoR2.CharacterBody self) { if (self.inventory.GetItemCount(Assets.AffixOrangeItemIndex) > 0) { self.AddItemBehavior <AffixWarBehavior>(self.inventory.GetItemCount(Assets.AffixOrangeItemIndex)); } }
private void LightningEliteChanges(ILContext il) { ILCursor c = new ILCursor(il); c.GotoNext( x => x.MatchLdcR4(0.5f), x => x.MatchStloc(7) ); c.Index += 1; c.Emit(OpCodes.Pop); c.Emit(OpCodes.Ldarg_1); c.Emit(OpCodes.Ldarg_2); c.EmitDelegate <Func <RoR2.DamageInfo, GameObject, float> >((damageInfo, hitObject) => { if (damageInfo != null && hitObject != null) { RoR2.CharacterBody component = damageInfo.attacker.GetComponent <RoR2.CharacterBody>(); int itemCount = component.inventory.GetItemCount(AspectsToItems.AspectsToItems.NewDefsList.Find(x => x.name == "AffixBlue").itemIndex); if (component.master.inventory) { if (itemCount > 0) { return(0.25f + 0.25f * itemCount); } } } return(0.5f); }); }
public static void ImmediateVoidWardUpdate(RoR2.CharacterBody self) { if (self.inventory.GetItemCount(Assets.AffixVoidItemIndex) > 0) { self.AddItemBehavior <Starstorm2.Cores.Elites.VoidElite.AffixVoidBehavior>(self.inventory.GetItemCount(Assets.AffixVoidItemIndex)); } }
private void AddEliteMaterials(On.RoR2.CharacterBody.orig_FixedUpdate orig, RoR2.CharacterBody self) { if (self.HasBuff(EliteBuffIndex) && !self.GetComponent <HyperchargedBuffTracker>()) { var modelLocator = self.modelLocator; if (modelLocator) { var modelTransform = self.modelLocator.modelTransform; if (modelTransform) { var model = self.modelLocator.modelTransform.GetComponent <RoR2.CharacterModel>(); if (model) { var hyperchargedBuffTracker = self.gameObject.AddComponent <HyperchargedBuffTracker>(); hyperchargedBuffTracker.Body = self; RoR2.TemporaryOverlay overlay = self.modelLocator.modelTransform.gameObject.AddComponent <RoR2.TemporaryOverlay>(); overlay.duration = float.PositiveInfinity; overlay.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f); overlay.animateShaderAlpha = true; overlay.destroyComponentOnEnd = true; overlay.originalMaterial = EliteMaterial; overlay.AddToCharacerModel(model); hyperchargedBuffTracker.Overlay = overlay; } } } } orig(self); }
private void PoisonEliteChanges(On.RoR2.GlobalEventManager.orig_OnHitEnemy orig, RoR2.GlobalEventManager self, RoR2.DamageInfo damageInfo, GameObject victim) { if (damageInfo.attacker) { RoR2.CharacterBody component = damageInfo.attacker.GetComponent <RoR2.CharacterBody>(); RoR2.CharacterBody characterBody = victim ? victim.GetComponent <RoR2.CharacterBody>() : null; if (component) { RoR2.CharacterMaster master = component.master; if (master) { if ((component.HasBuff(Resources.Load <BuffDef>("buffdefs/AffixPoison")) ? 1 : 0) > 0 && characterBody) { int itemCount = master.inventory.GetItemCount(AspectsToItems.AspectsToItems.NewDefsList.Find(x => x.name == "AffixPoison").itemIndex); float amount = damageInfo.damage * (0.05f + 0.05f * itemCount); if (itemCount == 0) { amount = damageInfo.damage * .1f; } component.healthComponent.Heal(amount, damageInfo.procChainMask, true); } } } } orig(self, damageInfo, victim); }
private void AddWindedDebuff(On.RoR2.CharacterBody.orig_RemoveBuff orig, RoR2.CharacterBody self, BuffIndex buffType) { orig(self, buffType); if (buffType == SecondWindBuff) { self.AddTimedBuffAuthority(WindedDebuff, 10f); } }
private void CharacterBody_onBodyStartGlobal(RoR2.CharacterBody obj) { if (obj && obj.isPlayerControlled && obj.master) { if (!obj.masterObject.GetComponent <Commands.DesCloneCommandComponent>()) { obj.masterObject.AddComponent <Commands.DesCloneCommandComponent>(); } } }
private void CheckFrenzyBuff(On.RoR2.CharacterBody.orig_FixedUpdate orig, RoR2.CharacterBody self) { var frenzyPotionTracker = self.GetComponent <FrenzyPotionTracker>(); if (frenzyPotionTracker) { self.teamComponent.teamIndex = TeamIndex.None; self.master.teamIndex = TeamIndex.None; } }
private void IceEliteChanges(On.RoR2.HealthComponent.orig_TakeDamage orig, RoR2.HealthComponent self, RoR2.DamageInfo damageInfo) { RoR2.CharacterBody characterBody = null; if (damageInfo.attacker) { characterBody = damageInfo.attacker.GetComponent <RoR2.CharacterBody>(); } if (damageInfo.damage > 0) { if (characterBody) { RoR2.CharacterMaster master = characterBody.master; if (master && master.inventory) { if (damageInfo.procCoefficient > 0f) { if (characterBody.GetBuffCount(Resources.Load <BuffDef>("buffdefs/AffixWhite")) > 0) { self.body.AddTimedBuff(FreezingBlood.buffIndex, 2f * damageInfo.procCoefficient); if (self.body.GetBuffCount(FreezingBlood.buffIndex) >= 10) { self.body.ClearTimedBuffs(FreezingBlood.buffIndex); RoR2.CharacterBody component = damageInfo.attacker.GetComponent <RoR2.CharacterBody>(); RoR2.ProcChainMask procChainMask = damageInfo.procChainMask; int AffixWhiteStack = master.inventory.GetItemCount(AspectsToItems.AspectsToItems.NewDefsList.Find(x => x.name == "AffixWhite").itemIndex); Vector3 position = damageInfo.position; float damageCoefficient = 10f + 10f * AffixWhiteStack; if (AffixWhiteStack == 0) { damageCoefficient = 20f; } float damage2 = RoR2.Util.OnHitProcDamage(component.damage, component.damage, damageCoefficient); RoR2.DamageInfo damageInfo2 = new RoR2.DamageInfo { damage = damage2, damageColorIndex = DamageColorIndex.Item, damageType = DamageType.Generic, attacker = damageInfo.attacker, crit = damageInfo.crit, force = Vector3.zero, inflictor = null, position = position, procChainMask = procChainMask, procCoefficient = 1f }; RoR2.EffectManager.SimpleImpactEffect(Resources.Load <GameObject>("Prefabs/Effects/ImpactEffects/IceCullExplosion"), position, Vector3.up, true); self.TakeDamage(damageInfo2); } } } } } } orig(self, damageInfo); }
private void Annex(On.RoR2.CharacterBody.orig_RecalculateStats orig, RoR2.CharacterBody self) { //Yeet orig(self); float oldHealth = self.maxHealth; float oldShield = self.maxShield; self.isElite = self.eliteBuffCount > 1; bool glasArtifact = RunArtifactManager.instance.IsArtifactEnabled(RoR2Content.Artifacts.glassArtifactDef); self.hasOneShotProtection = self.isPlayerControlled && !glasArtifact; self.isGlass = ItemIndex.LunarDagger.GetCount(self) > 0; }
private void OnDamaged(RoR2.CharacterBody self) { var InventoryCount = GetCount(self); if (InventoryCount > 0 && self.GetBuffCount(meleeArmorBuff) < InventoryCount * timesPerStack) { for (int i = 0; i < buffPerStack; i++) { self.AddTimedBuff(meleeArmorBuff, buffDuration); } } return; }
// Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250 public void Awake() { SurvivorAPI.SurvivorCatalogReady += delegate(object s, EventArgs e) { var display = Resources.Load <GameObject>("prefabs/characterbodies/HANDBody").GetComponent <ModelLocator>().modelTransform.gameObject; display.AddComponent <animation>(); RoR2.SurvivorDef survivorDef = new RoR2.SurvivorDef { bodyPrefab = RoR2.BodyCatalog.FindBodyPrefab("HANDBody"), descriptionToken = "HAND_DESCRIPTION", displayPrefab = display, primaryColor = new Color(0.8039216f, 0.482352942f, 0.843137264f), unlockableName = "", survivorIndex = SurvivorIndex.Count }; survivorDef.bodyPrefab.GetComponent <RoR2.SkillLocator>().primary.noSprint = false; survivorDef.bodyPrefab.GetComponent <RoR2.SkillLocator>().secondary.noSprint = false; survivorDef.bodyPrefab.GetComponent <RoR2.SkillLocator>().utility.noSprint = false; survivorDef.bodyPrefab.GetComponent <RoR2.SkillLocator>().special.noSprint = false; survivorDef.bodyPrefab.GetComponent <RoR2.CharacterBody>().crosshairPrefab = RoR2.BodyCatalog.FindBodyPrefab("HuntressBody").GetComponent <RoR2.CharacterBody>().crosshairPrefab; SurvivorAPI.SurvivorDefinitions.Insert(6, survivorDef); }; On.EntityStates.HAND.Overclock.FixedUpdate += delegate(On.EntityStates.HAND.Overclock.orig_FixedUpdate orig, EntityStates.HAND.Overclock self) { self.outer.commonComponents.characterBody.AddTimedBuff(BuffIndex.EnrageAncientWisp, 2f); orig(self); }; On.RoR2.GlobalEventManager.OnHitEnemy += delegate(On.RoR2.GlobalEventManager.orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { orig(self, damageInfo, victim); bool flag = damageInfo.attacker && damageInfo.procCoefficient > 0f; if (flag) { RoR2.CharacterBody component = damageInfo.attacker.GetComponent <RoR2.CharacterBody>(); bool flag2 = component.HasBuff(BuffIndex.EnrageAncientWisp) && component.baseNameToken == "HAND_BODY_NAME"; if (flag2) { component.AddTimedBuff(BuffIndex.EnrageAncientWisp, 2f); component.healthComponent.Heal(EntityStates.HAND.Overclock.healPercentage * damageInfo.damage, default(RoR2.ProcChainMask), true); } } }; On.RoR2.CharacterModel.UpdateMaterials += delegate(On.RoR2.CharacterModel.orig_UpdateMaterials orig, RoR2.CharacterModel self) { bool flag = self.body.baseNameToken != "HAND_BODY_NAME"; if (flag) { orig(self); } }; }
public void AddBuffAndDot(BuffIndex buff, float duration, int stackCount, RoR2.CharacterBody body) { DotController.DotIndex index = (DotController.DotIndex)Array.FindIndex(DotController.dotDefs, (dotDef) => dotDef.associatedBuff == buff); for (int y = 0; y < stackCount; y++) { if (index != DotController.DotIndex.None) { DotController.InflictDot(body.gameObject, body.gameObject, index, duration, 0.25f); } else { body.AddTimedBuffAuthority(buff, duration); } } }
// Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250 public void Awake() { On.RoR2.PickupPickerController.CreatePickup_PickupIndex += delegate(On.RoR2.PickupPickerController.orig_CreatePickup_PickupIndex orig, RoR2.PickupPickerController self, RoR2.PickupIndex PickupIndex) { orig.Invoke(self, PickupIndex); Time.timeScale = 1f; }; On.RoR2.UI.PickupPickerPanel.Awake += delegate(On.RoR2.UI.PickupPickerPanel.orig_Awake orig, RoR2.UI.PickupPickerPanel self) { MethodInfo methodCached = Reflection.GetMethodCached(typeof(RoR2.CharacterMaster), "ToggleGod"); bool flag = true; foreach (RoR2.PlayerCharacterMasterController playerCharacterMasterController in RoR2.PlayerCharacterMasterController.instances) { methodCached.Invoke(playerCharacterMasterController.master, null); bool flag2 = flag; if (flag2) { flag = false; } } //RoR2.CharacterBody.AddBuff(RoR2.LocalUserManager.GetFirstLocalUser ,RoR2.RoR2Content.Buffs.Cloak); RoR2.LocalUser user = RoR2.LocalUserManager.GetFirstLocalUser(); RoR2.CharacterBody body = user.cachedBody; body.AddBuff(RoR2.RoR2Content.Buffs.Cloak); orig.Invoke(self); }; On.RoR2.PickupPickerController.OnDisplayEnd += delegate(On.RoR2.PickupPickerController.orig_OnDisplayEnd orig, RoR2.PickupPickerController self, RoR2.NetworkUIPromptController NetworkUIPromptController, RoR2.LocalUser LocalUser, RoR2.CameraRigController CameraRigController) { orig.Invoke(self, NetworkUIPromptController, LocalUser, CameraRigController); new WaitForSeconds(5); MethodInfo methodCached = Reflection.GetMethodCached(typeof(RoR2.CharacterMaster), "ToggleGod"); bool flag = false; foreach (RoR2.PlayerCharacterMasterController playerCharacterMasterController in RoR2.PlayerCharacterMasterController.instances) { methodCached.Invoke(playerCharacterMasterController.master, null); bool flag2 = flag; if (flag2) { flag = false; } } //base.characterBody.RemoveBuff(RoR2.RoR2Content.Buffs.CloakSpeed); RoR2.LocalUser user = RoR2.LocalUserManager.GetFirstLocalUser(); RoR2.CharacterBody body = user.cachedBody; body.RemoveBuff(RoR2.RoR2Content.Buffs.Cloak); }; }
private System.Collections.IEnumerator GlobalEventManager_CreateLevelUpEffect(On.RoR2.GlobalEventManager.orig_CreateLevelUpEffect orig, RoR2.GlobalEventManager self, float delay, GameObject levelUpEffect, RoR2.EffectData effectData) { yield return(new WaitForSeconds(delay)); orig.Invoke(self, delay, levelUpEffect, effectData); foreach (RoR2.PlayerCharacterMasterController playerCharacterMasterController in RoR2.PlayerCharacterMasterController.instances) { bool isClient = playerCharacterMasterController.master.isClient; if (isClient) { string displayName = playerCharacterMasterController.GetDisplayName(); System.Random rnd = new System.Random(); RoR2.CharacterMaster localUser = playerCharacterMasterController.master; RoR2.CharacterBody playerBody = localUser.GetBody(); int playerLevel = (int)playerBody.level; if (currentLevel < playerLevel) { ItemTier itemTier1 = ItemTier.Tier1; int amountOfItemsInTier = this.getAmountOfItemsInTier(itemTier1, playerCharacterMasterController.master); this.removeAllItemsInTier(itemTier1, playerCharacterMasterController.master); this.addItems(itemTier1, amountOfItemsInTier, playerCharacterMasterController.master, rnd, tier1Min.Value, tier1Max.Value); ItemTier itemTier2 = ItemTier.Tier2; amountOfItemsInTier = this.getAmountOfItemsInTier(itemTier2, playerCharacterMasterController.master); this.removeAllItemsInTier(itemTier2, playerCharacterMasterController.master); this.addItems(itemTier2, amountOfItemsInTier, playerCharacterMasterController.master, rnd, tier2Min.Value, tier2Max.Value); ItemTier itemTier3 = ItemTier.Tier3; amountOfItemsInTier = this.getAmountOfItemsInTier(itemTier3, playerCharacterMasterController.master); this.removeAllItemsInTier(itemTier3, playerCharacterMasterController.master); this.addItems(itemTier3, amountOfItemsInTier, playerCharacterMasterController.master, rnd, tier3Min.Value, tier3Max.Value); ItemTier itemTierLunar = ItemTier.Lunar; amountOfItemsInTier = this.getAmountOfItemsInTier(itemTierLunar, playerCharacterMasterController.master); this.removeAllItemsInTier(itemTierLunar, playerCharacterMasterController.master); this.addItems(itemTierLunar, amountOfItemsInTier, playerCharacterMasterController.master, rnd, tierLunarMin.Value, tierLunarMax.Value); currentLevel = playerLevel; } } } yield break; }
private void TickDamage(On.RoR2.CharacterBody.orig_FixedUpdate orig, RoR2.CharacterBody self) { orig(self); var bleedComponent = self.GetComponent <BleedTrackerComponent>(); if (!bleedComponent) { bleedComponent = self.gameObject.AddComponent <BleedTrackerComponent>(); } foreach (BleedStack stack in bleedComponent.BleedStacks) { stack.FixedUpdate(self); } bleedComponent.BleedStacks.RemoveAll(x => x.TicksLeft <= 0); }
private void AddTrackerToBodies(On.RoR2.CharacterBody.orig_FixedUpdate orig, RoR2.CharacterBody self) { var slot = self.equipmentSlot; if (slot) { if (slot.equipmentIndex == equipmentDef.equipmentIndex) { var bulletTracker = self.GetComponent <JarBulletTracker>(); if (!bulletTracker) { bulletTracker = self.gameObject.AddComponent <JarBulletTracker>(); bulletTracker.body = self; } } } orig(self); }
// Checks if an EntityState blocks sprinting private bool ShouldSprintBeDisabledOnThisBody(RoR2.CharacterBody targetBody) { EntityStateMachine[] stateMachines; stateMachines = targetBody.GetComponents<EntityStateMachine>(); bool isSprintBlocked = false; foreach (EntityStateMachine machine in stateMachines) { var currentState = machine.state; if (currentState == null) { return false; } #if DEBUGGY if (!knownEntityStates.Contains(currentState.ToString())) { knownEntityStates.Add(currentState.ToString()); Debug.LogError("List of Known EntityStates;"); foreach (var item in knownEntityStates) { Debug.Log(item); } } #endif if (stateSprintDisableList.Contains(currentState.ToString())) { isSprintBlocked = true; } } return isSprintBlocked; }
private void ForceFeedPotion(On.RoR2.CharacterBody.orig_FixedUpdate orig, RoR2.CharacterBody self) { if (NetworkServer.active) { var InventoryCount = GetCount(self); if (InventoryCount > 0) { if (!self.HasBuff(AccursedPotionSipCooldownDebuff) && self.activeBuffsListCount <= maxEffectsAccrued) { BuffIndex ChosenBuff = RoR2.BuffCatalog.buffDefs[random.RangeInt(0, RoR2.BuffCatalog.buffCount - 1)].buffIndex; if (RoR2.BuffCatalog.GetBuffDef(ChosenBuff).iconPath != null && ChosenBuff != BuffIndex.Immune && ChosenBuff != BuffIndex.HiddenInvincibility) { var BuffCount = RoR2.BuffCatalog.GetBuffDef(ChosenBuff).canStack ? InventoryCount : 1; var randomEffectDuration = random.RangeFloat(10, 20); RoR2.TeamMask enemyTeams = RoR2.TeamMask.GetEnemyTeams(self.teamComponent.teamIndex); RoR2.HurtBox[] hurtBoxes = new RoR2.SphereSearch { radius = baseRadiusGranted + (additionalRadiusGranted * (InventoryCount - 1)), mask = RoR2.LayerIndex.entityPrecise.mask, origin = self.corePosition }.RefreshCandidates().FilterCandidatesByHurtBoxTeam(enemyTeams).OrderCandidatesByDistance().FilterCandidatesByDistinctHurtBoxEntities().GetHurtBoxes(); for (int i = 0; i < hurtBoxes.Length; i++) { var body = hurtBoxes[i].healthComponent.body; if (body) { AddBuffAndDot(ChosenBuff, randomEffectDuration, BuffCount, body); } } AddBuffAndDot(AccursedPotionSipCooldownDebuff, baseSipCooldownDuration * (float)Math.Pow(additionalStackSipCooldownReductionPercentage, InventoryCount - 1), 1, self); AddBuffAndDot(ChosenBuff, randomEffectDuration, BuffCount, self); } } } } orig(self); }
private void FireEliteChanges(ILContext il) { ILCursor c = new ILCursor(il); c.GotoNext( x => x.MatchLdarg(2), x => x.MatchLdarg(1), x => x.MatchLdfld <RoR2.DamageInfo>("attacker"), x => x.MatchLdloc(7), x => x.MatchBrtrue(out ILLabel IL_0270), x => x.MatchLdcI4(1), x => x.MatchBr(out ILLabel IL_0271), x => x.MatchLdcI4(3), x => x.MatchLdcR4(4) ); c.Index += 9; c.Emit(OpCodes.Pop); c.Emit(OpCodes.Ldarg_1); c.Emit(OpCodes.Ldarg_2); c.EmitDelegate <Func <RoR2.DamageInfo, GameObject, float> >((damageInfo, victimGameObject) => { if (damageInfo != null && victimGameObject != null) { RoR2.CharacterBody component = damageInfo.attacker.GetComponent <RoR2.CharacterBody>(); int itemCount = component.inventory.GetItemCount(AspectsToItems.AspectsToItems.NewDefsList.Find(x => x.name == "AffixRed").itemIndex); if (component.master.inventory) { if (itemCount > 0) { return(2f + 2f * itemCount); } } } return(4f); }); }
/// <summary> /// Adds a timed buff to a body if a Dot for it does not exist, else inflicts said dot on the specified body. /// </summary> /// <param name="buff">The buffdef to apply to the body, or find the dotcontroller of.</param> /// <param name="duration">The duration of the buff or dot.</param> /// <param name="stackCount">The amount of buff stacks to apply.</param> /// <param name="body">The body to apply the buff or dot to.</param> public static void AddBuffAndDot(BuffDef buff, float duration, int stackCount, RoR2.CharacterBody body) { if (!NetworkServer.active) { return; } RoR2.DotController.DotIndex index = (RoR2.DotController.DotIndex)Array.FindIndex(RoR2.DotController.dotDefs, (dotDef) => dotDef.associatedBuff == buff); for (int y = 0; y < stackCount; y++) { if (index != RoR2.DotController.DotIndex.None) { RoR2.DotController.InflictDot(body.gameObject, body.gameObject, index, duration, 0.25f); } else { body.AddTimedBuff(buff.buffIndex, duration); } } }
private void GenericPickupController_GrantItem(On.RoR2.GenericPickupController.orig_GrantItem orig, RoR2.GenericPickupController self, RoR2.CharacterBody body, RoR2.Inventory inventory) { orig.Invoke(self, body, inventory); //Debug.Log(self.pickupIndex); PickupIndex dio = new PickupIndex(ItemIndex.ExtraLife); if (self.pickupIndex == dio) { //List<PickupIndex> tier3Items = Run.instance.availableTier3DropList; //int rng = random.Next(0, tier3Items.Count); //if (tier3Items[rng] == dio) // rng++; //ItemIndex rngItem = tier3Items[rng].itemIndex; //tier3Items[rng].itemIndex.ToString(); //tier3Items[rng].GetPickupNameToken(); string pickupName = self.GetComponentInChildren <PickupDisplay>().transform.GetChild(1).name.Replace("(Clone)", ""); //Debug.Log(pickupName); ItemDef[] items = typeof(ItemCatalog).GetFieldValue <ItemDef[]>("itemDefs"); ItemDef fakeItem = items[0]; //Debug.Log(items.Length); //Debug.Log(items[0]); foreach (ItemDef item in items) { if (item.pickupModelPath.Contains(pickupName)) { Debug.Log("FOUND!!!!!!!!"); fakeItem = item; break; } } PickupIndex ogItem = new PickupIndex(fakeItem.itemIndex); //Debug.Log("----------"); //Debug.Log(ogItem.GetPickupNameToken()); //Debug.Log(Language.GetString(ogItem.GetPickupNameToken())); //Debug.Log(ogItem.itemIndex); //Debug.Log("----------"); //PickupIndex ogItem = new PickupIndex(ItemIndex.Behemoth); //string rngItemName = Language.GetString(tier3Items[rng].GetPickupNameToken()); //Color32 color = tier3Items[rng].GetPickupColor(); //Color32 colorDark = tier3Items[rng].GetPickupColorDark(); string rngItemName = Language.GetString(ogItem.GetPickupNameToken()); Color32 color = ogItem.GetPickupColor(); Color32 colorDark = ogItem.GetPickupColorDark(); //<color=#307FFF>Lunar Coin</color><style=cEvent> Dropped</style> Chat.AddMessage(String.Format("<style=cEvent>You were expecting </style>{0} {1}", Util.GenerateColoredString(rngItemName, color), Util.GenerateColoredString("BUT IT WAS ME DIO", colorDark))); } }
private void ManageLightningStrikes(On.RoR2.CharacterBody.orig_FixedUpdate orig, RoR2.CharacterBody self) { if (self.HasBuff(LightningStormBuffIndex)) { var lightningTracker = self.GetComponent <LightningTracker>(); if (!lightningTracker) { lightningTracker = self.gameObject.AddComponent <LightningTracker>(); } if (lightningTracker.LightningCooldown > 0) { lightningTracker.LightningCooldown -= Time.fixedDeltaTime; } if (lightningTracker.LightningCooldown <= 0) { for (int i = 1; i <= AmountOfLightningStrikesPerBarrage; i++) { var newProjectileInfo = new FireProjectileInfo { owner = self.gameObject, projectilePrefab = HyperchargedProjectile, speedOverride = 150.0f, damage = self.damage, damageTypeOverride = null, damageColorIndex = DamageColorIndex.Default, procChainMask = default }; var theta = (Math.PI * 2) / AmountOfLightningStrikesPerBarrage; var angle = theta * i; var radius = 20 + random.RangeFloat(-15, 15); var positionChosen = new Vector3((float)(radius * Math.Cos(angle) + self.corePosition.x), self.corePosition.y + 1, (float)(radius * Math.Sin(angle) + self.corePosition.z)); var raycastedChosen = MiscUtils.RaycastToFloor(positionChosen, 1000f); if (raycastedChosen != null) { positionChosen = raycastedChosen.Value + new Vector3(0, 0.5f, 0); } newProjectileInfo.position = positionChosen; newProjectileInfo.rotation = RoR2.Util.QuaternionSafeLookRotation(positionChosen + Vector3.down); ProjectileManager.instance.FireProjectile(newProjectileInfo); } lightningTracker.LightningCooldown = LightningStrikeCooldown; } } orig(self); }
private void ApplyWeightToVictims(On.RoR2.CharacterBody.orig_FixedUpdate orig, RoR2.CharacterBody self) { }
//If I want to update the size of the metaballs in the shader /*private void UpdateVoidheartVisual(On.RoR2.CharacterBody.orig_FixedUpdate orig, RoR2.CharacterBody self) * { * orig(self); * if (GetCount(self) > 0) * { * var scale = ruleLookup[self.modelLocator.modelTransform.name]; * ItemBodyModelPrefab.GetComponent<RoR2.ItemDisplay>().rendererInfos[0].defaultMaterial.SetFloat("_BlobScale", 3.16f / scale); * ItemBodyModelPrefab.GetComponent<RoR2.ItemDisplay>().rendererInfos[0].defaultMaterial.SetFloat("_BlobDepth", 2.9f * scale); * //ItemBodyModelPrefab.GetComponent<RoR2.ItemDisplay>().rendererInfos[0].defaultMaterial.SetFloat("_BlobScale", 3.16f + (1-scale)); * ItemBodyModelPrefab.GetComponent<RoR2.ItemDisplay>().rendererInfos[0].defaultMaterial.SetFloat("_BlobMoveSpeed", 6 * scale); * } * }*/ private void VoidheartAnnihilatesItselfOnDeployables(On.RoR2.CharacterBody.orig_OnInventoryChanged orig, RoR2.CharacterBody self) { orig(self); var InventoryCount = GetCount(self); if (InventoryCount > 0 && self.master) { if (self.master.teamIndex == TeamIndex.Player && !self.isPlayerControlled) { //Unga bunga, voidheart not like deployables. POP! self.inventory.RemoveItem(itemDef.itemIndex, InventoryCount); } } }
private void VoidheartOverlayManager(On.RoR2.CharacterBody.orig_FixedUpdate orig, RoR2.CharacterBody self) { if (self.modelLocator && self.modelLocator.modelTransform && self.HasBuff(VoidInstabilityDebuff) && !self.GetComponent <VoidheartCooldown>()) { var Meshes = Voidheart.ItemBodyModelPrefab.GetComponentsInChildren <MeshRenderer>(); RoR2.TemporaryOverlay overlay = self.modelLocator.modelTransform.gameObject.AddComponent <RoR2.TemporaryOverlay>(); overlay.duration = voidHeartCooldownDebuffDuration; overlay.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f); overlay.animateShaderAlpha = true; overlay.destroyComponentOnEnd = true; overlay.originalMaterial = Meshes[0].material; overlay.AddToCharacerModel(self.modelLocator.modelTransform.GetComponent <RoR2.CharacterModel>()); var VoidheartCooldownTracker = self.gameObject.AddComponent <Voidheart.VoidheartCooldown>(); VoidheartCooldownTracker.Overlay = overlay; VoidheartCooldownTracker.Body = self; } orig(self); }
private void AddBodyFlags() { RoR2.CharacterBody component = RoR2.BodyCatalog.FindBodyPrefab("HuntressBody").GetComponent <RoR2.CharacterBody>(); component.bodyFlags |= RoR2.CharacterBody.BodyFlags.SprintAnyDirection; }
public void CharacterBody_Started(On.RoR2.CharacterBody.orig_Start o, RoR2.CharacterBody s) { o(s); //GetPlayerStats(s); }
private void VoidheartPreventionInteraction(On.RoR2.CharacterBody.orig_Awake orig, RoR2.CharacterBody self) { //First just run the normal awake stuff orig(self); //If I somehow lack the Prevention, give me one if (!self.gameObject.GetComponent <VoidHeartPrevention>()) { self.gameObject.AddComponent <VoidHeartPrevention>(); } //And reset the timer self.gameObject.GetComponent <VoidHeartPrevention>().ResetTimer(); }