Example #1
0
    void GenerateNewMap()
    {
        CurrentCampaign.depth++;
        Map newMap = new Map(CurrentCampaign.depth);

        CurrentCampaign.UpdateMap(newMap);
        mapController.DrawMap(newMap);
        mapController.UpdateMapState(CurrentCampaign);

        DataRetriever.UpdateDepthData(CurrentCampaign.depth);
        GameStateDelegates.OnCampaignStateUpdated(CurrentCampaign);
    }
Example #2
0
        public void DoTradeClassification()
        {
            var codes = CurrentCampaign.GenerateTradeCodes(this);

            if (string.IsNullOrEmpty(Remarks))
            {
                Remarks = codes;
            }
            else
            {
                Remarks += " " + codes;
            }
        }
Example #3
0
    public void UpdatePlayerPosition(MapNode newPlayerNode)
    {
        float nodeDistance = CurrentCampaign.CurrentMap.GetNodeDistance(newPlayerNode);

        CurrentCampaign.UpdatePlayerNode(newPlayerNode, nodeDistance);
        mapController.UpdateMapState(CurrentCampaign);

        switch (newPlayerNode.nodeType)
        {
        case MapNodeType.Start:
            Debug.Log("moved to " + newPlayerNode.nodeType);
            break;

        case MapNodeType.Scenario:
            SwitchToScenario();
            break;

        case MapNodeType.Event:
            TriggerEvent();
            break;

        case MapNodeType.Store:
            DisplayStore();
            break;

        case MapNodeType.End:
            GenerateNewMap();
            break;

        case MapNodeType.Boss:
            SwitchToBossScenario(CurrentCampaign.depth);
            break;

        default:
            break;
        }
    }
Example #4
0
        public void CompleteTravInfo()
        {
            Starport = GetStarport();
            if (Pop.Value == 0)
            {
                TechLevel.Value = 0;
            }
            else
            {
                TechLevel.Value = CurrentCampaign.GenerateTechLevel(this);
            }

            if (_configuration.GenerateFactions)
            {
                Factions = Faction.GenerateFactions(this, _configuration);
            }

            // Bases
            switch (Starport)
            {
            case 'A':
                var dieroll = Common.d6() + Common.d6();
                if (dieroll >= 8)
                {
                    Bases += Languages.Base_Naval;
                }
                dieroll = Common.d6() + Common.d6();
                if (dieroll >= 10)
                {
                    Bases += Languages.Base_Scout;
                }
                dieroll = Common.d6() + Common.d6();
                if (dieroll >= 10)
                {
                    Bases += Languages.Base_Military;
                }
                break;

            case 'B':
                dieroll = Common.d6() + Common.d6();
                if (dieroll >= 8)
                {
                    Bases += Languages.Base_Naval;
                }
                dieroll = Common.d6() + Common.d6();
                if (dieroll >= 9)
                {
                    Bases += Languages.Base_Scout;
                }
                dieroll = Common.d6() + Common.d6();
                if (dieroll >= 9)
                {
                    Bases += Languages.Base_Military;
                }
                break;

            case 'C':
                dieroll = Common.d6() + Common.d6();
                if (dieroll >= 8)
                {
                    Bases += Languages.Base_Scout;
                }
                dieroll = Common.d6() + Common.d6();
                if (dieroll >= 8)
                {
                    Bases += Languages.Base_Military;
                }
                break;

            case 'D':
                dieroll = Common.d6() + Common.d6();
                if (dieroll >= 7)
                {
                    Bases += Languages.Base_Scout;
                }
                break;
            }

            DoTradeClassification();

            if (_configuration.CurrentCampaign == Campaign.HAMMERSSLAMMERS && Pop.Value > 0)
            {
                var conflictDm = 0;
                if (Pop.Value >= 7 && TechLevel.Value >= 11)
                {
                    Remarks    += string.Format(" {0}", Languages.ColonyAge_Old);
                    conflictDm += 2;
                }
                else if (Pop.Value >= 6 && Pop.Value <= 9 && TechLevel.Value >= 8)
                {
                    Remarks += string.Format(" {0}", Languages.ColonyAge_Middle);
                }
                else if (Pop.Value >= 4 && Pop.Value <= 8)
                {
                    Remarks    += string.Format(" {0}", Languages.ColonyAge_Young);
                    conflictDm -= 2;
                }
                if (Government.Value == 7)
                {
                    conflictDm += 2;
                }
                else if (Government.Value == 6)
                {
                    conflictDm -= 2;
                }
                ConflictReason = SeedOfConflict(conflictDm);
            }
        }
