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); } }; }
/// <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); } } }