public void AddShip(Ship ship) { ushort[] skills1 = new ushort[ship.Skills.Length]; for (ushort i = 0; i < skills1.Length; i++) { skills1[i] = 1; } MyShip newShip = new MyShip { Id = ship.Id, HullType = ship.HullType, Rarity = ship.Rarity, CurrentStat = ship.Stats.BaseStats, SKillLvs = skills1 }; MyList.Add(newShip); ShipDataLists.Add(new ShipDataList { MyShip = newShip, Ship = ship }); ShipDataLists = ShipDataLists.OrderByDescending(x => x.MyShip.Lv).ToList(); FilterListStat = ShipDataLists; RaisePropertyChanged("FilterListStat"); WriteJson(); }
private void BuyMenu() { Console.WriteLine(); Console.WriteLine("What would you like to buy?"); Console.WriteLine($"1 = {MyShip.GetLocation()} item: 175 credits / each"); // automatically names item in form "{location} + item" Console.WriteLine("2 = Fuel: 75 credits / 250 units"); Console.WriteLine(); try { switch (int.Parse(Console.ReadLine())) { case 1: BuyItem(); break; case 2: BuyFuel(); break; default: TradeError(); break; } Console.WriteLine(); } catch (Exception) { TradeError(); } }
private void RenderShip(MyShip ship) { Model model = fShipModel; Matrix view = fViewCamera.Camera.ViewMatrix; Matrix projection = fViewCamera.Camera.ProjectionMatrix; GraphicsDevice.BlendState = BlendState.Opaque; GraphicsDevice.DepthStencilState = DepthStencilState.Default; GraphicsDevice.RasterizerState = RasterizerState.CullNone; GraphicsDevice.SamplerStates[0] = SamplerState.LinearClamp; var rotation = Matrix.CreateFromQuaternion(fShipCamera.Camera.Rotation);// * Matrix.CreateRotationX(PI / -2); var world = Matrix.CreateScale(MODEL_SIZE) * rotation * Matrix.CreateTranslation(ship.Position + fShipCamera.Camera.Position); foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.View = view; effect.Projection = projection; effect.World = world; effect.EnableDefaultLighting(); effect.PreferPerPixelLighting = true; } mesh.Draw(); } }
public override bool DoAction() { IModule module = new MyShip().Module(base.SlotType, base.SlotIndex); module?.Activate(); return(module != null); }
public void onCreate(MyShip parentShip, int x, int y, int z) { // インスタンス化時の初期化処理とか。 this.parentShip = parentShip; this.x = x; this.y = y; this.z = z; }
private void AddShip() { int x = fRandom.Next(-SPACE_SIZE, SPACE_SIZE); int y = fRandom.Next(-SPACE_SIZE, SPACE_SIZE); int z = fRandom.Next(-SPACE_SIZE, SPACE_SIZE); var ship = new MyShip() { Position = new Vector3(x, y, z) }; fShips.Add(ship); }
protected override void PopulateItems(ref Dictionary <ShipSlot, IModule> cache) { using (new FrameLock(true)) { MyShip myShip = new MyShip(); foreach (ShipSlot slot in ShipSlot.AllSlots) { IModule mod = myShip.Module(slot.SlotType, slot.SlotNumber); cache[slot] = mod; } } }
/// <summary> /// Initializes a new instance of the <see cref="LevelOne" /> class. /// </summary> public LevelOne() { // Backgrounds FileName = @"Assets\LevelOne.png"; // Enemies for (int i = 0; i < 5; i++) { var ship = new Ship(this); int positionY = ship.Height + 10; int positionX = 150 + i * (ship.Width + 50); ship.Position = new Point(positionX, positionY); Actors.Add(ship); } InitTimer(); //myship for (int i = 0; i < 4; i++) { var myship = new MyShip(this); int positionY = myship.Height + 50; int positionX = 150 + i * (myship.Width + 50); myship.Direction = i < 2; myship.Position = new Point(positionX, positionY); Actors.Add(myship); } //Lightning var Lightning = new Lightning(this); int lightningPositionX = Size.Width / 2 - Lightning.Width / 2; int lightningPositionY = Size.Height / 2 - Lightning.Height / 2; Lightning.Position = new Point(lightningPositionX, lightningPositionY); Actors.Add(Lightning); // Player Player = new PlayerShip(this); int playerPositionX = Size.Width / 2 - Player.Width / 2; int playerPositionY = Size.Height - Player.Height - 50; Player.Position = new Point(playerPositionX, playerPositionY); Actors.Add(Player); }
private void AddShip() { int x = fRandom.Next(-SPACE_SIZE, SPACE_SIZE); int y = fRandom.Next(-SPACE_SIZE, SPACE_SIZE); int z = fRandom.Next(-SPACE_SIZE, SPACE_SIZE); var ship = new MyShip() { Position = new Vector3(x, y, z), Velocity = (float)(1.0f + 25.0 * fRandom.NextDouble()), AngleSpeedX = (float)(fRandom.NextDouble() - 0.5f) / 400.0f, AngleSpeedY = (float)(fRandom.NextDouble() - 0.5f) / 30.0f, AngleSpeedZ = (float)(fRandom.NextDouble() - 0.5f) / 400.0f, }; fShips.Add(ship); }
private void BuyFuel() { if (MyShip.GetFuelLevel() < MyShip.GetFuelCapacity()) { Cargo.ChangeCredits(-75); MyShip.ChangeFuel(250); // fuel capacity enforced within Ship.ChangeFuel() Console.Clear(); Console.WriteLine("Fuel purchased."); } else { Console.Clear(); Console.WriteLine("You're tank is full"); } Console.WriteLine($"Credits = {Cargo.GetCredits()}"); Console.WriteLine($" Fuel = {MyShip.GetFuelLevel()}/{MyShip.GetFuelCapacity()}"); }
//private void shipSelector() //{ // try // { // int option = int.Parse(Console.ReadLine()); // if (option == 1 && credits >= 10) // { // if (cargoWeight > 200) // { // Console.WriteLine(); // Console.WriteLine("You have more cargo than this ship can hold. Go sell some stuff and try again."); // Console.WriteLine(); // } // else // { // ship = 1; // fuel = 100; // fuelCapacity = 100; // cargoCapacity = 200; // credits -= 10; // Console.WriteLine(); // Console.WriteLine("You are now the proud owner of a helium balloon."); // } // } // else if (option == 2 && credits >= 4200) // { // if (cargoWeight > 3000) // { // Console.WriteLine(); // Console.WriteLine("You have more cargo than this ship can hold. Go sell some stuff and try again."); // Console.WriteLine(); // } // else // { // ship = 2; // fuel = 1500; // fuelCapacity = 1500; // cargoCapacity = 3000; // credits -= 4200; // Console.WriteLine(); // Console.WriteLine("Welcome aboard the Reasonable Rocketship. You got a great deal."); // } // } // else if (option == 3 && credits >= 15000) // { // if (cargoWeight > 20000) // { // Console.WriteLine(); // Console.WriteLine("You have more cargo than this ship can hold. Go sell some stuff and try again."); // Console.WriteLine(); // } // else // { // ship = 3; // fuel = 999999999; // fuelCapacity = 999999999; // cargoCapacity = 20000; // credits -= 15000; // Console.WriteLine(); // Console.WriteLine("You are now Captain of Malaysia Airlines Flight 370. Don't travel to year 2014. They're looking for you there."); // } // } // else // { // mainError(); // } // } // catch (Exception) // { // mainError(); // } //} // not yet implemented private void SellMenu() { Console.WriteLine(); Console.WriteLine("What would you like to sell?"); // the +1/-1 expressions enforce unique economies among three planets. Console.WriteLine($"1 = earthItem for {Earth.GetPrice(MyShip.GetPlanetID())} credits"); Console.WriteLine($"2 = acItem for {Earth.GetPrice(MyShip.GetPlanetID() - 1)} credits"); Console.WriteLine($"3 = mpItem for {Earth.GetPrice(MyShip.GetPlanetID() + 1)} credits"); Console.WriteLine(); try { SellItem(int.Parse(Console.ReadLine())); } catch (Exception) { TradeError(); } }
public bool CanActivate() { IModule mod = GetRaw(); if (mod == null || !mod.IsValid) { return(false); } double?activationCost = mod.ActivationCost; if (activationCost != null) { double currrentCapacitor = new MyShip().Capacitor; return(activationCost < currrentCapacitor ? true : false); } else { return(false); } }
private void UpdateShip(GameTime gameTime, MyShip ship) { float delta = (float)gameTime.ElapsedGameTime.TotalSeconds; if (delta > 0.1f) { delta = 0.1f; } float timeFactor = 100.0f * delta; float angleSpeedAdd = 0.0002f * timeFactor; float angleSpeedMult = 1.0f - (0.1f * timeFactor); float maxAngleChange = 0.05f; float velocitySpeedMult = 1.0f - (0.1f * timeFactor); float velocitySpeedAdd = 0.5f * timeFactor; bool updateCamera = false; bool angleChanged = false; if (ship.Velocity < -0.001f || ship.Velocity > 0.001f) { Quaternion quat = ship.Rotation; Vector3 forwardDirection = Vector3.Transform(Vector3.Up, quat); ship.Position += timeFactor * ship.Velocity * forwardDirection; updateCamera = true; } Quaternion rotationChange = Quaternion.CreateFromAxisAngle(Vector3.Left, timeFactor * ship.AngleSpeedX) * //pitch Quaternion.CreateFromAxisAngle(Vector3.Down, timeFactor * ship.AngleSpeedY) * // yaw Quaternion.CreateFromAxisAngle(Vector3.Forward, timeFactor * ship.AngleSpeedZ); // roll ship.Rotation = rotationChange * ship.Rotation; // Move Ship //ship.Move(gameTime); }
private void BuyItem() { Console.WriteLine(); Console.WriteLine("How many would you like to buy"); int quantity = SetQuantity(); // enforces cargo capacity if (Cargo.GetCargoWeight() <= (Cargo.GetCargoCapacity() - (150 * quantity)) && quantity > 0 && quantity <= 10) { // deducts credits Cargo.ChangeCredits(-175 * quantity); // first parameter selects location dependent item Cargo.ChangeItem(MyShip.GetItemID(), quantity); // adds weight to cargo Cargo.ChangeWeight(150 * quantity); Console.Clear(); Console.WriteLine($"Item purchased. Current credits = {Cargo.GetCredits()}."); } else { WeightError(); } }
private void UpdateShip(GameTime gameTime, MyShip ship) { // All done in fShipCamera }
bool Control(object[] Params) { if (!Session.InSpace || Config.Mode == Mode.None) { return(false); } // If we're warping and drones are in space, recall them and stop the module if (MyShip.ToEntity.Mode == EntityMode.Warping && Drone.AllInSpace.Any()) { Drone.AllInSpace.ReturnToDroneBay(); return(true); } if (MyShip.DronesToReconnect && MyShip.DroneBay.UsedCapacity < MyShip.DroneBay.MaxCapacity && MyShip.ToEntity.GroupID != Group.Capsule && TryReconnect) { MyShip.ReconnectToDrones(); DislodgeWaitFor(2); TryReconnect = false; return(false); } if (!Rats.TargetList.Any() && !Entity.All.Any(a => PriorityTargets.Contains(a.Name)) && !Config.StayDeployedWithNoTargets) { List <Drone> Recall = Drone.AllInSpace.Where(a => DroneReady(a) && a.State != EntityState.Departing).ToList(); // Recall drones if (Recall.Any()) { Console.Log("|oRecalling drones"); Console.Log(" |-gNo rats available"); Recall.ReturnToDroneBay(); Recall.ForEach(a => NextDroneCommand.AddOrUpdate(a, DateTime.Now.AddSeconds(5))); return(false); } } if (Config.Mode == Mode.AFKHeavy && (Rats.TargetList.Any() || Entity.All.Any(a => PriorityTargets.Contains(a.Name)))) { int AvailableSlots = ((MyShip.ToEntity.TypeID == 17918 /* Rattlesnake */) ? 2 : Me.MaxActiveDrones) - Drone.AllInSpace.Count(); List <Drone> Deploy = Drone.AllInBay.Where(a => Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group == "Heavy Attack Drones")).Take(AvailableSlots).ToList(); // Launch drones if (Deploy.Any()) { Console.Log("|oLaunching drones"); Deploy.Launch(); Deploy.ForEach(a => NextDroneCommand.AddOrUpdate(a, DateTime.Now.AddSeconds(5))); } return(false); } foreach (Drone d in Drone.AllInBay) { if (DroneHealthCache.ContainsKey(d)) { DroneHealthCache.Remove(d); } } foreach (Drone d in Drone.AllInSpace) { double health = d.ToEntity.ShieldPct + d.ToEntity.ArmorPct + d.ToEntity.HullPct; if (!DroneHealthCache.ContainsKey(d)) { DroneHealthCache.Add(d, health); } if (health < DroneHealthCache[d]) { DroneCooldown.Add(d); } } List <Drone> RecallDamaged = Drone.AllInSpace.Where(a => DroneCooldown.Contains(a) && DroneReady(a) && a.State != EntityState.Departing).ToList(); if (RecallDamaged.Any()) { Console.Log("|oRecalling damaged drones"); RecallDamaged.ReturnToDroneBay(); RecallDamaged.ForEach(a => NextDroneCommand.AddOrUpdate(a, DateTime.Now.AddSeconds(5))); return(false); } Entity WarpScrambling = SecurityCore.ValidScramble; Entity Neuting = SecurityCore.ValidNeuter; #region ActiveTarget selection Double MaxRange = (Config.Mode == Mode.PointDefense) ? 20000 : Me.DroneControlDistance; if (WarpScrambling != null) { if (ActiveTarget != WarpScrambling && WarpScrambling.Distance < MaxRange) { Console.Log("|rEntity on grid is/was warp scrambling!"); Console.Log("|oOveriding current drone target"); Console.Log(" |-g{0}", WarpScrambling.Name); ActiveTarget = WarpScrambling; return(false); } } else if (Neuting != null) { if (ActiveTarget != Neuting && Neuting.Distance < MaxRange) { Console.Log("|rEntity on grid is/was neuting!"); Console.Log("|oOveriding current drone target"); Console.Log(" |-g{0}", Neuting.Name); ActiveTarget = Neuting; return(false); } } if (ActiveTarget == null || !ActiveTarget.Exists || ActiveTarget.Exploded || ActiveTarget.Released) { ActiveTarget = null; ActiveTarget = Entity.All.FirstOrDefault(a => PriorityTargets.Contains(a.Name) && !a.Exploded && !a.Released && (a.LockedTarget || a.LockingTarget) && !Triggers.Contains(a.Name) && a.Distance < MaxRange); if (Rats.LockedAndLockingTargetList.Any() && ActiveTarget == null) { if (Config.PrivateTargets) { if (Config.SharedTargets) { ActiveTarget = Rats.LockedAndLockingTargetList.FirstOrDefault(a => IPC.ActiveTargets.ContainsValue(a.ID) && a.Distance < MaxRange); } else { ActiveTarget = Rats.LockedAndLockingTargetList.FirstOrDefault(a => !IPC.ActiveTargets.ContainsValue(a.ID) && a.Distance < MaxRange); } } if (ActiveTarget == null && OutOfTargets) { ActiveTarget = Rats.LockedAndLockingTargetList.FirstOrDefault(a => a.Distance < MaxRange); } if (ActiveTarget != null) { IPC.Relay(Me.CharID, ActiveTarget.ID); } } } #endregion #region LockManagement TargetCooldown = TargetCooldown.Where(a => a.Value >= DateTime.Now).ToDictionary(a => a.Key, a => a.Value); Rats.LockedAndLockingTargetList.ForEach(a => { TargetCooldown.AddOrUpdate(a, DateTime.Now.AddSeconds(2)); }); if (WarpScrambling != null) { if (!WarpScrambling.LockedTarget && !WarpScrambling.LockingTarget) { if (Rats.LockedAndLockingTargetList.Count >= Me.TrueMaxTargetLocks) { if (Rats.LockedTargetList.Any()) { Rats.LockedTargetList.First().UnlockTarget(); } return(false); } WarpScrambling.LockTarget(); return(false); } } else if (Neuting != null) { if (!Neuting.LockedTarget && !Neuting.LockingTarget) { if (Rats.LockedAndLockingTargetList.Count >= Me.TrueMaxTargetLocks) { if (Rats.LockedTargetList.Any()) { Rats.LockedTargetList.First().UnlockTarget(); } return(false); } Neuting.LockTarget(); return(false); } } else { Entity NewTarget = Entity.All.FirstOrDefault(a => !a.LockedTarget && !a.LockingTarget && PriorityTargets.Contains(a.Name) && a.Distance < MyShip.MaxTargetRange && !TargetCooldown.ContainsKey(a) && !Triggers.Contains(a.Name)); if (NewTarget == null) { NewTarget = Rats.UnlockedTargetList.FirstOrDefault(a => !TargetCooldown.ContainsKey(a) && a.Distance < MyShip.MaxTargetRange); } if (Rats.LockedAndLockingTargetList.Count < Config.TargetSlots && NewTarget != null && Entity.All.FirstOrDefault(a => a.IsJamming && a.IsTargetingMe) == null) { Console.Log("|oLocking"); Console.Log(" |-g{0}", NewTarget.Name); TargetCooldown.AddOrUpdate(NewTarget, DateTime.Now.AddSeconds(2)); NewTarget.LockTarget(); OutOfTargets = false; return(false); } } OutOfTargets = true; #endregion // Make sure ActiveTarget is locked. If so, make sure it's the active target, if not, return. if (ActiveTarget != null && ActiveTarget.Exists && ActiveTarget.LockedTarget) { if (!ActiveTarget.IsActiveTarget) { ActiveTarget.MakeActive(); return(false); } } else { if (ActiveTarget == null) { List <Drone> Recall = Drone.AllInSpace.Where(a => !DroneCooldown.Contains(a) && DroneReady(a) && a.State != EntityState.Departing).ToList(); // Recall drones if in point defense and no frig/destroyers in range if (Recall.Any() && !Config.StayDeployedWithNoTargets) { Console.Log("|oRecalling drones"); Recall.ReturnToDroneBay(); Recall.ForEach(a => NextDroneCommand.AddOrUpdate(a, DateTime.Now.AddSeconds(5))); } } return(false); } // Handle Attacking small targets - this should work for PointDefense AND Sentry if (ActiveTarget.Distance < 20000 && (Config.Mode == Mode.PointDefense || Config.Mode == Mode.Sentry)) { // Is the target a small target? if (SmallTarget(ActiveTarget)) { // Recall sentries List <Drone> Recall = Drone.AllInSpace.Where(a => !DroneCooldown.Contains(a) && DroneReady(a) && Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group != "Light Scout Drones") && a.State != EntityState.Departing).ToList(); if (Recall.Any()) { Console.Log("|oRecalling non scout drones"); Recall.ReturnToDroneBay(); Recall.ForEach(a => NextDroneCommand.AddOrUpdate(a, DateTime.Now.AddSeconds(5))); return(false); } // Send drones to attack List <Drone> Attack = Drone.AllInSpace.Where(a => !DroneCooldown.Contains(a) && DroneReady(a) && Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group == "Light Scout Drones") && (a.State != EntityState.Combat || a.Target == null || a.Target != ActiveTarget)).ToList(); if (Attack.Any()) { Console.Log("|oSending scout drones to attack"); Attack.Attack(); Attack.ForEach(a => NextDroneCommand.AddOrUpdate(a, DateTime.Now.AddSeconds(3))); return(false); } int AvailableSlots = ((MyShip.ToEntity.TypeID == 17918 /* Rattlesnake */) ? 2 : Me.MaxActiveDrones) - Drone.AllInSpace.Count(); List <Drone> Deploy = Drone.AllInBay.Where(a => !DroneCooldown.Contains(a) && Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group == "Light Scout Drones")).Take(AvailableSlots).ToList(); List <Drone> DeployIgnoreCooldown = Drone.AllInBay.Where(a => Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group == "Light Scout Drones")).Take(AvailableSlots).ToList(); // Launch drones if (Deploy.Any()) { Console.Log("|oLaunching scout drones"); Deploy.Launch(); Deploy.ForEach(a => NextDroneCommand.AddOrUpdate(a, DateTime.Now.AddSeconds(3))); return(false); } else if (AvailableSlots > 0 && DeployIgnoreCooldown.Any()) { DroneCooldown.Clear(); } } else if (Config.Mode == Mode.PointDefense) { List <Drone> Recall = Drone.AllInSpace.Where(a => !DroneCooldown.Contains(a) && DroneReady(a) && a.State != EntityState.Departing).ToList(); // Recall drones if in point defense and no frig/destroyers in range if (Recall.Any()) { Console.Log("|oRecalling drones"); Recall.ReturnToDroneBay(); Recall.ForEach(a => NextDroneCommand.AddOrUpdate(a, DateTime.Now.AddSeconds(5))); return(false); } } } // Handle Attacking anything if in AgressiveScout mode if (Config.Mode == Mode.AgressiveScout) { // Recall sentries List <Drone> Recall = Drone.AllInSpace.Where(a => !DroneCooldown.Contains(a) && DroneReady(a) && Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group != "Light Scout Drones") && a.State != EntityState.Departing).ToList(); if (Recall.Any()) { Console.Log("|oRecalling non scout drones"); Recall.ReturnToDroneBay(); Recall.ForEach(a => NextDroneCommand.AddOrUpdate(a, DateTime.Now.AddSeconds(5))); return(false); } // Send drones to attack List <Drone> Attack = Drone.AllInSpace.Where(a => !DroneCooldown.Contains(a) && DroneReady(a) && Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group == "Light Scout Drones") && (a.State != EntityState.Combat || a.Target == null || a.Target != ActiveTarget)).ToList(); if (Attack.Any()) { Console.Log("|oSending scout drones to attack"); Attack.Attack(); Attack.ForEach(a => NextDroneCommand.AddOrUpdate(a, DateTime.Now.AddSeconds(3))); return(false); } int AvailableSlots = Me.MaxActiveDrones - Drone.AllInSpace.Count(); List <Drone> Deploy = Drone.AllInBay.Where(a => !DroneCooldown.Contains(a) && Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group == "Light Scout Drones")).Take(AvailableSlots).ToList(); List <Drone> DeployIgnoreCooldown = Drone.AllInBay.Where(a => Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group == "Light Scout Drones")).Take(AvailableSlots).ToList(); // Launch drones if (Deploy.Any()) { Console.Log("|oLaunching scout drones"); Deploy.Launch(); Deploy.ForEach(a => NextDroneCommand.AddOrUpdate(a, DateTime.Now.AddSeconds(3))); return(false); } else if (AvailableSlots > 0 && DeployIgnoreCooldown.Any()) { DroneCooldown.Clear(); } } // Handle Attacking anything if in AgressiveMedium mode if (Config.Mode == Mode.AgressiveMedium) { // Recall sentries List <Drone> Recall = Drone.AllInSpace.Where(a => !DroneCooldown.Contains(a) && DroneReady(a) && Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group != "Medium Scout Drones") && a.State != EntityState.Departing).ToList(); if (Recall.Any()) { Console.Log("|oRecalling non medium drones"); Recall.ReturnToDroneBay(); Recall.ForEach(a => NextDroneCommand.AddOrUpdate(a, DateTime.Now.AddSeconds(5))); return(false); } // Send drones to attack List <Drone> Attack = Drone.AllInSpace.Where(a => !DroneCooldown.Contains(a) && DroneReady(a) && Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group == "Medium Scout Drones") && (a.State != EntityState.Combat || a.Target == null || a.Target != ActiveTarget)).ToList(); if (Attack.Any()) { Console.Log("|oSending medium drones to attack"); Attack.Attack(); Attack.ForEach(a => NextDroneCommand.AddOrUpdate(a, DateTime.Now.AddSeconds(3))); return(false); } int AvailableSlots = ((MyShip.ToEntity.TypeID == 17715 /* Gila */) ? 2 : Me.MaxActiveDrones) - Drone.AllInSpace.Count(); List <Drone> Deploy = Drone.AllInBay.Where(a => !DroneCooldown.Contains(a) && Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group == "Medium Scout Drones")).Take(AvailableSlots).ToList(); List <Drone> DeployIgnoreCooldown = Drone.AllInBay.Where(a => Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group == "Medium Scout Drones")).Take(AvailableSlots).ToList(); // Launch drones if (Deploy.Any()) { Console.Log("|oLaunching medium drones"); Deploy.Launch(); Deploy.ForEach(a => NextDroneCommand.AddOrUpdate(a, DateTime.Now.AddSeconds(3))); return(false); } else if (AvailableSlots > 0 && DeployIgnoreCooldown.Any()) { DroneCooldown.Clear(); } } // Handle Attacking anything if in AgressiveHeavy mode if (Config.Mode == Mode.AgressiveHeavy) { // Recall non heavy List <Drone> Recall = Drone.AllInSpace.Where(a => !DroneCooldown.Contains(a) && DroneReady(a) && Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group != "Heavy Attack Drones") && a.State != EntityState.Departing).ToList(); if (Recall.Any()) { Console.Log("|oRecalling non heavy drones"); Recall.ReturnToDroneBay(); Recall.ForEach(a => NextDroneCommand.AddOrUpdate(a, DateTime.Now.AddSeconds(5))); return(false); } // Send drones to attack List <Drone> Attack = Drone.AllInSpace.Where(a => !DroneCooldown.Contains(a) && DroneReady(a) && Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group == "Heavy Attack Drones") && (a.State != EntityState.Combat || a.Target == null || a.Target != ActiveTarget)).ToList(); if (Attack.Any()) { Console.Log("|oSending heavy drones to attack"); Attack.Attack(); Attack.ForEach(a => NextDroneCommand.AddOrUpdate(a, DateTime.Now.AddSeconds(3))); return(false); } int AvailableSlots = ((MyShip.ToEntity.TypeID == 17918 /* Rattlesnake */) ? 2 : Me.MaxActiveDrones) - Drone.AllInSpace.Count(); List <Drone> Deploy = Drone.AllInBay.Where(a => !DroneCooldown.Contains(a) && Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group == "Heavy Attack Drones")).Take(AvailableSlots).ToList(); List <Drone> DeployIgnoreCooldown = Drone.AllInBay.Where(a => Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group == "Heavy Attack Drones")).Take(AvailableSlots).ToList(); // Launch drones if (Deploy.Any()) { Console.Log("|oLaunching heavy drones"); Deploy.Launch(); Deploy.ForEach(a => NextDroneCommand.AddOrUpdate(a, DateTime.Now.AddSeconds(3))); return(false); } else if (AvailableSlots > 0 && DeployIgnoreCooldown.Any()) { DroneCooldown.Clear(); } } // Handle Attacking anything if in AgressiveSentry mode if (Config.Mode == Mode.AgressiveSentry) { // Recall non heavy List <Drone> Recall = Drone.AllInSpace.Where(a => !DroneCooldown.Contains(a) && DroneReady(a) && Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group != "Sentry Drones") && a.State != EntityState.Departing).ToList(); if (Recall.Any()) { Console.Log("|oRecalling non sentry drones"); Recall.ReturnToDroneBay(); Recall.ForEach(a => NextDroneCommand.AddOrUpdate(a, DateTime.Now.AddSeconds(5))); return(false); } // Send drones to attack List <Drone> Attack = Drone.AllInSpace.Where(a => !DroneCooldown.Contains(a) && DroneReady(a) && Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group == "Sentry Drones") && (a.State != EntityState.Combat || a.Target == null || a.Target != ActiveTarget)).ToList(); if (Attack.Any()) { Console.Log("|oSending sentry drones to attack"); Attack.Attack(); Attack.ForEach(a => NextDroneCommand.AddOrUpdate(a, DateTime.Now.AddSeconds(3))); return(false); } int AvailableSlots = ((MyShip.ToEntity.TypeID == 17918 /* Rattlesnake */) ? 2 : Me.MaxActiveDrones) - Drone.AllInSpace.Count(); List <Drone> Deploy = Drone.AllInBay.Where(a => !DroneCooldown.Contains(a) && Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group == "Sentry Drones")).Take(AvailableSlots).ToList(); List <Drone> DeployIgnoreCooldown = Drone.AllInBay.Where(a => Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group == "Sentry Drones")).Take(AvailableSlots).ToList(); // Launch drones if (Deploy.Any()) { Console.Log("|oLaunching sentry drones"); Deploy.Launch(); Deploy.ForEach(a => NextDroneCommand.AddOrUpdate(a, DateTime.Now.AddSeconds(3))); return(false); } else if (AvailableSlots > 0 && DeployIgnoreCooldown.Any()) { DroneCooldown.Clear(); } } // Handle managing sentries if (ActiveTarget.Distance < MaxRange && Config.Mode == Mode.Sentry) { // Is the target a small target? if (!SmallTarget(ActiveTarget) || ActiveTarget.Distance > 20000) { List <Drone> Recall = Drone.AllInSpace.Where(a => !DroneCooldown.Contains(a) && DroneReady(a) && Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group != "Sentry Drones") && a.State != EntityState.Departing).ToList(); // Recall non sentries if (Recall.Any()) { Console.Log("|oRecalling drones"); Recall.ReturnToDroneBay(); Recall.ForEach(a => NextDroneCommand.AddOrUpdate(a, DateTime.Now.AddSeconds(5))); return(false); } List <Drone> Attack = Drone.AllInSpace.Where(a => !DroneCooldown.Contains(a) && DroneReady(a) && Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group == "Sentry Drones") && (a.State != EntityState.Combat || a.Target == null || a.Target != ActiveTarget)).ToList(); // Send drones to attack if (Attack.Any()) { Console.Log("|oOrdering sentry drones to attack"); Attack.Attack(); Attack.ForEach(a => NextDroneCommand.AddOrUpdate(a, DateTime.Now.AddSeconds(3))); return(false); } int AvailableSlots = ((MyShip.ToEntity.TypeID == 17918) ? 2 : Me.MaxActiveDrones) - Drone.AllInSpace.Count(); List <Drone> Deploy = Drone.AllInBay.Where(a => !DroneCooldown.Contains(a) && Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group == "Sentry Drones")).Take(AvailableSlots).ToList(); List <Drone> DeployIgnoreCooldown = Drone.AllInBay.Where(a => Data.DroneType.All.Any(b => b.ID == a.TypeID && b.Group == "Sentry Drones")).Take(AvailableSlots).ToList(); // Launch drones if (Deploy.Any()) { Console.Log("|oLaunching sentry drones"); Deploy.Launch(); Deploy.ForEach(a => NextDroneCommand.AddOrUpdate(a, DateTime.Now.AddSeconds(3))); return(false); } else if (AvailableSlots > 0 && DeployIgnoreCooldown.Any()) { DroneCooldown.Clear(); } } } return(false); }
// parameter is input by user to determine which item is being sold. private void SellItem(int action) { Console.WriteLine(); Console.WriteLine("How many would you like to sell?"); Console.WriteLine(); int quantity = SetQuantity(); switch (action) { // case for earth item case 1: // enforces current existence within cargo inventory if (Cargo.GetItemQuant(0) >= quantity) { // enforces unique economy Cargo.ChangeCredits(Earth.GetPrice(MyShip.GetPlanetID()) * quantity); // adds to lifetime earnings to be displayed at end of game Cargo.ChangeTotalEarned(Earth.GetPrice(0) * quantity); // removes sold item(s) from cargo inventory Cargo.ChangeItem(0, -quantity); // removes weight from cargo Cargo.ChangeWeight(150 * -quantity); Console.Clear(); Console.WriteLine($"Item sold. Credits = {Cargo.GetCredits()}"); } else { SellError(); } break; // case to sell ac item. See above for general case statement notes. case 2: if (Cargo.GetItemQuant(1) >= quantity) { // enforces unique economy. Notice the -1 modifier as opposed to the other cases. Cargo.ChangeCredits(Earth.GetPrice(MyShip.GetPlanetID() - 1) * quantity); Cargo.ChangeTotalEarned(Earth.GetPrice(MyShip.GetPlanetID() - 1) * quantity); Cargo.ChangeItem(1, -quantity); Cargo.ChangeWeight(150 * -quantity); Console.Clear(); Console.WriteLine($"Item sold. Credits = {Cargo.GetCredits()}"); } else { SellError(); } break; // case to sell mp item. See above for general case statement notes. case 3: if (Cargo.GetItemQuant(2) >= quantity) { Cargo.ChangeCredits(Earth.GetPrice(MyShip.GetPlanetID() + 1) * quantity); Cargo.ChangeTotalEarned(Earth.GetPrice(MyShip.GetPlanetID() + 1) * quantity); Cargo.ChangeItem(2, -quantity); Cargo.ChangeWeight(150 * -quantity); Console.Clear(); Console.WriteLine($"Item sold. Credits = {Cargo.GetCredits()}"); } else { SellError(); } break; default: TradeError(); break; } }
public void onCreate(MyShip parentShip) { // インスタンス化時の初期化処理とか。 this.parentShip = parentShip; }