Exemplo n.º 1
0
 public override void RegisterHooks(ItemIndex itemIndex)
 {
     On.RoR2.HealthComponent.TakeDamage += (orig, self, damageInfo) =>
     {
         if ((self.body.isElite || self.body.isBoss) && damageInfo.attacker)
         {
             var attackerBody = damageInfo.attacker.GetComponent <CharacterBody>();
             if (attackerBody != null && attackerBody && attackerBody.master && attackerBody.master.inventory)
             {
                 int itemCount = attackerBody.master.inventory.GetItemCount(itemIndex);
                 if (itemCount > 0)
                 {
                     if (self.body.isElite)
                     {
                         damageInfo.damage *= 1 + StackUtils.LinearStack(itemCount, ELITE_DMG_BASE, ELITE_DMG_STACK);
                     }
                     else if (self.body.isBoss)
                     {
                         damageInfo.damage *= StackUtils.ExponentialStack(itemCount, BOSS_DMG_BASE, BOSS_DMG_STACK);
                     }
                 }
             }
         }
         orig(self, damageInfo);
     };
 }
Exemplo n.º 2
0
            public void Update()
            {
                var currentBuffCount = body.GetBuffCount(buffIndex);

                if (timeUntilCombatTimeout > 0)
                {
                    timeUntilCombatTimeout--;
                    timeInCombat++;
                    if (timeInCombat >= TICKS_PER_STACK)
                    {
                        timeInCombat = 0;
                        int maxStackQty = StackUtils.LinearStack(stack, MAX_BASE_DMG_BONUS, MAX_STACK_DMG_BONUS);
                        int addStackQty = Math.Min(StackUtils.LinearStack(stack, BASE_DMG_BONUS, STACK_DMG_BONUS), maxStackQty - currentBuffCount);
                        for (; addStackQty > 0; addStackQty--)
                        {
                            body.AddBuff(buffIndex);
                        }
                    }
                }
                else
                {
                    timeInCombat           = 0;
                    timeUntilCombatTimeout = 0;
                    while (currentBuffCount-- > 0)
                    {
                        body.RemoveBuff(buffIndex);
                    }
                }
            }
Exemplo n.º 3
0
            public void ResetTimer()
            {
                timeoutTimer = (int)(StackUtils.LinearStack(stack, TIMEOUT_TIME_BASE, TIMEOUT_TIME_STACK) * 60);
                var addBuffCount = stack - body.GetBuffCount(buffIndex);

                while (addBuffCount-- > 0)
                {
                    body.AddBuff(buffIndex);
                }
            }
Exemplo n.º 4
0
 public override void RegisterHooks(BuffIndex buffIndex)
 {
     On.RoR2.CharacterBody.RecalculateStats += (orig, self) =>
     {
         orig(self);
         var buffCount = self.GetBuffCount(buffIndex);
         if (buffCount > 0)
         {
             var hpBonus = StackUtils.LinearStack(buffCount, Items.Momentum.BASE_HEALTH_BONUS, Items.Momentum.STACK_HEALTH_BONUS);
             typeof(CharacterBody).GetProperty("maxHealth").SetValue(self, self.maxHealth * (1 + hpBonus));
         }
     };
 }
Exemplo n.º 5
0
 public override void RegisterHooks(ItemIndex itemIndex)
 {
     On.RoR2.HealthComponent.TakeDamage += (orig, self, damageInfo) =>
     {
         if (damageInfo.attacker)
         {
             var attackerBody = damageInfo.attacker.GetComponent <CharacterBody>();
             if (attackerBody != null && attackerBody && attackerBody.master && attackerBody.master.inventory)
             {
                 int itemCount = attackerBody.master.inventory.GetItemCount(itemIndex);
                 if (itemCount > 0)
                 {
                     float dmgBoostPercent = 1 - (Math.Min(HP_CEILING, self.combinedHealthFraction) / HP_CEILING);
                     damageInfo.damage *= 1 + dmgBoostPercent * StackUtils.LinearStack(itemCount, DMG_BUFF, DMG_BUFF_PER);
                 }
             }
         }
         orig(self, damageInfo);
     };
 }
Exemplo n.º 6
0
 public bool OnTakeDamage()
 {
     if (body.HasBuff(NModLoader.LoadedCustomBuffs[Buffs.FramedEyeImmortality.Name].Index))
     {
         return(true);
     }
     else if (body.HasBuff(NModLoader.LoadedCustomBuffs[Buffs.FramedEyeCooldown.Name].Index))
     {
         return(false);
     }
     body.AddTimedBuff(NModLoader.LoadedCustomBuffs[Buffs.FramedEyeImmortality.Name].Index, StackUtils.LinearStack(stack, INVINCIBILITY_BASE, INVINCIBILITY_STACK));
     return(false);
 }