Ejemplo n.º 1
0
        /// <summary>
        /// use this constructor for creating an 'Start' combat Object.
        /// </summary>
        /// <param name="start_v"></param>
        /// <param name="working_v"></param>
        /// <param name="battleseed"></param>
        /// <param name="OrigionalID">this should be the FrEee ID for the origional Vehicle</param>
        /// <param name="IDPrefix"></param>
        public CombatVehicle(Vehicle start_v, Vehicle working_v, int battleseed, long OrigionalID, string IDPrefix = "SHP")
            : base(start_v, working_v, new PointXd(0, 0, 0), new PointXd(0, 0, 0), battleseed, IDPrefix)
        {
            this.ID = OrigionalID;
            // TODO - don't some mods have vehicles >32MT?
            cmbt_mass         = (Fix16)working_v.Size;
            maxfowardThrust   = (Fix16)working_v.Speed * this.cmbt_mass * (Fix16)0.5;
            maxStrafeThrust   = ((Fix16)working_v.Speed * this.cmbt_mass * (Fix16)0.5) / ((Fix16)4 - (Fix16)working_v.Evasion * (Fix16)0.01);
            maxRotate.Degrees = ((Fix16)working_v.Speed * this.cmbt_mass * (Fix16)0.1) / ((Fix16)2.5 - (Fix16)working_v.Evasion * (Fix16)0.01);
            if (start_v.Design.Strategy == null)
            {
                strategy = new StragegyObject_Default();
            }
            else
            {
                strategy = start_v.Design.Strategy.Copy();
            }
            SpaceVehicle sv = (SpaceVehicle)start_v;

            //combatfleet = sv.Container.Name;
#if DEBUG
            Console.WriteLine("Created new CombatVehicle with ID " + ID);
            Console.WriteLine("MaxAccel = " + maxfowardThrust / cmbt_mass);
            //Console.WriteLine("Strategy: " + strategy
#endif
        }
Ejemplo n.º 2
0
        public override void renewtoStart()
        {
#if DEBUG
            Console.WriteLine("renewtoStart for CombatVehcile");
            Console.WriteLine(this.strID);
            Console.WriteLine(StartVehicle.Name);
#endif
            Vehicle ship = StartVehicle.Copy();
            ship.IsMemory = true;
            if (ship.Owner != StartVehicle.Owner && ship.Owner != null)
            {
                ship.Owner.Dispose();                 // don't need extra empires!
            }
            ship.Owner = StartVehicle.Owner;
#if DEBUG
            Console.WriteLine(ship.Name);
#endif
            // copy over the components individually so they can take damage without affecting the starting state
            ship.Components.Clear();
#if DEBUG
            Console.WriteLine("copying components");
#endif
            foreach (var comp in (StartVehicle.Components))
            {
                var ccopy = comp.Copy();
                ship.Components.Add(ccopy);
                ccopy.Container = ship;
#if DEBUG
                Console.WriteLine(ccopy.Name);
                Console.WriteLine("Container is " + ccopy.Container);
#endif
            }
#if DEBUG
            Console.WriteLine("Done");
#endif

            WorkingVehicle = ship;
            RefreshWeapons();

            foreach (var w in Weapons)
            {
                w.nextReload = 1;
            }

            base.renewtoStart();

            SpaceVehicle start_v = (SpaceVehicle)this.StartCombatant;
            if (start_v.Design.Strategy == null)
            {
                strategy = new StragegyObject_Default();
            }
            else
            {
                strategy = start_v.Design.Strategy.Copy();
            }
#if DEBUG
            Console.WriteLine("Done");
#endif
        }
Ejemplo n.º 3
0
 /// <summary>
 /// use this constructor when creating a 'Start' combatPlanet.
 /// </summary>
 /// <param name="start"></param>
 /// <param name="working"></param>
 /// <param name="battleseed"></param>
 /// <param name="OrigionalID"></param>
 /// <param name="IDPrefix"></param>
 public CombatPlanet(Planet start, Planet working, int battleseed, long OriginalID, string IDPrefix = "PLN")
     : base(start, working, new PointXd(0, 0, 0), new PointXd(0, 0, 0), battleseed, IDPrefix)
 {
     ID = OriginalID;
     // TODO - planets that can move in combat?
     //- I don't think there's much point in allowing planets to move in combat. combat shouldnt be long enough that it would make any noticible difference.
     cmbt_mass         = Fix16.MaxValue;
     maxfowardThrust   = 0;
     maxStrafeThrust   = 0;
     maxRotate.Radians = 0;
     strategy          = new StragegyObject_Default();
 }