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 CheckBuffAndAddArmor(On.RoR2.CharacterBody.orig_RecalculateStats orig, RoR2.CharacterBody self) { orig(self); if (self.HasBuff(meleeArmorBuff)) { Reflection.SetPropertyValue <float>(self, "armor", self.armor + (self.GetBuffCount(meleeArmorBuff) * armorPerBuff)); #if DEBUG Chat.AddMessage("Turbo Edition: " + ItemName + " CheckBuffAndAddArmor run, " + self + "'s armor is now " + self.armor); Chat.AddMessage("Turbo Edition: " + ItemName + " Increased armor by " + (self.GetBuffCount(meleeArmorBuff) * armorPerBuff) + "."); #endif } }
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; }
private void CharacterBody_RecalculateStats(On.RoR2.CharacterBody.orig_RecalculateStats orig, RoR2.CharacterBody self) { orig.Invoke(self); if (self.HasBuff(BanditSpeedBuff)) { Reflection.SetPropertyValue <float>(self, "moveSpeed", self.moveSpeed + self.GetBuffCount(BanditSpeedBuff)); //TODO: Integrate this to From The Shadows alternate skill mod //Chat.AddMessage("Shadow buff count: " + self.GetBuffCount(BanditSkills.BanditShadowsBuff)); //Reflection.SetPropertyValue<float>(self, "moveSpeed", self.moveSpeed + self.GetBuffCount(BanditShadowsBuff)); } }