Exemplo n.º 1
0
        void INotifyStanceChanged.StanceChanged(Actor self, AutoTarget autoTarget, UnitStance oldStance, UnitStance newStance)
        {
            // Cancel opportunity targets when switching to a more restrictive stance if they are no longer valid for auto-targeting
            if (newStance > oldStance || opportunityForceAttack)
            {
                return;
            }

            if (OpportunityTarget.Type == TargetType.Actor)
            {
                var a = OpportunityTarget.Actor;
                if (!autoTarget.HasValidTargetPriority(self, a.Owner, a.GetEnabledTargetTypes()))
                {
                    OpportunityTarget = Target.Invalid;
                }
            }
            else if (OpportunityTarget.Type == TargetType.FrozenActor)
            {
                var fa = OpportunityTarget.FrozenActor;
                if (!autoTarget.HasValidTargetPriority(self, fa.Owner, fa.TargetTypes))
                {
                    OpportunityTarget = Target.Invalid;
                }
            }
        }
            void IActivityNotifyStanceChanged.StanceChanged(Actor self, AutoTarget autoTarget, UnitStance oldStance, UnitStance newStance)
            {
                // Cancel non-forced targets when switching to a more restrictive stance if they are no longer valid for auto-targeting
                if (newStance > oldStance || forceAttack)
                {
                    return;
                }

                if (!autoTarget.HasValidTargetPriority(self, lastVisibleOwner, lastVisibleTargetTypes))
                {
                    attack.ClearRequestedTarget();
                }
            }
Exemplo n.º 3
0
            void IActivityNotifyStanceChanged.StanceChanged(Actor self, AutoTarget autoTarget, UnitStance oldStance, UnitStance newStance)
            {
                // Cancel non-forced targets when switching to a more restrictive stance if they are no longer valid for auto-targeting
                if (newStance > oldStance || forceAttack)
                {
                    return;
                }

                // If lastVisibleTarget is invalid we could never view the target in the first place, so we just drop it here too
                if (!lastVisibleTarget.IsValidFor(self) || !autoTarget.HasValidTargetPriority(self, lastVisibleOwner, lastVisibleTargetTypes))
                {
                    attack.ClearRequestedTarget();
                }
            }
Exemplo n.º 4
0
 protected override void Created(Actor self)
 {
     mobile     = self.TraitOrDefault <Mobile>();
     autoTarget = self.TraitOrDefault <AutoTarget>();
     base.Created(self);
 }