예제 #1
0
            public void OnBuffApplied()
            {
                var barrierLostPerSecond     = healthComponent.body.barrierDecayRate;
                var barrierLostAfterXSeconds = barrierLostPerSecond * DebrisShieldDuration.Value;

                var barrierToGive = healthComponent.fullBarrier;// * DebrisShieldPercentage.Value;

                barrierToRemove = barrierToGive - barrierLostAfterXSeconds;
                //Chat.AddMessage("Expected Barrier to Remove: " + barrierToRemove);
                acceptContributions = false;
                healthComponent.AddBarrier(barrierToGive);
                acceptContributions = true;
                //healthComponent.Networkbarrier = healthComponent.fullBarrier;
            }
예제 #2
0
        protected override bool PerformEquipmentAction(EquipmentSlot slot)
        {
            CharacterBody body = slot.characterBody;

            if (!body)
            {
                return(false);
            }
            HealthComponent health = body.healthComponent;

            if (!health)
            {
                return(false);
            }

            var BarrierAmt = health.fullBarrier * PercentBarrierAmount;

            health.HealFraction(PercentHealAmount, default);
            health.AddBarrier(BarrierAmt);
            body.AddTimedBuff(RoR2Content.Buffs.Immune, ImmuneDuration);
            body.inventory?.SetEquipmentIndex(EquipmentIndex.None); //credit to : Rico
            return(true);
        }
예제 #3
0
        private void Siphon(GrappleTarget target)
        {
            float fullHealth   = target.grappleTargetHealth.fullCombinedHealth;
            float damageAmount = fullHealth * .0033f;   //.33% of max health per .33 seconds - 1% of max health / second

            DamageInfo damageInfo = new DamageInfo();

            damageInfo.position  = target.grappleTarget.transform.position;
            damageInfo.attacker  = this.gameObject;
            damageInfo.inflictor = this.gameObject;
            damageInfo.crit      = false;
            //damageInfo.damage = base.damageStat * this.damageCoefficient;
            damageInfo.damage           = damageAmount;
            damageInfo.damageColorIndex = DamageColorIndex.Default;
            damageInfo.damageType       = DamageType.NonLethal;
            damageInfo.procCoefficient  = 0f;

            target.grappleTargetHealth.TakeDamage(damageInfo);

            float barrierAmount = healthComponent.fullBarrier * .033f;

            healthComponent.AddBarrier(barrierAmount);
        }
예제 #4
0
 public override void OnArrival()
 {
     if (this.target)
     {
         HealthComponent healthComponent = this.target.healthComponent;
         if (healthComponent)
         {
             DamageInfo damageInfo = new DamageInfo();
             damageInfo.damage           = this.damageValue;
             damageInfo.attacker         = this.attacker;
             damageInfo.inflictor        = this.inflictor;
             damageInfo.force            = Vector3.zero;
             damageInfo.crit             = this.isCrit;
             damageInfo.procChainMask    = this.procChainMask;
             damageInfo.procCoefficient  = this.procCoefficient;
             damageInfo.position         = this.target.transform.position;
             damageInfo.damageColorIndex = this.damageColorIndex;
             damageInfo.damageType       = this.damageType;
             healthComponent.TakeDamage(damageInfo);
             GlobalEventManager.instance.OnHitEnemy(damageInfo, healthComponent.gameObject);
             GlobalEventManager.instance.OnHitAll(damageInfo, healthComponent.gameObject);
             if (this.useBonus)
             {
                 if (this.hasLightningBuff == true)
                 {
                     this.skillSlot.rechargeStopwatch = this.skillSlot.rechargeStopwatch + (StaticValues.lightningCooldownReduction * (this.skillSlot.finalRechargeInterval - this.skillSlot.rechargeStopwatch));
                 }
                 if (this.hasIceBuff == true)
                 {
                     HealthComponent health = this.attacker.GetComponent <CharacterBody>().healthComponent;
                     if (health)
                     {
                         health.AddBarrier(health.fullHealth * StaticValues.iceBarrierPercent);
                     }
                 }
             }
         }
         this.failedToKill |= (!healthComponent || healthComponent.alive);
         if (this.bouncesRemaining > 0)
         {
             for (int i = 0; i < this.targetsToFindPerBounce; i++)
             {
                 if (this.bouncedObjects != null)
                 {
                     if (this.canBounceOnSameTarget)
                     {
                         this.bouncedObjects.Clear();
                     }
                     this.bouncedObjects.Add(this.target.healthComponent);
                 }
                 HurtBox hurtBox = this.PickNextTarget(this.target.transform.position);
                 if (hurtBox)
                 {
                     ChainLightningOrb lightningOrb = new ChainLightningOrb();
                     lightningOrb.search                     = this.search;
                     lightningOrb.origin                     = this.target.transform.position;
                     lightningOrb.target                     = hurtBox;
                     lightningOrb.attacker                   = this.attacker;
                     lightningOrb.inflictor                  = this.inflictor;
                     lightningOrb.teamIndex                  = this.teamIndex;
                     lightningOrb.damageValue                = this.damageValue * this.damageCoefficientPerBounce;
                     lightningOrb.bouncesRemaining           = this.bouncesRemaining - 1;
                     lightningOrb.isCrit                     = this.isCrit;
                     lightningOrb.bouncedObjects             = this.bouncedObjects;
                     lightningOrb.lightningType              = this.lightningType;
                     lightningOrb.procChainMask              = this.procChainMask;
                     lightningOrb.procCoefficient            = this.procCoefficient;
                     lightningOrb.damageColorIndex           = this.damageColorIndex;
                     lightningOrb.damageCoefficientPerBounce = this.damageCoefficientPerBounce;
                     lightningOrb.speed         = this.speed;
                     lightningOrb.range         = this.range;
                     lightningOrb.damageType    = this.damageType;
                     lightningOrb.failedToKill  = this.failedToKill;
                     lightningOrb.duration      = this.duration;
                     lightningOrb.orbEffectName = this.orbEffectName;
                     lightningOrb.skillSlot     = this.skillSlot;
                     lightningOrb.useBonus      = this.useBonus;
                     OrbManager.instance.AddOrb(lightningOrb);
                 }
             }
             return;
         }
         if (!this.failedToKill)
         {
             Action <ChainLightningOrb> action = ChainLightningOrb.onChainLightningOrbKilledOnAllBounces;
             if (action == null)
             {
                 return;
             }
             action(this);
         }
     }
 }