示例#1
0
        protected Devastation(ISpellcaster caster, List <IDamageable> targets)
            : base(caster,
                   targets,
                   Devastation.dC,
                   new BlobsAnimation(targets.Select(t => ((Atom)t).Position).ToList(),
                                      4,
                                      Color.DarkGray))
        {
            var msg = new StringBuilder();

            msg.AppendFormat("{0} hits ", ((Atom)caster).Name);

            var sep = "";

            foreach (var target in targets)
            {
                msg.AppendFormat("{0}{1}",
                                 sep,
                                 ((Atom)target).Name);
                sep = " and ";
            }
            msg.AppendFormat(" with {0}", this.Name);

            ((Atom)caster).NotifyListeners(msg.ToString());
        }
示例#2
0
        public static FireOrb Create(ISpellcaster sender, IDamageable target)
        {
            // Line between sender and target
            var lineOfAction = new Line(((Atom)sender).Position, ((Atom)target).Position);
            // First blockable atom
            var actualTarget = target;

            foreach (Coord pt in lineOfAction)
            {
                var testedAtom = ((Atom)sender).Map[pt];
                if (testedAtom.Physical && !testedAtom.Walkable && testedAtom != sender)
                {
                    if (typeof(IDamageable).IsAssignableFrom(testedAtom.GetType()))
                    {
                        actualTarget = (IDamageable)testedAtom;
                    }
                    else
                    {
                        actualTarget = new FakeTarget(testedAtom.Name,
                                                      testedAtom.Symbol,
                                                      testedAtom.Color,
                                                      testedAtom.Position);
                    }

                    break;
                }
            }

            var missed = actualTarget != target;

            return(new FireOrb(sender, actualTarget, missed));
        }
示例#3
0
 public HealSpell(ISpellcaster launcher,
                  List <IDamageable> targets,
                  DamageCalculator dmg,
                  Animation animation = null)
     : base(launcher, animation)
 {
     this.targets = targets;
     this.dmg     = dmg;
 }
 protected CureLightWounds(ISpellcaster caster)
     : base(caster,
            new List <IDamageable> {
     (IDamageable)caster
 },
            CureLightWounds.dC,
            new GlowingAnimation((Atom)caster))
 {
     if (caster != null)
     {
         ((Atom)caster).NotifyListeners(String.Format("Uses {0}", Name));
     }
 }
示例#5
0
        protected FireOrb(ISpellcaster caster, IDamageable target, bool missedRealTarget)
            : base(caster,
                   new List <IDamageable>() { target },
                   FireOrb.dC,
                   new FireBallAnimation(((Atom)caster).Position, ((Atom)target).Position, Color.Red))
        {
            var msg = new StringBuilder();

            if (missedRealTarget)
            {
                msg.AppendFormat("{0} misses his target!", ((Atom)caster).Name);
            }

            msg.AppendFormat("{0} hits {1}{2} with {3}",
                             ((Atom)caster).Name,
                             missedRealTarget ? "instead " : "",
                             ((Atom)target).Name,
                             this.Name);

            ((Atom)caster).NotifyListeners(msg.ToString());
        }
示例#6
0
 public UtilitySpell(ISpellcaster launcher, Animation animation)
     : base(launcher, animation)
 {
 }
 public static CureLightWounds Create(ISpellcaster sender)
 {
     return(new CureLightWounds(sender));
 }
示例#8
0
 public Spell(ISpellcaster launcher, Animation animation)
 {
     this.Launcher  = launcher;
     this.animation = animation;
 }
示例#9
0
 public static Devastation Create(ISpellcaster sender, List <IDamageable> targets)
 {
     // Always hits
     return(new Devastation(sender, targets));
 }