Example #5
0
        // Make the changes necessary to represent the social information
        // of a subordiate world relative to the main world
        public void DoSubordinate(TravInfo main)
        {
            var builder = new StringBuilder();

            // Government
            var dieroll = Common.d6();

            if (main.Government.Value == 6)
            {
                dieroll += Pop.Value;
            }
            if (main.Government.Value == 7)
            {
                dieroll -= 1;
            }
            if (Pop.Value == 0)
            {
                Government.Value = 0;
            }
            else
            {
                if (dieroll > 4)
                {
                    Government.Value = 6;
                }
                else
                {
                    Government.Value = dieroll - 1;
                }
            }

            // Law
            if (Pop.Value == 0)
            {
                Law.Value = 0;
            }
            else
            {
                Law.Value = Common.d6() - 3 + main.Law.Value;
            }

            // Farming world
            if ((Atmosphere.Value >= 4 && Atmosphere.Value <= 9) && (Hydro.Value >= 4 && Hydro.Value <= 8) && Pop.Value >= 2)
            {
                builder.AppendFormat("{0} ", Languages.TradeCode_FarmingColony);
            }

            // Mining world
            if (main.Remarks.Contains(Languages.TradeCode_Industrial))
            {
                if (Pop.Value >= 2)
                {
                    builder.AppendFormat("{0} ", Languages.TradeCode_MiningColony);
                }
            }

            // Colony world
            if (Government.Value == 6 && Pop.Value >= 5)
            {
                builder.AppendFormat("{0} ", Languages.TradeCode_Colony);
            }

            // Research world
            if (main.TechLevel.Value >= 9 && main.Pop.Value >= 1 && Pop.Value > 0)
            {
                dieroll = Common.d6() + Common.d6();
                if (main.TechLevel.Value >= 10)
                {
                    dieroll += 2;
                }
                if (dieroll >= 11)
                {
                    builder.AppendFormat("{0} ", Languages.TradeCode_ResearchColony);
                }
            }

            // Mi?
            if (main.Pop.Value >= 8 && !main.Remarks.Contains(Languages.TradeCode_Poor) && Pop.Value > 0)
            {
                dieroll = Common.d6() + Common.d6();
                if (main.Pop.Value >= 9)
                {
                    dieroll += 1;
                }
                if (main.Atmosphere.Value == Atmosphere.Value)
                {
                    dieroll += 1;
                }
                if (dieroll >= 12)
                {
                    builder.AppendFormat("{0} ", Languages.TradeCode_MiningColony);
                }
            }

            // Bases
            if (main.Bases.Contains(Languages.Base_Naval) && Pop.Value >= 3)
            {
                builder.AppendFormat("{0} ", Languages.Subbase_Naval);
            }
            if (main.Bases.Contains(Languages.Base_Scout) && Pop.Value >= 2)
            {
                builder.AppendFormat("{0} ", Languages.Subbase_Scout);
            }

            // Finish up
            Remarks += builder.ToString();

            // Tech Level
            TechLevel.Value = CurrentCampaign.GenerateSubordinateTechLevel(this, main);

            // Spaceport
            dieroll = Common.d6();
            if (Pop.Value >= 6)
            {
                dieroll += 2;
            }
            if (Pop.Value == 1)
            {
                dieroll -= 2;
            }
            if (Pop.Value == 0)
            {
                dieroll -= 3;
            }

            if (dieroll < 3)
            {
                Starport = 'Y';
            }
            else if (dieroll == 3)
            {
                Starport = 'H';
            }
            else if (dieroll >= 6)
            {
                Starport = 'F';
                if (TechLevel.Value != main.TechLevel.Value)
                {
                    TechLevel.Value += 1;
                }
            }
            else
            {
                Starport = 'G';
            }

            if (Pop.Value == 0)
            {
                TechLevel.Value = 0;
            }

            // if the tech level is too low to support life on this world kill
            // everyone off!
            switch (Atmosphere.Value)
            {
            case 0:
            case 2:
            case 3:
            case 10:
            case 11:
            case 12:
                if (TechLevel.Value < 7)
                {
                    ClearDownSocialData();
                    return;
                }
                break;

            case 4:
            case 7:
            case 9:
                if (TechLevel.Value < 5)
                {
                    ClearDownSocialData();
                    return;
                }
                break;

            case 13:
            case 14:
                if (Hydro.Value == 10)
                {
                    if (TechLevel.Value < 7)
                    {
                        ClearDownSocialData();
                        return;
                    }
                }
                break;
            }
        }