public static void ConsumeCloakDamageBuff(CharacterBody cb) { if (NetworkServer.active && cb) { cb.ClearTimedBuffs(ModContentPack.cloakDamageBuff); } }
private void Extinguish(CharacterBody characterBody) { if (characterBody.HasBuff(BuffIndex.OnFire)) { Chat.AddMessage("cured " + characterBody.GetUserName()); characterBody.ClearTimedBuffs(BuffIndex.OnFire); if (DotController.dotControllerLocator.TryGetValue(characterBody.gameObject.GetInstanceID(), out DotController dotController)) { //var burnEffectController = dotController.burnEffectController; var dotStacks = dotController.dotStackList; int i = 0; int count = dotStacks.Count; while (i < count) { if (dotStacks[i].dotIndex == DotController.DotIndex.Burn || dotStacks[i].dotIndex == DotController.DotIndex.Helfire || dotStacks[i].dotIndex == DotController.DotIndex.PercentBurn) { dotStacks[i].damage = 0f; dotStacks[i].timer = 0f; } i++; } } } }
public static void Extinguish(CharacterBody characterBody) { if (!AllowedToExtinguish(characterBody)) { return; } if (characterBody.HasBuff(BuffIndex.OnFire)) { characterBody.ClearTimedBuffs(BuffIndex.OnFire); if (DotController.dotControllerLocator.TryGetValue(characterBody.gameObject.GetInstanceID(), out DotController dotController)) { //var burnEffectController = dotController.burnEffectController; var dotStacks = dotController.dotStackList; int i = 0; int count = dotStacks.Count; while (i < count) { if (dotStacks[i].dotIndex == DotController.DotIndex.Burn || dotStacks[i].dotIndex == DotController.DotIndex.Helfire || dotStacks[i].dotIndex == DotController.DotIndex.PercentBurn) { dotStacks[i].damage = 0f; dotStacks[i].timer = 0f; } i++; } //Debug.Log("Extinguished!"); } } }
private static void CharacterBody_AddTimedBuff_BuffDef_float(On.RoR2.CharacterBody.orig_AddTimedBuff_BuffDef_float orig, CharacterBody self, BuffDef buffDef, float duration) { if (NetworkServer.active) { BuffIndex buff = DLC1Content.Buffs.BearVoidCooldown.buffIndex; if (buffDef.buffIndex == buff && self.GetBuffCount(buff) < 1) { self.ClearTimedBuffs(buff); self.SetBuffCount(buff, 0); } } orig(self, buffDef, duration); }
////// Hooks ////// private void CharacterBody_OnSkillActivated(On.RoR2.CharacterBody.orig_OnSkillActivated orig, CharacterBody self, GenericSkill skill) { orig(self, skill); var count = GetCount(self); if (count > 0 && skill && skill.isCombatSkill && (skill.baseRechargeInterval > 0f || self.skillLocator.FindSkillSlot(skill) == SkillSlot.Primary)) { int oldCount = self.GetBuffCount(loomBuff); self.ClearTimedBuffs(loomBuff.buffIndex); self.SetBuffCount(loomBuff.buffIndex, 0); for (var i = 0; i < System.Math.Min(oldCount + 1, count * maxStacks); i++) { self.AddTimedBuff(loomBuff, window, count * maxStacks); } } }
/*BuffIndex[] buffIndices = * { * BuffIndex.OnFire, * }; */ private void ExtinguishTeam(IEnumerable <TeamComponent> recipients, float radiusSqr, Vector3 currentPosition) { if (!NetworkServer.active) { return; } foreach (TeamComponent teamComponent in recipients) { if ((teamComponent.transform.position - currentPosition).sqrMagnitude <= radiusSqr) { CharacterBody characterBody = teamComponent.GetComponent <CharacterBody>(); if (characterBody) { //characterBody.AddTimedBuff(this.buffType, this.buffDuration); /*foreach (BuffIndex buffIndex in buffIndices) * { * characterBody.ClearTimedBuffs(buffIndex); * }*/// we only have one so its a waste characterBody.ClearTimedBuffs(BuffIndex.OnFire); if (DotController.dotControllerLocator.TryGetValue(characterBody.gameObject.GetInstanceID(), out DotController dotController)) { var burnEffectController = dotController.burnEffectController; var dotStacks = dotController.dotStackList; int i = 0; int count = dotStacks.Count; while (i < count) { if (dotStacks[i].dotIndex == DotController.DotIndex.Burn || dotStacks[i].dotIndex == DotController.DotIndex.Helfire || dotStacks[i].dotIndex == DotController.DotIndex.PercentBurn) { dotStacks[i].damage = 0f; dotStacks[i].timer = 0f; } i++; } Destroy(dotController.gameObject); } } } } }
private void CharacterBody_FixedUpdate_PerformanceMode(On.RoR2.CharacterBody.orig_FixedUpdate orig, CharacterBody self) { orig(self); if (NetworkServer.active) { if (preventMoneyDrops) { return; } int doshCount = self.GetBuffCount(DoshContent.pendingDoshBuff); if (doshCount > 0) { self.ClearTimedBuffs(DoshContent.pendingDoshBuff); if (self.master) { ReleaseMoney(self.master, doshCount); } } } }
public void ClearTarget() { if (NetworkServer.active) { if (target && target.HasBuff(buffDef)) { target.ClearTimedBuffs(buffDef); } new SyncClearTarget(gameObject.GetComponent <NetworkIdentity>().netId).Send(NetworkDestination.Clients); } target = null; while (highlights.Count > 0) { if (highlights[0] && highlights[0].gameObject) { Object.Destroy(highlights[0].gameObject); } highlights.RemoveAt(0); } }
internal static void HandleDebuffs(CharacterBody body) { if (body) { if (body.HasBuff(chillDebuff)) { var chillCount = body.GetBuffCount(chillDebuff); body.moveSpeed *= 1f - ((StaticValues.chillDebuffSlowMax / StaticValues.chillDebuffMaxStacks) * chillCount); if (StaticValues.useAttackSlow) { body.attackSpeed *= 1f - ((StaticValues.chillDebuffAttackMax / StaticValues.chillDebuffMaxStacks) * chillCount); } if (chillCount >= StaticValues.chillDebuffMaxStacks) { body.healthComponent.TakeDamage(new DamageInfo { damage = StaticValues.freezeDamage, damageType = DamageType.Freeze2s }); body.ClearTimedBuffs(chillDebuff.buffIndex); body.AddTimedBuff(chillCooldown, StaticValues.chillCooldownDuration); } } } }
private void CharacterBody_FixedUpdate(On.RoR2.CharacterBody.orig_FixedUpdate orig, CharacterBody self) { orig(self); if (NetworkServer.active) { if (preventMoneyDrops) { return; } int doshCount = Mathf.Min(self.GetBuffCount(DoshContent.pendingDoshBuff.buffIndex), 8); //Can queue up to 8 if (doshCount > 0) { self.ClearTimedBuffs(DoshContent.pendingDoshBuff.buffIndex); if (self.master) { for (int i = 0; i < doshCount; i++) { ReleaseMoney(self.master); } } } } }