Exemple #1
0
 public override bool CheckForFailure(ITargetable caster, ITargetable target, SpellModificationInformation spellInformation, Spell spell)
 {
     if (modifierCondition(caster, target) && ModifierType == SpellModifierType.CastFailed)
     {
         return(true);
     }
     return(false);
 }
        public override void ModifySpell(ITargetable caster, ITargetable target, SpellModificationInformation spellInformation, Spell spell)
        {
            if (BuffRef.NeedsRemoval)
            {
                caster.Character.Entity.Buffs.Remove(BuffRef);
                BuffRef     = null;
                NeedRemoval = true;
                return;
            }
            else if (BuffRef.HasStucks)
            {
                BuffRef.StuckRemoved();
                if (BuffRef.NeedsRemoval)
                {
                    caster.Character.Entity.Buffs.Remove(BuffRef);
                    NeedRemoval = true;
                    BuffRef     = null;
                }
            }

            if (modifierCondition(caster, target))
            {
                switch (ModifierType)
                {
                case SpellModifierType.AdditionalDamage:
                    spellInformation.AdditionalDamage += value;
                    break;

                case SpellModifierType.CriticalChanceAddition:
                    spellInformation.CriticalChanceAddMod += value;
                    break;

                case SpellModifierType.CriticalChanceMultiplier:
                    spellInformation.CriticalChanceMulMod += value;
                    break;

                case SpellModifierType.CriticalDamageMultiplier:
                    spellInformation.CriticalDamageMultiplierAddMod += value;
                    break;

                case SpellModifierType.DamageMultiplier:
                    spellInformation.DamageMultiplier += value;
                    break;

                case SpellModifierType.InstantCast:
                    spellInformation.InstantCast = true;
                    break;

                case SpellModifierType.CastFailed:
                    spellInformation.IsCastFailed = true;
                    break;

                default:
                    break;
                }
            }
        }
Exemple #3
0
        public override void ModifySpell(ITargetable caster, ITargetable target, SpellModificationInformation spellInformation, Spell spell)
        {
            if (modifierCondition(caster, target))
            {
                switch (ModifierType)
                {
                case SpellModifierType.AdditionalDamage:
                    spellInformation.AdditionalDamage += value;
                    break;

                case SpellModifierType.CriticalChanceAddition:
                    spellInformation.CriticalChanceAddMod += value;
                    break;

                case SpellModifierType.CriticalChanceMultiplier:
                    spellInformation.CriticalChanceMulMod += value;
                    break;

                case SpellModifierType.CriticalDamageMultiplier:
                    spellInformation.CriticalDamageMultiplierAddMod += value;
                    break;

                case SpellModifierType.DamageMultiplier:
                    spellInformation.DamageMultiplier += value;
                    break;

                case SpellModifierType.InstantCast:
                    spellInformation.InstantCast = true;
                    break;

                case SpellModifierType.CastFailed:
                    spellInformation.IsCastFailed = true;
                    break;

                default:
                    break;
                }
            }
        }
Exemple #4
0
 public bool CheckTrigger(ITargetable caster, ITargetable target, SpellModificationInformation spellInformation, Spell spell)
 {
     IsTriggered = false;
     if (BuffRef.NeedsRemoval)
     {
         caster.Character.Entity.Buffs.Remove(BuffRef);
         BuffRef     = null;
         NeedRemoval = true;
         return(false);
     }
     IsTriggered = Mechanics.Roll(0, 10000) < TriggerChance * 100;
     if (IsTriggered && BuffRef.HasStucks)
     {
         BuffRef.StuckRemoved();
         if (BuffRef.NeedsRemoval)
         {
             caster.Character.Entity.Buffs.Remove(BuffRef);
             NeedRemoval = true;
             BuffRef     = null;
         }
     }
     return(IsTriggered);
 }
Exemple #5
0
 public override void Apply(ITargetable caster, ITargetable target, TimeSpan elapsedTime, SpellModificationInformation spellInfo, NetworkPlayerInterface playerUi)
 {
     target.Character.Entity.Buffs.RemoveAll(item => item.BuffType == BuffType.Debuff);
 }
        public override void Apply(ITargetable caster, ITargetable target, TimeSpan elapsedTime, SpellModificationInformation spellInfo, NetworkPlayerInterface playerUi)
        {
            target.IsKnockedBack = true;
            target.IsFlying      = true;
            target.IsGrounded    = false;
            if (caster.Position.X < target.Position.X)
            {
                target.Velocity = new Vector2(horizontalValue, -verticalValue);
            }
            else
            {
                target.Velocity = new Vector2(-horizontalValue, -verticalValue);
            }

            if (target is NetworkPlayer)
            {
                NetworkPlayer player = target as NetworkPlayer;
                player.AlignStates();
            }
        }
 public abstract bool CheckForInstantCast(ITargetable caster, ITargetable target, SpellModificationInformation spellInformation, Spell spell);
 public abstract bool CheckForFailure(ITargetable caster, ITargetable target, SpellModificationInformation spellInformation, Spell spell);
 public override void Apply(ITargetable caster, ITargetable target, TimeSpan elapsedTime, SpellModificationInformation spellInfo, NetworkPlayerInterface playerUi)
 {
     if (!target.Character.Entity.ReplacingModels.ContainsKey(newModelName))
     {
         AnimatedSprite newAnimationSprite = (AnimatedSprite)newModel.Clone();
         newAnimationSprite.CurrentAnimation      = target.Character.Sprite.CurrentAnimation;
         newAnimationSprite.CurrentAnimationFrame = target.Character.Sprite.CurrentAnimationFrame;
         newAnimationSprite.PerformAnimation      = target.Character.Sprite.PerformAnimation;
         target.Character.Entity.ReplacingModels.Add(newModelName, newAnimationSprite);
     }
 }
        public override void Apply(ITargetable caster, ITargetable target, TimeSpan elapsedTime, SpellModificationInformation spellInfo, NetworkPlayerInterface playerUi)
        {
            Vector2 prevVelocity = target.Velocity;

            target.IsGrounded = false;
            target.Velocity   = target.Character.IsDirectedRight ? new Vector2(horizontalValue, verticalValue) : new Vector2(-horizontalValue, verticalValue);
            for (int i = 0; i < target.GameMapRef.MapObjects.Length; i++)
            {
                target.GameMapRef.MapObjects[i].CheckCollision(target, Vector2.Zero);
            }

            target.Position += target.Velocity;
            target.Position  = Vector2.Clamp(target.Position, new Vector2(100, -800), new Vector2(target.GameMapRef.MapWidth - 100, target.GameMapRef.MapHeight + 800));

            if (target is NetworkPlayer)
            {
                NetworkPlayer player = target as NetworkPlayer;
                target.Velocity = prevVelocity;
                player.AlignStates();
            }
            else
            {
                target.Velocity = prevVelocity;
            }
        }
