private void BuffTeam(TeamIndex teamIndex, BuffIndex[] buffIndices) { ReadOnlyCollection <TeamComponent> teamComponents = TeamComponent.GetTeamMembers(teamIndex); foreach (var teamComponent in teamComponents) { CharacterBody body = teamComponent.body; if (body) { if (body.bodyFlags.HasFlag(CharacterBody.BodyFlags.Mechanical)) { body.AddTimedBuff(buildingDebuff, buffDuration); var modelAnimator = Modules.Helpers.GetModelAnimator(body); modelAnimator.bodyRotation = Util.QuaternionSafeLookRotation(Vector3.zero, Vector3.down); modelAnimator.enabled = false; } else { foreach (BuffIndex buffIndex in buffIndices) { body.AddTimedBuff(buffIndex, buffDuration); } } } } }
public override void OnEnter() { base.OnEnter(); if (base.teamComponent && NetworkServer.active) { ReadOnlyCollection <TeamComponent> teamMembers = TeamComponent.GetTeamMembers(base.teamComponent.teamIndex); Vector3 position = base.transform.position; for (int i = 0; i < teamMembers.Count; i++) { CharacterBody component = teamMembers[i].GetComponent <CharacterBody>(); if (component) { if (base.characterBody.skillLocator.utility.stock > 0 && !component.HasBuff(BuffIndex.EngiTeamShield)) { component.AddTimedBuff(BuffIndex.EngiTeamShield, 8f); component.AddTimedBuff(BuffIndex.TeslaField, 2f); HealthComponent component2 = component.GetComponent <HealthComponent>(); if (component2) { component2.RechargeShieldFull(); } base.skillLocator.utility.DeductStock(1); } } } } }
public override void OnEnter() { base.OnEnter(); if (NetworkServer.active) { ReadOnlyCollection <TeamComponent> teamMembers = TeamComponent.GetTeamMembers(base.teamComponent.teamIndex); Vector3 position = base.transform.position; for (int i = 0; i < teamMembers.Count; i++) { CharacterBody component = teamMembers[i].GetComponent <CharacterBody>(); if (component) { if (base.characterBody.skillLocator.utility.stock > 0 && !component.HasBuff(BuffIndex.EngiShield) && !component.HasBuff(BuffIndex.ElephantArmorBoost)) { component.AddTimedBuff(BuffIndex.EngiShield, 3f); component.AddTimedBuff(BuffIndex.Immune, 3f); component.AddTimedBuff(BuffIndex.ElephantArmorBoost, 6f); HealthComponent component2 = component.GetComponent <HealthComponent>(); if (component2) { component2.RechargeShieldFull(); } base.skillLocator.utility.DeductStock(1); } } } } base.OnExit(); base.outer.SetNextStateToMain(); }
private void ApplyHealing(HealthComponent healthComponent, CharacterBody body = null) { bool embryoProc = Embryo.instance.CheckEmbryoProc(body); float restore = healthRestoreAmount; if (embryoProc) { restore *= 2f; } if (!body) { body = healthComponent.body; } if (healType == 0) { healthComponent.HealFraction(restore, default); } else { healthComponent.Heal(restore, default); } if (enableRegenBuff) { body.AddTimedBuff(regenBuff, regenDuration); if (embryoProc) { body.AddTimedBuff(regenBuff, regenDuration); } } }
private void GlobalEventManager_onServerDamageDealt(DamageReport damageReport) { if (!damageReport.attackerBody || !damageReport.victimBody || !damageReport.attacker || !damageReport.victim || !damageReport.attackerMaster || !damageReport.victimMaster || damageReport == null) { return; } if (damageReport.attackerBody && damageReport != null) { CharacterBody attackerBody = damageReport.attackerBody; CharacterBody victimBody = damageReport.victimBody; CharacterMaster attackerMaster = damageReport.attackerMaster; CharacterMaster victimMaster = damageReport.victimMaster; Inventory attackerInventory = attackerMaster ? attackerMaster.inventory : null; Inventory victimInventory = victimMaster ? victimMaster.inventory : null; int scpRandom = UnityEngine.Random.Range(0, scpBuffList.Count); int rootCount = attackerInventory.GetItemCount(Root.itemIndex); int scpCount = attackerInventory.GetItemCount(SCP.itemIndex); if (rootCount > 0 && Util.CheckRoll((17 + (rootCount * 3)), attackerMaster) && attackerMaster && damageReport.victimMaster) { Util.PlaySound("Play_nullifier_attack1_root", victimBody.gameObject); victimBody.AddTimedBuff(BuffIndex.Cripple, 3); } if (scpCount > 0 && damageReport.victimBody && victimMaster) { victimBody.AddTimedBuff(scpBuffList[scpRandom], (scpCount * 2)); } } }
public virtual void ApplyImmuneBuff(CharacterBody characterBody) { if (characterBody) { characterBody.AddTimedBuff(armorBuff, LoaderMain.DebrisShieldDuration.Value); characterBody.AddTimedBuff(speedBuff, speedBuffDuration); } }
public float ModifyDamage(float damage, BodyIndex sourceBodyIndex) { var count = BismuthFlask.instance.GetCount(body); if (count <= 0 || sourceBodyIndex == BodyIndex.None) { lastHitBodyIndex = BodyIndex.None; return(damage); } if (lastHitBodyIndex != BodyIndex.None) { if (lastHitBodyIndex == sourceBodyIndex) { damage /= 1f + BismuthFlask.instance.resistAmount * count; } else { damage *= 1f + BismuthFlask.instance.weakAmount * count; } } lastHitBodyIndex = sourceBodyIndex; stopwatch = BismuthFlask.instance.duration; body.AddTimedBuff(BismuthFlask.instance.bismuthFlaskBuff, stopwatch); return(damage); }
// Token: 0x0600310D RID: 12557 RVA: 0x000D300C File Offset: 0x000D120C public override void OnEnter() { base.OnEnter(); if (base.teamComponent && NetworkServer.active) { ReadOnlyCollection <TeamComponent> teamMembers = TeamComponent.GetTeamMembers(base.teamComponent.teamIndex); float num = EngiTeamShield.radius * EngiTeamShield.radius; Vector3 position = base.transform.position; for (int i = 0; i < teamMembers.Count; i++) { if ((teamMembers[i].transform.position - position).sqrMagnitude <= num) { CharacterBody component = teamMembers[i].GetComponent <CharacterBody>(); if (component) { component.AddTimedBuff(BuffIndex.EngiTeamShield, EngiTeamShield.duration); HealthComponent component2 = component.GetComponent <HealthComponent>(); if (component2) { component2.RechargeShieldFull(); } } } } } }
private void GlobalEventManager_OnInteractionsGlobal(Interactor interactor, IInteractable interactable, GameObject gameObject) { CharacterBody characterBody = interactor.GetComponent <CharacterBody>(); if (characterBody) { Inventory inventory = characterBody.inventory; CharacterMaster master = characterBody.master; if (inventory && master) { int keyCardCount = inventory.GetItemCount(BrokenKeycard.itemIndex); int sundialCount = inventory.GetItemCount(Sundial.itemIndex); if (keyCardCount > 0) { master.GiveMoney(3U + (uint)(keyCardCount * 3)); } if (sundialCount > 0 && Util.CheckRoll(15 + (sundialCount * 5), master)) { Util.PlaySound("Play_item_use_gainArmor", characterBody.gameObject); int h = UnityEngine.Random.Range(0, eliteBuffList.Count); characterBody.AddTimedBuff(eliteBuffList[h], 5); } } } }
private static void Heal(CharacterBody characterBody) { if (characterBody.healthComponent) { characterBody.AddTimedBuff(Buffs.MustacheBuff, Duration.Value); } }
public override void Effect(GlobalEventManager globalEventManager, DamageInfo damageInfo, GameObject victim, int itemCount) { CharacterBody body = damageInfo.attacker.GetComponent <CharacterBody>(); CharacterBody Attacker = damageInfo.attacker.GetComponent <CharacterBody>(); CharacterBody characterBody = victim ? victim.GetComponent <CharacterBody>() : null; CharacterMaster master = Attacker.master; Inventory inventory = master.inventory; TeamComponent Team = Attacker.GetComponent <TeamComponent>(); TeamIndex attackerTeamIndex = Team ? Team.teamIndex : TeamIndex.Neutral; Vector3 aimOrigin = Attacker.aimOrigin; damageInfo.procChainMask.SetProcValue(ProcType.Rings, true); float damageCoefficient = (float)(1.25 + 1.25 * itemCount); float num3 = Util.OnHitProcDamage(damageInfo.damage, Attacker.damage, damageCoefficient); DamageInfo damageInfo1 = new DamageInfo() { damage = num3, damageColorIndex = DamageColorIndex.Item, damageType = RoR2.DamageType.Generic, attacker = damageInfo.attacker, crit = damageInfo.crit, force = Vector3.zero, inflictor = (GameObject)null, position = damageInfo.position, procChainMask = damageInfo.procChainMask, procCoefficient = 1f }; EffectManager.instance.SimpleImpactEffect(Resources.Load <GameObject>("Prefabs/Effects/ImpactEffects/IceRingExplosion"), damageInfo.position, Vector3.up, true); characterBody.AddTimedBuff(BuffIndex.Slow80, 3f); victim.GetComponent <HealthComponent>()?.TakeDamage(damageInfo1); }
private void Heal(CharacterBody characterBody) { if (characterBody.healthComponent) { characterBody.AddTimedBuff(MustacheHealBuff, Mustache_Duration); } }
void FixedUpdate() { if (!body.healthComponent.alive) { return; } if (icd > 0f) { icd -= Time.fixedDeltaTime; } var count = DeadManSwitch.instance.GetCount(body); if (count <= 0) { return; } var eqp = EquipmentCatalog.GetEquipmentDef(body.equipmentSlot.equipmentIndex); if (icd <= 0f && body.healthComponent.isHealthLow && eqp != null) { icd = Mathf.Pow(1f - DeadManSwitch.instance.cdrStack, count - 1) * eqp.cooldown * (DeadManSwitch.instance.externalCdr ? body.inventory.CalculateEquipmentCooldownScale() : 1f); body.AddTimedBuff(DeadManSwitch.instance.deadManSwitchBuff, icd); body.equipmentSlot.PerformEquipmentAction(eqp); } }
public static void ApplyBuff(this CharacterBody body, BuffIndex buff, Int32 stacks = 1, Single duration = -1f) { if (NetworkServer.active) { if (duration < 0f) { body.SetBuffCount(buff, body.GetBuffCount(buff) + stacks); } else { if (stacks < 0) { Log.Error("Cannot remove duration from a buff"); return; } for (Int32 i = 0; i < stacks; ++i) { body.AddTimedBuff(buff, duration); } } } else { new BuffMessage(body, buff, stacks, duration).Send(NetworkDestination.Server); } }
public static void ApplyBuff(this CharacterBody body, BuffIndex buff, int stacks = 1, float duration = -1f) { if (NetworkServer.active) { if (duration < 0f) { body.SetBuffCount(buff, stacks); } else { if (stacks < 0) { R2API.Logger.LogError("Cannot remove duration from a buff"); return; } for (int i = 0; i < stacks; ++i) { body.AddTimedBuff(buff, duration); } } } else { new BuffMessage(body, buff, stacks, duration) .Send(NetworkDestination.Server); } }
public override void Effect(GlobalEventManager globalEventManager, DamageInfo damageInfo, GameObject victim, int itemCount) { float procCoefficient = damageInfo.procCoefficient; CharacterBody body = damageInfo.attacker.GetComponent <CharacterBody>(); body.AddTimedBuff(BuffIndex.AttackSpeedOnCrit, 2f * procCoefficient); }
private void GrantItem(On.RoR2.GenericPickupController.orig_GrantItem orig, GenericPickupController self, CharacterBody body, Inventory inventory) { orig(self, body, inventory); if (self && inventory && inventory.GetItemCount(Pillow.itemIndex) > 0) { body.AddTimedBuff(BuffIndex.Cloak, 2 * inventory.GetItemCount(Pillow.itemIndex)); } }
// Token: 0x06001EC5 RID: 7877 RVA: 0x00085404 File Offset: 0x00083604 public void OnDamageInflictedServer(DamageReport damageReport) { CharacterBody victimBody = damageReport.victimBody; if (victimBody) { victimBody.AddTimedBuff(this.buffIndex, this.duration); } }
private IEnumerator TeleportAlliesToFirstAvailablePlayerRoutine(Vector3?forcePosition = null, float delay = 0) { foreach (var ally in allies) { CharacterBody allyBody = ally.GetBody(); if (allyBody) { allyBody.AddTimedBuff(RoR2Content.Buffs.Cloak, delay); allyBody.AddTimedBuff(RoR2Content.Buffs.HiddenInvincibility, delay); } } yield return(new WaitForSeconds(delay)); if (!TeleportAlliesToFirstAvailablePlayer(forcePosition)) { Debug.LogWarning("Couldn't teleport allies to a player body!"); } yield break; }
// Token: 0x06002B6A RID: 11114 RVA: 0x000B72F0 File Offset: 0x000B54F0 protected virtual void AddDebuff(CharacterBody body) { body.AddTimedBuff(BuffIndex.Weak, this.slowDuration); SetStateOnHurt component = body.healthComponent.GetComponent <SetStateOnHurt>(); if (component == null) { return; } component.SetStun(-1f); }
public void OnDamageInflictedServer(DamageReport damageReport) { CharacterBody victim = damageReport.victimBody; if (victim) { if (!victim.HasBuff(Buffs.chillCooldown)) { victim.AddTimedBuff(Buffs.chillDebuff, StaticValues.chillDebuffDuration); } } }
public override void Effect(GlobalEventManager globalEventManager, DamageInfo damageInfo, GameObject victim, int itemCount) { CharacterBody body = damageInfo.attacker.GetComponent <CharacterBody>(); CharacterBody Attacker = damageInfo.attacker.GetComponent <CharacterBody>(); CharacterBody characterBody = victim ? victim.GetComponent <CharacterBody>() : null; CharacterMaster master = Attacker.master; Inventory inventory = master.inventory; TeamComponent Team = Attacker.GetComponent <TeamComponent>(); TeamIndex attackerTeamIndex = Team ? Team.teamIndex : TeamIndex.Neutral; Vector3 aimOrigin = Attacker.aimOrigin; characterBody.AddTimedBuff(BuffIndex.Slow60, 1f * itemCount); }
private void FixedUpdate() { if (count <= 0) { return; } stopwatch -= Time.fixedDeltaTime; if (stopwatch <= 0f) { stopwatch = Mathf.Max(Imprint.instance.baseCD * Mathf.Pow(1f - Imprint.instance.stackCDreduc, count - 1), Imprint.instance.baseDuration); ownerBody.AddTimedBuff(Imprint.instance.rng.NextElementUniform(rndBuffs), Imprint.instance.baseDuration); } }
// Token: 0x06000BBC RID: 3004 RVA: 0x000395E8 File Offset: 0x000377E8 private void OnTriggerStay(Collider other) { if (NetworkServer.active && this.alive && TeamComponent.GetObjectTeam(other.gameObject) == this.teamFilter.teamIndex) { CharacterBody component = other.GetComponent <CharacterBody>(); if (component) { component.AddTimedBuff(this.buffIndex, this.buffDuration); UnityEngine.Object.Instantiate <GameObject>(this.pickupEffect, other.transform.position, Quaternion.identity); UnityEngine.Object.Destroy(this.baseObject); } } }
internal static void Init() { On.RoR2.GlobalEventManager.OnHitEnemy += (orig, self, damageInfo, victim) => { if (!victim || !damageInfo.attacker) { return; } CharacterBody attacker = damageInfo.attacker.GetComponent <CharacterBody>(); if (attacker.inventory) { int aPistolCount = attacker.inventory.GetItemCount(Assets.aPistolItemIndex); if (aPistolCount > 0) { attacker.AddTimedBuff(Assets.lightArmourBuffIndex, (1.0f * aPistolCount)); // 40 armour per stack } } orig(self, damageInfo, victim); }; GlobalEventManager.onCharacterDeathGlobal += (report) => { if (!report.attacker || !report.attackerBody) { return; } CharacterBody attacker = report.attackerBody; if (attacker.inventory) { int garbCount = attacker.inventory.GetItemCount(Assets.garbItemIndex); if (garbCount > 0 && Util.CheckRoll(5, attacker.master)) { attacker.AddTimedBuff(BuffIndex.Cloak, 2 + (garbCount)); } } }; On.RoR2.CharacterBody.RecalculateStats += (orig, self) => { orig(self); if (self && self.HasBuff(Assets.lightArmourBuffIndex)) { self.SetPropertyValue("armor", self.armor + 40f); } }; }
private void InflictPulverized(On.RoR2.GlobalEventManager.orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victimGameObject) { if ((bool)self && (bool)damageInfo.attacker) { CharacterBody victim = victimGameObject.GetComponent <CharacterBody>(); CharacterBody attacker = damageInfo.attacker.GetComponent <CharacterBody>(); int count = GetCount(attacker); if (count > 0) { victim.AddTimedBuff(RoR2Content.Buffs.Pulverized, 8); } } orig(self, damageInfo, victimGameObject); }
static public void ModdedHitEnemy(On.RoR2.GlobalEventManager.orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { if (damageInfo.procCoefficient == 0 || !NetworkServer.active || (!(bool)damageInfo.attacker || damageInfo.procCoefficient <= 0)) { return; } CharacterBody Attacker = damageInfo.attacker.GetComponent <CharacterBody>(); CharacterBody characterBody = victim ? victim.GetComponent <CharacterBody>() : null; if (!Attacker) { return; } CharacterMaster master = Attacker.master; if (!master) { return; } damageInfo.procChainMask.LinkToManager(); Inventory inventory = master.inventory; TeamComponent Team = Attacker.GetComponent <TeamComponent>(); TeamIndex attackerTeamIndex = Team ? Team.teamIndex : TeamIndex.Neutral; Vector3 aimOrigin = Attacker.aimOrigin; ModItemManager.OnHitEnemyEffects(self, damageInfo, victim); //SetOnFire . Can't realy do much for this one int DamageType = (uint)(damageInfo.damageType & RoR2.DamageType.IgniteOnHit) > 0U ? 1 : 0; bool CanSetFire = (damageInfo.damageType & RoR2.DamageType.PercentIgniteOnHit) != RoR2.DamageType.Generic || Attacker.HasBuff(BuffIndex.AffixRed); int num2 = CanSetFire ? 1 : 0; if ((DamageType | num2) != 0) { DotController.InflictDot(victim, damageInfo.attacker, CanSetFire ? DotController.DotIndex.PercentBurn : DotController.DotIndex.Burn, 4f * damageInfo.procCoefficient, 1f); } //Apply Ice Elite (Will have to wait for Buff Change for that) if ((Attacker.HasBuff(BuffIndex.AffixWhite) ? 1 : 0) > 0 && (bool)((UnityEngine.Object)characterBody)) { characterBody.AddTimedBuff(BuffIndex.Slow80, 1.5f * damageInfo.procCoefficient); } damageInfo.procChainMask.UnlinkToManager(); }
public void OnReceived() { CharacterBody characterBody = Util.FindNetworkObject(this.targetId).GetComponent <CharacterBody>(); if (!characterBody) { StanWorshipperPlugin.logger.LogMessage("Error applying timed buff: character body does not exist!"); return; } for (int i = 0; i < stacks; i++) { characterBody.AddTimedBuff(buffIndex, 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); } } }
public void OnTriggerStay(Collider other) { if (NetworkServer.active) { if (this.previousColliderList.Contains(other)) { return; } this.previousColliderList.Add(other); CharacterBody component = other.GetComponent <CharacterBody>(); if (component && component.mainHurtBox) { component.AddTimedBuff(this.buffType, this.buffDuration); } } }