Пример #1
0
        void StealHp(FightActor target)
        {
            var damage = new Fights.Damage(Dice, GetEffectSchool(Effect.EffectId), Caster, Spell, TargetedCell, EffectZone)
            {
                IsCritical = Critical
            };

            // spell reflected
            var buff = target.GetBestReflectionBuff();

            if (buff != null && buff.ReflectedLevel >= Spell.CurrentLevel && Spell.Template.Id != 0)
            {
                NotifySpellReflected(target);
                damage.Source           = Caster;
                damage.ReflectedDamages = true;
                Caster.InflictDamage(damage);

                if (buff.Duration <= 0)
                {
                    target.RemoveBuff(buff);
                }
            }
            else
            {
                target.InflictDamage(damage);

                var amount = (short)Math.Floor(damage.Amount / 2.0);
                if (amount > 0)
                {
                    Caster.Heal(amount, target, true);
                }
            }
        }
Пример #2
0
        public static bool RemoveStateBuff(FightActor target, SpellStatesEnum stateId)
        {
            foreach (var state in target.GetBuffs(x => x is StateBuff && ((StateBuff)x).State.Id == (int)stateId).ToArray())
            {
                target.RemoveBuff(state);
            }

            return(true);
        }
Пример #3
0
        private void Leave(FightActor actor)
        {
            var buffs = actor.GetBuffs(x => x.Caster == Caster && x.Spell.Id == GlyphSpell.Id).ToArray();

            foreach (var buff in buffs)
            {
                actor.RemoveBuff(buff);
            }

            actor.PositionChanged -= OnPositionChanged;
            m_actorsInside.Remove(actor);
        }
Пример #4
0
        void ReduceBuffsDuration(FightActor actor, short duration)
        {
            foreach (var buff in actor.GetBuffs().Where(buff => buff.Dispellable == FightDispellableEnum.DISPELLABLE).Where(buff => buff.Duration > 0 && buff.Delay == 0).ToArray())
            {
                buff.Duration -= duration;

                if (buff.Duration <= 0)
                {
                    actor.RemoveBuff(buff);
                }
            }

            actor.TriggerBuffs(actor, BuffTriggerType.OnDispelled);
            ContextHandler.SendGameActionFightModifyEffectsDurationMessage(Fight.Clients, Effect.Id, Caster, actor, (short)-duration);
        }