Exemple #11
0
 public abstract void Apply(ITargetable caster, ITargetable target, TimeSpan elapsedTime, SpellModificationInformation spellInfo, NetworkPlayerInterface playerUi);
        public override void Apply(ITargetable caster, ITargetable target, TimeSpan elapsedTime, SpellModificationInformation spellInfo, NetworkPlayerInterface playerUi)
        {
            int amount = modifier;

            amount += Mechanics.Roll(minValue, maxValue);

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

            target.Character.Entity.Health.Increase((ushort)amount);
        }
Exemple #13
0
 public SpellCast(Spell spell, SpellData spellData, ITargetable caster, ITargetable target, SpellModificationInformation spellInfo, TimeSpan latency)
 {
     Spell  = spell;
     Target = target;
     if (target == null)
     {
         isNotTargeted = true;
     }
     else
     {
         isNotTargeted = false;
     }
     CastTime     = TimeSpan.FromSeconds(spellData.BaseCastTime / (1 + (caster.Character.Entity.HasteRating + spellInfo.HasteRatingAddMod) / 100));
     CastTimeLeft = CastTime - latency;
 }
Exemple #14
0
 public override void Apply(ITargetable caster, ITargetable target, TimeSpan elapsedTime, SpellModificationInformation spellInfo, NetworkPlayerInterface playerUi)
 {
     Effect.Apply(caster, target, elapsedTime, spellInfo, playerUi);
 }
 public abstract void ModifySpell(ITargetable caster, ITargetable target, SpellModificationInformation spellInformation, Spell spell);
 public override void Apply(ITargetable caster, ITargetable target, TimeSpan elapsedTime, SpellModificationInformation spellInfo, NetworkPlayerInterface playerUi)
 {
     target.Character.Entity.Buffs.RemoveAll(item => item.Auras.Find(aura => aura.ModifierType == AuraType.Root) != null);
 }
        public override void Apply(ITargetable caster, ITargetable target, TimeSpan elapsedTime,
                                   SpellModificationInformation spellInfo, NetworkPlayerInterface playerUi)
        {
            int amount = modifier;

            amount += Mechanics.Roll(minValue, maxValue);

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

            if (spellInfo.DamageMultiplier != 0)
            {
                amount = (int)(amount * spellInfo.DamageMultiplier);
            }
            amount += (int)spellInfo.AdditionalDamage;
            if (spellInfo.IsCrit)
            {
                amount = (int)(amount * spellInfo.CriticalDamageMultiplierAddMod);
            }

            amount = (int)(amount * target.Character.Entity.IncomingDamageEfficiency);

            switch (damageType)
            {
            case DamageType.Physical:
                amount = (int)(amount * caster.Character.Entity.PhysicalDamageMulMod);
                break;

            case DamageType.Frost:
                amount = (int)(amount * caster.Character.Entity.FrostDamageMulMod);
                break;

            case DamageType.Fire:
                amount = (int)(amount * caster.Character.Entity.FireDamageMulMod);
                break;

            case DamageType.Arcane:
                amount = (int)(amount * caster.Character.Entity.ArcaneDamageMulMod);
                break;

            case DamageType.Nature:
                amount = (int)(amount * caster.Character.Entity.NatureDamageMulMod);
                break;

            case DamageType.Shadow:
                amount = (int)(amount * caster.Character.Entity.ShadowDamageMulMod);
                break;

            case DamageType.Holy:
                amount = (int)(amount * caster.Character.Entity.HolyDamageMulMod);
                break;
            }

            foreach (Buff buff in target.Character.Entity.Buffs)
            {
                if (buff.HasAbsorbAura)
                {
                    foreach (AuraBase auraAbsorb in buff.Auras)
                    {
                        amount = auraAbsorb.Absorb(damageType, amount, target.Character.Entity);
                        if (amount == 0)
                        {
                            if (caster.ID == playerUi.PlayerRef.ID)
                            {
                                playerUi.SkillDamageEvents.Add(new SkillDamageEvent(spellInfo.SpellName, "Absorb", 0, 0.7f, target, 50, false, spellInfo.IsCrit));
                            }
                            return;
                        }
                    }
                }
            }
            if (caster.ID == playerUi.PlayerRef.ID)
            {
                playerUi.SkillDamageEvents.Add(new SkillDamageEvent(spellInfo.SpellName, "", amount, 0.7f, target, 30, false, spellInfo.IsCrit));
            }
            target.Character.Entity.Health.Decrease((ushort)amount);
        }