Exemplo n.º 1
0
 public RegenerationBuff(int dur, int lvl, AnimatedSprite target) :
     base("Regeneration", dur, lvl, "Your wounds are healing", texture: TextureHelper.Blank(Color.LightPink))
 {
     Target  = target;
     OnStart = () =>
     {
         if (timer == null)
         {
             timer = new TimerHelper(
                 GameMathHelper.TimeToFrames(0.3f - (0.3f / 20f * (lvl - 1f))),
                 () => { Target.AddHealth(1 + (lvl / 2)); }
                 );
         }
     };
     OnEnd = () =>
     {
         timer?.Delete();
         timer = null;
     };
 }
Exemplo n.º 2
0
 public override void ProjectileAction(AnimatedSprite source, AnimatedSprite target)
 {
     target.AddHealth(-projectiledamage);
     Delete();
 }
Exemplo n.º 3
0
        public override void ProjectileAction(AnimatedSprite source, AnimatedSprite target)
        {
            switch (spellType)
            {
            // Fire Attack
            case Caster.SpellType.FIRE:
                target.AddHealth(-Damage);

                // Fire + Ice
                if (target.Buffs.HasBuff(typeof(SlowBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(SlowBuff));
                    FireIce(target);
                }

                // Fire + Wind
                else if (target.Buffs.HasBuff(typeof(DamageReductionBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(DamageReductionBuff));
                    FireWind(target);
                }

                // Fire + Earth
                else if (target.Buffs.HasBuff(typeof(DefenseReductionBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(DefenseReductionBuff));
                    FireEarth(target);
                }
                else
                {
                    target.Buffs.AddBuff(new BurningBuff(GameMathHelper.TimeToFrames(3), 1, target));
                }
                break;

            // Ice Attack
            case Caster.SpellType.ICE:
                target.AddHealth(-Damage);

                // Fire + Ice
                if (target.Buffs.HasBuff(typeof(BurningBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(BurningBuff));
                    FireIce(target);
                }

                // Ice + Wind
                else if (target.Buffs.HasBuff(typeof(DamageReductionBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(DamageReductionBuff));
                    IceWind(target);
                }

                // Ice + Earth
                else if (target.Buffs.HasBuff(typeof(DefenseReductionBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(DefenseReductionBuff));
                    IceEarth(target);
                }
                else
                {
                    target.Buffs.AddBuff(new SlowBuff(GameMathHelper.TimeToFrames(3), 2, target));
                }
                break;

            // Wind Attack
            case Caster.SpellType.WIND:
                target.AddHealth(-Damage);

                // Fire + Wind
                if (target.Buffs.HasBuff(typeof(BurningBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(BurningBuff));
                    FireWind(target);
                }

                // Ice + Wind
                else if (target.Buffs.HasBuff(typeof(SlowBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(SlowBuff));
                    IceWind(target);
                }

                // Wind + Earth
                else if (target.Buffs.HasBuff(typeof(DefenseReductionBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(DefenseReductionBuff));
                    WindEarth(target);
                }
                else
                {
                    target.Buffs.AddBuff(new DamageReductionBuff(GameMathHelper.TimeToFrames(3), 1, target));
                }
                break;

            // Earth Attack
            case Caster.SpellType.EARTH:
                target.AddHealth(-Damage);

                // Fire + Earth
                if (target.Buffs.HasBuff(typeof(BurningBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(BurningBuff));
                    FireEarth(target);
                }

                // Ice + Earth
                else if (target.Buffs.HasBuff(typeof(SlowBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(SlowBuff));
                    IceEarth(target);
                }

                // Wind + Earth
                else if (target.Buffs.HasBuff(typeof(DamageReductionBuff)))
                {
                    target.Buffs.RemoveBuff(typeof(DamageReductionBuff));
                    WindEarth(target);
                }
                else
                {
                    target.Buffs.AddBuff(new DefenseReductionBuff(GameMathHelper.TimeToFrames(3), 1, target));
                }
                break;

            default:
                target.AddHealth(-Damage);
                break;
            }

            Delete();
        }