Example #1
0
        public LeapAttack(Actor self, Target target, bool allowMovement, bool forceAttack, AttackLeap attack, AttackLeapInfo info)
        {
            this.target        = target;
            this.info          = info;
            this.attack        = attack;
            this.allowMovement = allowMovement;
            this.forceAttack   = forceAttack;
            mobile             = self.Trait <Mobile>();

            // The target may become hidden between the initial order request and the first tick (e.g. if queued)
            // Moving to any position (even if quite stale) is still better than immediately giving up
            if ((target.Type == TargetType.Actor && target.Actor.CanBeViewedByPlayer(self.Owner)) ||
                target.Type == TargetType.FrozenActor || target.Type == TargetType.Terrain)
            {
                lastVisibleTarget   = Target.FromPos(target.CenterPosition);
                lastVisibleMinRange = attack.GetMinimumRangeVersusTarget(target);
                lastVisibleMaxRange = attack.GetMaximumRangeVersusTarget(target);

                if (target.Type == TargetType.Actor)
                {
                    lastVisibleOwner       = target.Actor.Owner;
                    lastVisibleTargetTypes = target.Actor.GetEnabledTargetTypes();
                }
                else if (target.Type == TargetType.FrozenActor)
                {
                    lastVisibleOwner       = target.FrozenActor.Owner;
                    lastVisibleTargetTypes = target.FrozenActor.TargetTypes;
                }
            }
        }
Example #2
0
 public Leap(Actor self, Target target, Mobile mobile, Mobile targetMobile, int speed, AttackLeap attack, EdibleByLeap edible)
 {
     this.mobile       = mobile;
     this.targetMobile = targetMobile;
     this.attack       = attack;
     this.target       = target;
     this.edible       = edible;
     this.speed        = speed;
 }