Ejemplo n.º 1
0
 public WO_VoidZone(CreatureObject onwer, DB_Spell spell, DB_SpellEffect main)
     : base(onwer.Manager.GetNewGuid() | Constants.DRObject, onwer.Manager)
 {
     _main           = main;
     _spell          = spell;
     _onwer          = onwer;
     _position       = onwer.Position;
     _ticks          = (int)main.AttackModifer;
     OnUpdate       += WO_VoidZone_OnUpdate;
     OnDestroy      += WO_VoidZone_OnDestroy;
     _targets        = new List <CreatureObject>();
     _addedTargets   = new List <CreatureObject>();
     _removedTargets = new List <CreatureObject>();
     _update         = _period = (int)(main.LevelModifer * 1000) / _ticks;
     _hasAura        = spell.Effects.Values.Any(x => x.Type == SpellEffectType.AuraModifier);
     Spawn();
 }
Ejemplo n.º 2
0
        public static void PerformSkill(CreatureObject creature, TargetEntry target)
        {
            DB_Spell       spell = DataMgr.SelectSpell(target.SpellID); bool area = false, magick;
            DB_SpellEffect main = spell.Effects[0]; CreatureObject targetCO;

            creature.View.PerformSkill(target);
            if (creature.IsPlayer)
            {
                ((WO_Player)creature).Player.Skills.AddCooldown(spell.ID, main.Data03);
            }
            creature.Stats.DecreaseCurrent(Stats.Energy, main.Data01);
            if (target.HasGuid)
            {
                creature.Server.Objects.TryGetCreature((ushort)target.Guid, out targetCO);
                foreach (var item in spell.Effects.Values)
                {
                    float effect = item.BaseConst + (item.LevelModifer * creature.Stats.Level) + (item.AttackModifer * creature.Stats.Attack);
                    switch (item.Type)
                    {
                    case SpellEffectType.Damage:
                    case SpellEffectType.MagickDamage:
                        if (targetCO != creature)
                        {
                            targetCO.Stats.DoDamage(creature, effect, item.Type == SpellEffectType.MagickDamage);
                        }
                        break;

                    case SpellEffectType.FrontAreaDamage:
                    case SpellEffectType.MagicFrontAreaDamage:
                        magick = item.Type == SpellEffectType.MagicFrontAreaDamage;
                        Vector3 direction = MathHelper.GetDirection(creature);
                        if ((item.Target & SpellTarget.Creature) != 0)
                        {
                            foreach (var entry in creature.Server.Objects.GetMobsInRadius(creature.Position + direction * item.Data01, item.Data02).ToArray())
                            {
                                entry.Stats?.DoDamage(creature, effect, magick);
                            }
                        }
                        break;

                    case SpellEffectType.SplashDamage:
                    case SpellEffectType.MagicSplashDamage:
                        magick = item.Type == SpellEffectType.MagicSplashDamage;
                        if ((item.Target & SpellTarget.NotMain) == 0 && targetCO != creature)
                        {
                            targetCO.Stats.DoDamage(creature, effect, magick);
                        }
                        if ((item.Target & SpellTarget.Creature) != 0)
                        {
                            foreach (var entry in creature.Server.Objects.GetMobsInRadiusExcept(creature, targetCO, item.Data02).ToArray())
                            {
                                entry.Stats?.DoDamage(creature, effect, magick);
                            }
                        }
                        break;

                    case SpellEffectType.Heal:
                        targetCO.Stats.DoHeal(creature, effect);
                        break;

                    case SpellEffectType.Modifier:
                        targetCO.Stats.AddModifier((Stats)item.Data01, effect, item.Data03, item.Data02 == 1);
                        break;

                    case SpellEffectType.Teleport:
                        creature.Movement.Teleport(targetCO.Position);
                        break;

                    case SpellEffectType.AreaInit:
                        if (!area)
                        {
                            new WO_VoidZone(creature, spell, item);
                            area = true;
                        }
                        break;
                    }
                }
            }
            else
            {
                foreach (var item in spell.Effects.Values)
                {
                    float effect = item.BaseConst + (item.LevelModifer * creature.Stats.Level) + (item.AttackModifer * creature.Stats.Attack);
                    switch (item.Type)
                    {
                    case SpellEffectType.Teleport:
                        creature.Movement.Teleport(target.Position);
                        break;

                    case SpellEffectType.AreaInit:
                        if (!area)
                        {
                            new WO_VoidZone(creature, spell, item);
                            area = true;
                        }
                        break;

                    case SpellEffectType.FrontAreaDamage:
                    case SpellEffectType.MagicFrontAreaDamage:
                        magick = item.Type == SpellEffectType.MagicFrontAreaDamage;
                        Vector3 direction = MathHelper.GetDirection(creature);
                        if ((item.Target & SpellTarget.Creature) != 0)
                        {
                            foreach (var entry in creature.Server.Objects.GetMobsInRadius(creature.Position + direction * item.Data01, item.Data02).ToArray())
                            {
                                entry.Stats?.DoDamage(creature, effect, magick);
                            }
                        }
                        break;

                    case SpellEffectType.SplashDamage:
                    case SpellEffectType.MagicSplashDamage:
                        magick = item.Type == SpellEffectType.MagicSplashDamage;
                        if ((item.Target & SpellTarget.Creature) != 0)
                        {
                            foreach (var entry in creature.Server.Objects.GetMobsInRadius(creature, item.Data02).ToArray())
                            {
                                entry.Stats?.DoDamage(creature, effect, magick);
                            }
                        }
                        break;
                    }
                }
            }
        }