示例#1
0
        private void CheckSecondWind(Npc npc, NpcHitData hitData)
        {
            //cannot pull himself out of the swamp
            if (npc == this)
            {
                return;
            }

            var wouldKill = (npc.CurrentHealth - hitData.Dmg) <= 0;

            if (!wouldKill)
            {
                return;
            }

            var rnd = Random.value;

            if (rnd > _secondWindChance)
            {
                return;
            }

            hitData.Dmg = 0;

            var hpAttr = npc.GetAttribute(AttributeName.MaxHealth);

            hpAttr.Value = hpAttr.Value * _secondWindHealthFactor;

            npc.Heal();

            Debug.Log("|||||||||| Triggered second wind for " + npc.GetHashCode() + " My Health: " + CurrentHealth);
        }
示例#2
0
        private void CheckExplode(Npc npc, NpcHitData hitData)
        {
            if (_stunTriggered)
            {
                return;
            }
            if (npc.CurrentHealth > npc.Attributes[AttributeName.MaxHealth].Value / 2.0f)
            {
                return;
            }

            var towers = TargetingHelper.GetTowersInRadius(transform.position, _stunRadius);

            towers.ForEach(tower =>
            {
                tower.Stun(_stunDuration, this);
            });

            _stunTriggered = true;
        }
示例#3
0
        private void CheckHit(Npc npc, NpcHitData hitData)
        {
            if (_isEgg)
            {
                return;
            }

            if (!IsSpawned)
            {
                return;
            }

            var wouldKill = (CurrentHealth - hitData.Dmg <= 0);

            if (!wouldKill)
            {
                return;
            }

            hitData.Dmg = 0;

            MorphToEgg();
        }
示例#4
0
        private void TetherDamage(Npc npc, NpcHitData hitdata)
        {
            var dmg     = hitdata.Dmg;
            var source  = hitdata.Source;
            var glaives = GameManager.Instance.WaveSpawner
                          .GetCurrentSpawnedNpcs()
                          .Where(n => n is StormGlaive)
                          .Where(n => n != this)
                          .ToList();

            var dmgPerGlaive = dmg / glaives.Count();

            if (dmgPerGlaive < 1)
            {
                dmgPerGlaive = 1;
            }

            glaives.ForEach(glaive =>
            {
                glaive.DealDamage(dmgPerGlaive, source);
            });

            hitdata.Dmg = dmgPerGlaive;
        }
示例#5
0
        protected void SpeedBurst(Npc npc, NpcHitData hitData)
        {
            var effect = new AttributeEffect(0.5f, AttributeName.MovementSpeed, AttributeEffectType.Flat, this, 0.5f);

            Attributes[AttributeName.MovementSpeed].AddAttributeEffect(effect);
        }
示例#6
0
        private void SlowDown(Npc npc, NpcHitData hitData)
        {
            var effect = new AttributeEffect(-0.75f, AttributeName.MovementSpeed, AttributeEffectType.PercentMul, this, 0.5f);

            Attributes[AttributeName.MovementSpeed].AddAttributeEffect(effect);
        }