Beispiel #1
0
 private void AffixHauntedBuffChanges(On.RoR2.CharacterBody.orig_RecalculateStats orig, RoR2.CharacterBody self)
 {
     orig(self);
     if (self.HasBuff(Resources.Load <BuffDef>("AffixHauntedRecipient")))
     {
         self.armor       += 50f;
         self.attackSpeed *= 1.25f;
     }
     if (self.HasBuff(Resources.Load <BuffDef>("AffixHaunted")))
     {
         self.moveSpeed *= 1.25f;
     }
 }
 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);
 }
Beispiel #3
0
 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);
 }
Beispiel #4
0
 public void FixedUpdate()
 {
     if (!frenziedBody.HasBuff(FrenziedDebuff))
     {
         UnityEngine.Object.Destroy(this);
     }
 }
 public void FixedUpdate()
 {
     if (!Body.HasBuff(EliteBuffIndex))
     {
         UnityEngine.Object.Destroy(Overlay);
         UnityEngine.Object.Destroy(this);
     }
 }
Beispiel #6
0
 public void FixedUpdate()
 {
     if (!Body.HasBuff(VoidInstabilityDebuff))
     {
         UnityEngine.Object.Destroy(Overlay);
         UnityEngine.Object.Destroy(this);
     }
 }
Beispiel #7
0
 private void BloodBookBleedManager(On.RoR2.CharacterBody.orig_FixedUpdate orig, RoR2.CharacterBody self)
 {
     if (self.modelLocator && self.modelLocator.modelTransform && self.HasBuff(InsaneBloodBuff) && !self.GetComponent <InsaneBleed>())
     {
         var Meshes = BloodBook.ItemBodyModelPrefab.GetComponentsInChildren <MeshRenderer>();
         Meshes[0].gameObject.AddComponent <InsaneBleed>();
     }
 }
Beispiel #8
0
        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
            }
        }
 public void FixedUpdate()
 {
     if (!Body.HasBuff(EliteBuffIndex))
     {
         UnityEngine.Object.Destroy(Overlay);
         UnityEngine.Object.Destroy(this);
     }
     if (PulseTimer > 0)
     {
         PulseTimer -= Time.fixedDeltaTime;
         if (PulseTimer <= 0)
         {
             RoR2.TeamMask  enemyTeams = RoR2.TeamMask.GetEnemyTeams(Body.teamComponent.teamIndex);
             RoR2.HurtBox[] hurtBoxes  = new RoR2.SphereSearch
             {
                 radius = 40,
                 mask   = RoR2.LayerIndex.entityPrecise.mask,
                 origin = Body.corePosition
             }.RefreshCandidates().FilterCandidatesByHurtBoxTeam(enemyTeams).OrderCandidatesByDistance().FilterCandidatesByDistinctHurtBoxEntities().GetHurtBoxes();
             foreach (RoR2.HurtBox enemyHurtbox in hurtBoxes)
             {
                 var enemyHealthComponent = enemyHurtbox.healthComponent;
                 if (enemyHealthComponent)
                 {
                     var enemyBody = enemyHealthComponent.body;
                     if (enemyBody)
                     {
                         RaycastHit raycastHit;
                         var        rayCast = RoR2.Util.CharacterRaycast(Body.gameObject, new Ray(Body.corePosition, enemyBody.corePosition - Body.corePosition), out raycastHit, 40, RoR2.LayerIndex.entityPrecise.mask | RoR2.LayerIndex.world.mask, QueryTriggerInteraction.Ignore);
                         if (rayCast && raycastHit.collider)
                         {
                             var hurtbox = raycastHit.collider.GetComponent <RoR2.HurtBox>();
                             if (hurtbox && hurtbox.healthComponent)
                             {
                                 var body = hurtbox.healthComponent.body;
                                 if (body == enemyBody)
                                 {
                                     if (NetworkServer.active)
                                     {
                                         RoR2.EffectManager.SimpleEffect(Resources.Load <GameObject>("Prefabs/Effects/ImpactEffects/IgniteExplosionVFX"), enemyBody.corePosition, RoR2.Util.QuaternionSafeLookRotation(Body.corePosition - enemyBody.corePosition), true);
                                     }
                                     RoR2.DotController.InflictDot(enemyBody.gameObject, Body.gameObject, RoR2.DotController.DotIndex.Burn, 2);
                                 }
                             }
                         }
                     }
                 }
             }
             PulseTimer = 1;
         }
     }
 }
Beispiel #10
0
        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));
            }
        }
Beispiel #11
0
 // 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);
         }
     };
 }
Beispiel #12
0
        private void ApplyBuffAsIndicatorForReady(On.RoR2.CharacterBody.orig_FixedUpdate orig, RoR2.CharacterBody self)
        {
            var InventoryCount = GetCount(self);

            if (InventoryCount > 0)
            {
                if (self.healthComponent.combinedHealthFraction >= 1 && !self.HasBuff(BlasterSwordActiveBuff))
                {
                    self.AddBuff(BlasterSwordActiveBuff);
                }
                if (self.healthComponent.combinedHealthFraction < 1 && self.HasBuff(BlasterSwordActiveBuff))
                {
                    self.RemoveBuff(BlasterSwordActiveBuff);
                }
            }
            else
            {
                if (self.HasBuff(BlasterSwordActiveBuff))
                {
                    self.RemoveBuff(BlasterSwordActiveBuff);
                }
            }
            orig(self);
        }
Beispiel #13
0
        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);
        }
Beispiel #14
0
 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 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);
        }
Beispiel #16
0
        private void VoidheartDeathInteraction(On.RoR2.CharacterMaster.orig_OnBodyDeath orig, RoR2.CharacterMaster self, RoR2.CharacterBody body)
        {
            var InventoryCount = GetCount(body);

            if (InventoryCount > 0 && !body.healthComponent.killingDamageType.HasFlag(DamageType.VoidDeath) && !body.HasBuff(VoidInstabilityDebuff))
            {
                GameObject explosion = new GameObject();
                explosion.transform.position = body.transform.position;

                var componentVoidheartDeath = explosion.AddComponent <VoidheartDeath>();
                componentVoidheartDeath.toReviveMaster      = self;
                componentVoidheartDeath.toReviveBody        = body;
                componentVoidheartDeath.voidExplosionRadius = voidImplosionBaseRadius + (voidImplosionAdditionalRadius * (InventoryCount - 1));
                componentVoidheartDeath.voidHeartImplosionDamageMultiplier = voidImplosionDamageMultiplier;
                componentVoidheartDeath.voidInstabilityDebuff     = VoidInstabilityDebuff;
                componentVoidheartDeath.voidHeartCooldownDuration = voidHeartCooldownDebuffDuration;
                componentVoidheartDeath.Init();

                var tempDestroyOnDeath = self.destroyOnBodyDeath;
                self.destroyOnBodyDeath = false;
                orig(self, body);
                self.destroyOnBodyDeath = tempDestroyOnDeath;
                self.preventGameOver    = true;
                return;
            }
            orig(self, body);
        }