Пример #1
0
        public SelectArmamentPowerTarget(Actor self, string order, SupportPowerManager manager, FireArmamentPower power)
        {
            // Clear selection if using Left-Click Orders
            if (Game.Settings.Game.UseClassicMouseStyle)
            {
                manager.Self.World.Selection.Clear();
            }

            this.self    = self;
            this.manager = manager;
            this.order   = order;
            this.power   = power;

            instances = GetActualInstances(self, power);
        }
Пример #2
0
        IEnumerable <Tuple <Actor, WDist, WDist> > GetActualInstances(Actor self, FireArmamentPower power)
        {
            if (!power.FireArmamentPowerInfo.AllowMultiple)
            {
                var actorswithpower = self.World.ActorsWithTrait <FireArmamentPower>()
                                      .Where(x => x.Actor.Owner == self.Owner && x.Trait.FireArmamentPowerInfo.OrderName.Contains(power.FireArmamentPowerInfo.OrderName));
                foreach (var a in actorswithpower)
                {
                    yield return(Tuple.Create(a.Actor,
                                              a.Trait.Armaments.Where(x => !x.IsTraitDisabled).Min(x => x.Weapon.MinRange),
                                              a.Trait.Armaments.Where(x => !x.IsTraitDisabled).Max(x => x.Weapon.Range)));
                }
            }
            else
            {
                yield return(Tuple.Create(self,
                                          power.Armaments.Where(x => !x.IsTraitDisabled).Min(a => a.Weapon.MinRange),
                                          power.Armaments.Where(x => !x.IsTraitDisabled).Max(a => a.Weapon.Range)));
            }

            yield break;
        }
		IEnumerable<Tuple<Actor, WDist, WDist>> GetActualInstances(Actor self, FireArmamentPower power)
		{
			if (!power.FireArmamentPowerInfo.AllowMultiple)
			{
				var actorswithpower = self.World.ActorsWithTrait<FireArmamentPower>()
					.Where(x => x.Actor.Owner == self.Owner && x.Trait.FireArmamentPowerInfo.OrderName.Contains(power.FireArmamentPowerInfo.OrderName));
				foreach (var a in actorswithpower)
				{
					yield return Tuple.Create(a.Actor,
						a.Trait.Armaments.Where(x => !x.IsTraitDisabled).Min(x => x.Weapon.MinRange),
						a.Trait.Armaments.Where(x => !x.IsTraitDisabled).Max(x => x.Weapon.Range));
				}
			}
			else
			{
				yield return Tuple.Create(self,
					power.Armaments.Where(x => !x.IsTraitDisabled).Min(a => a.Weapon.MinRange),
					power.Armaments.Where(x => !x.IsTraitDisabled).Max(a => a.Weapon.Range));
			}

			yield break;
		}
		public SelectArmamentPowerTarget(Actor self, string order, SupportPowerManager manager, FireArmamentPower power)
		{
			// Clear selection if using Left-Click Orders
			if (Game.Settings.Game.UseClassicMouseStyle)
				manager.Self.World.Selection.Clear();

			this.self = self;
			this.manager = manager;
			this.order = order;
			this.power = power;

			instances = GetActualInstances(self, power);
		}