コード例 #1
0
        public BuilderShip CreateBuilderShip(EBaseType baseType, int team, Color teamColour, int sectorId)
        {
            var spec = Ships.FirstOrDefault(_ => _.BaseType == baseType && _.Type == EShipType.Constructor);

            if (spec == null)
            {
                return(null);
            }

            var t        = team - 1;
            var faction  = _game.Faction[t];
            var research = _game.TechTree[t].ResearchedUpgrades;
            var settings = _game.GameSettings;
            var alliance = (t < 0) ? -1 : settings.TeamAlliance[t];

            var ship = new BuilderShip(_game, StrategyGame.IconPicDir + spec.Image, spec.Width, spec.Height, teamColour, team, alliance
                                       , spec.Health * research[EGlobalUpgrade.ShipHull] * settings.ShipHealthMultiplier[spec.Type] * faction.Bonuses.Health, baseType, sectorId);

            ship.ScanRange = spec.ScanRange * research[EGlobalUpgrade.ScanRange] * faction.Bonuses.ScanRange;
            ship.Signature = spec.Signature * research[EGlobalUpgrade.ShipSignature] * settings.ShipSignatureMultiplier[spec.Type] * faction.Bonuses.Signature;
            ship.Speed     = spec.Speed * research[EGlobalUpgrade.ShipSpeed] * settings.ShipSpeedMultiplier[spec.Type] * faction.Bonuses.Speed;

            ship.Name        = baseType.ToString();
            ship.TextOffsetY = -15;
            ship.TextBrush   = new SolidBrush(teamColour);

            _game.GameStats.TotalConstructorsBuilt[t]++;

            return(ship);
        }
コード例 #2
0
        //---------------------------------------------------------------------------
        // Parser methode wrappers
        //---------------------------------------------------------------------------
        #region Parser methode wrappers

        public Parser(EBaseType eType)
        {
            m_parser = mupCreate((int)eType);
            Debug.Assert(m_parser != null, "Parser object is null");
            m_errCallback = new ErrorDelegate(RaiseException);
            mupSetErrorHandler(m_parser, m_errCallback);
        }
コード例 #3
0
        public Base CreateBase(EBaseType baseType, int team, Color teamColour, int sectorId, bool addPilots = true)
        {
            var spec = Bases.FirstOrDefault(_ => _.Type == baseType);

            if (spec == null)
            {
                return(null);
            }

            var t        = team - 1;
            var faction  = _game.Faction[t];
            var research = _game.TechTree[t].ResearchedUpgrades;
            var settings = _game.GameSettings;
            var alliance = (t < 0) ? -1 : settings.TeamAlliance[t];

            if (addPilots && _game.TotalPilots[t] + spec.Pilots < _game.GameSettings.MaximumPilots)
            {
                _game.DockedPilots[t] += spec.Pilots;
                _game.TotalPilots[t]  += spec.Pilots;
            }

            if (baseType == EBaseType.Shipyard)
            {
                faction.CapitalMaxDrones += settings.InitialCapitalMaxDrones;
            }

            var bse = new Base(_game, baseType, spec.Width, spec.Height, teamColour, team, alliance, spec.Health * settings.StationHealthMultiplier[spec.Type] * faction.Bonuses.Health, sectorId);

            bse.ScanRange = spec.ScanRange * research[EGlobalUpgrade.ScanRange] * faction.Bonuses.ScanRange;
            bse.Signature = spec.Signature * research[EGlobalUpgrade.ShipSignature] * settings.StationSignatureMultiplier[spec.Type] * faction.Bonuses.Signature;

            return(bse);
        }
コード例 #4
0
        public Parser(EBaseType eType)
        {
            StaticDLLInit.Init();

            m_parser = mupCreate((int)eType);
            Debug.Assert(m_parser != null, "Parser object is null");
            m_errCallback = new ErrorDelegate(RaiseException);
            mupSetErrorHandler(m_parser, m_errCallback);
        }
コード例 #5
0
 protected Base(StrategyGame game, string image, EBaseType type, int width, int height, Color teamColor, int team, int alliance, float health, int sectorId)
     : base(game, string.Empty, width, height, health, sectorId, team)
 {
     Type     = type;
     Alliance = alliance;
     if (team > 0)
     {
         VisibleToTeam[team - 1] = true;
     }
     ScanRange = 500;
     Destroyed = false;
 }
コード例 #6
0
        public BuilderShip(StrategyGame game, string imageFilename, int width, int height, Color teamColor, int team, int alliance, float health, EBaseType baseType, int sectorId)
            : base(game, imageFilename, width, height, teamColor, team, alliance, health, 0, sectorId)
        {
            Type             = EShipType.Constructor;
            BaseType         = baseType;
            BuildingDuration = new TimeSpan(0, 0, 4);

            switch (baseType)
            {
            case EBaseType.Tactical:
                TargetRockType = EAsteroidType.Silicon;
                break;

            case EBaseType.Supremacy:
                TargetRockType = EAsteroidType.Carbon;
                break;

            case EBaseType.Expansion:
                TargetRockType = EAsteroidType.Uranium;
                break;

            case EBaseType.Resource:
                TargetRockType = EAsteroidType.Resource;
                break;

            default:
                TargetRockType = EAsteroidType.Generic;
                break;
            }
            var buildFilename = BuildImagePath;

            switch (TargetRockType)
            {
            case EAsteroidType.Carbon:
                buildFilename += "CarbonBuildGlow.png";
                break;

            case EAsteroidType.Silicon:
                buildFilename += "SiliconBuildGlow.png";
                break;

            case EAsteroidType.Uranium:
                buildFilename += "UraniumBuildGlow.png";
                break;

            default:
                buildFilename += "RockBuildGlow.png";
                break;
            }
            BuildImage = Image.FromFile(buildFilename);
        }
コード例 #7
0
 public Base(StrategyGame game, EBaseType type, int width, int height, Color teamColor, int team, int alliance, float health, int sectorId)
     : this(game, string.Empty, type, width, height, teamColor, team, alliance, health, sectorId)
 {
 }
コード例 #8
0
 public static bool IsTower(EBaseType type)
 {
     return(type == EBaseType.MissileTower || type == EBaseType.Tower || type == EBaseType.RepairTower || type == EBaseType.Minefield || type == EBaseType.ShieldTower);
 }