Example #1
0
        public Point ProcessStepOn(Point position, ICreatureObject target, Point initialTargetPosition)
        {
            var damage = RandomHelper.GetRandomValue(MinDamage, MaxDamage);

            target.Damage(position, damage, Element.Piercing);
            CurrentGame.Journal.Write(new DealDamageMessage(this, target, damage, Element.Piercing), target);
            return(position);
        }
Example #2
0
        public static MovementResult MoveCreature(ICreatureObject creature, Point startPoint,
                                                  Direction direction, bool processStepReaction, bool changeDirection, bool avoidTraps)
        {
            if (changeDirection)
            {
                creature.Direction = direction;
            }
            var endPoint = Point.GetPointInDirection(startPoint, direction);

            return(MoveObject(creature, startPoint, endPoint, processStepReaction, avoidTraps));
        }
Example #3
0
        public CodeSpell(ICreatureObject caster, string name, string code, int mana)
            : base(name)
        {
            Mana               = mana;
            LightPower         = DefaultLightLevel;
            remainingLightTime = null;
            lifeTime           = 0;

            casterId     = caster.Id;
            this.code    = code;
            codeExecutor = new SpellCodeExecutor(caster.Id, code);

            animations = new AnimationsBatchManager(TimeSpan.FromMilliseconds(500), AnimationFrameStrategy.OneByOneStartFromRandom);
        }
Example #4
0
        public bool TryMove(ICreatureObject creature, Point position, Point targetPosition)
        {
            var possibleMoves = GetPossibleMoves(position, targetPosition);

            foreach (var possibleMove in possibleMoves)
            {
                var movementResult = MovementHelper.MoveCreature(creature, position, possibleMove, true, true, true);
                if (movementResult.Success)
                {
                    return(true);
                }
            }

            return(false);
        }
Example #5
0
        public static MovementResult MoveCreature(ICreatureObject creature, Point startPoint,
                                                  Point endPoint, bool processStepReaction, bool changeDirection, bool avoidTraps)
        {
            if (changeDirection)
            {
                var movementDirection = Point.GetAdjustedPointRelativeDirection(startPoint, endPoint);
                if (!movementDirection.HasValue)
                {
                    throw new ApplicationException("Unable to determine movement direction.");
                }
                creature.Direction = movementDirection.Value;
            }

            return(MoveObject(creature, startPoint, endPoint, processStepReaction, avoidTraps));
        }
Example #6
0
 public AttackDodgedMessage(ICreatureObject source, IDestroyableObject target)
 {
     this.source = source;
     this.target = target;
 }
Example #7
0
 public ShieldBlockedDamageMessage(ICreatureObject creature, int damage, Element element)
 {
     this.creature = creature;
     this.damage   = damage;
     this.element  = element;
 }
Example #8
0
 public CodeSpell CreateCodeSpell(ICreatureObject caster)
 {
     return(new CodeSpell(caster, Name, Code, ManaCost));
 }