示例#1
0
    //method used for copying RegionAction without reference
    public RegionAction(RegionAction r)
    {
        name            = (string[])r.name.Clone();
        description     = (string[])r.description.Clone();
        actionMoneyCost = r.actionMoneyCost;
        afterInvestmentActionMoneyCost = r.afterInvestmentActionMoneyCost;
        actionMoneyReward             = r.actionMoneyReward;
        actionDuration                = r.actionDuration;
        possibleSectors               = (string[])r.possibleSectors.Clone();
        pickedSectors                 = (bool[])r.pickedSectors.Clone();
        actionCooldown                = r.actionCooldown;
        isUnique                      = r.isUnique;
        temporaryConsequencesDuration = r.temporaryConsequencesDuration;

        consequences = new SectorStatistics(r.consequences);
        afterInvestmentConsequences          = new SectorStatistics(r.afterInvestmentConsequences);
        temporaryConsequences                = new SectorStatistics(r.temporaryConsequences);
        afterInvestmentTemporaryConsequences = new SectorStatistics(r.afterInvestmentTemporaryConsequences);

        startYear     = r.startYear;
        startMonth    = r.startMonth;
        lastCompleted = r.lastCompleted;
        isActive      = r.isActive;
        endTemporaryConsequencesMonth = r.endTemporaryConsequencesMonth;
        isAvailable                = r.isAvailable;
        conditionsAreRegional      = r.conditionsAreRegional;
        startAvailableYear         = r.startAvailableYear;
        startAvailableMonth        = r.startAvailableMonth;
        endAvailableYear           = r.endAvailableYear;
        endAvailableMonth          = r.endAvailableMonth;
        availableConditionsMinimum = new SectorStatistics(r.availableConditionsMinimum);
        availableConditionsMaximum = new SectorStatistics(r.availableConditionsMaximum);
    }
 //method used for copying Sectorstatistics without reference
 public SectorStatistics(SectorStatistics sectorStatistics)
 {
     income       = sectorStatistics.income;
     happiness    = sectorStatistics.happiness;
     ecoAwareness = sectorStatistics.ecoAwareness;
     prosperity   = sectorStatistics.prosperity;
     pollution    = new Pollution(sectorStatistics.pollution);
 }
    public void SetPickedConsequences(SectorStatistics s, double[] modifiers, System.Random rnd)
    {
        income       = s.income * modifiers[rnd.Next(0, modifiers.Length)];
        happiness    = s.happiness * modifiers[rnd.Next(0, modifiers.Length)];
        ecoAwareness = s.ecoAwareness * modifiers[rnd.Next(0, modifiers.Length)];
        prosperity   = s.prosperity * modifiers[rnd.Next(0, modifiers.Length)];

        pollution.SetPickedConsequences(s, modifiers, rnd);
    }
示例#4
0
 public void SetPickedConsequences(SectorStatistics s, double[] modifiers, System.Random rnd)
 {
     airPollution            = s.pollution.airPollution * modifiers[rnd.Next(0, modifiers.Length)];
     naturePollution         = s.pollution.naturePollution * modifiers[rnd.Next(0, modifiers.Length)];
     waterPollution          = s.pollution.waterPollution * modifiers[rnd.Next(0, modifiers.Length)];
     airPollutionIncrease    = s.pollution.airPollutionIncrease * modifiers[rnd.Next(0, modifiers.Length)];
     naturePollutionIncrease = s.pollution.naturePollutionIncrease * modifiers[rnd.Next(0, modifiers.Length)];
     waterPollutionIncrease  = s.pollution.waterPollutionIncrease * modifiers[rnd.Next(0, modifiers.Length)];
 }
示例#5
0
 public void ImplementEventConsequences(GameEvent gameEvent, SectorStatistics statistics, bool isAdded, double happiness)
 {
     for (int i = 0; i < gameEvent.possibleSectors.Length; i++)
     {
         foreach (RegionSector sector in sectors)
         {
             if (sector.sectorName[0] == gameEvent.possibleSectors[i])
             {
                 sector.ImplementStatisticValues(statistics, isAdded, happiness);
             }
         }
     }
 }
示例#6
0
 //method used for copying GameEvent without reference
 public GameEvent(GameEvent e)
 {
     name                                = e.name;
     publicEventName                     = (string[])e.publicEventName.Clone();
     description                         = (string[])e.description.Clone();
     choicesDutch                        = (string[])e.choicesDutch.Clone();
     choicesEnglish                      = (string[])e.choicesEnglish.Clone();
     isUnique                            = e.isUnique;
     isGlobal                            = e.isGlobal;
     eventStartChance                    = e.eventStartChance;
     eventIdleDuration                   = e.eventIdleDuration;
     eventCooldown                       = e.eventCooldown;
     eventDuration                       = (int[])e.eventDuration;
     temporaryConsequencesDuration       = (int[])e.temporaryConsequencesDuration.Clone();
     eventChoiceMoneyCost                = (double[])e.eventChoiceMoneyCost.Clone();
     afterInvestmentEventChoiceMoneyCost = (double[])e.afterInvestmentEventChoiceMoneyCost.Clone();
     eventChoiceMoneyReward              = (double[])e.eventChoiceMoneyReward.Clone();
     eventChoiceEventStartChanceModifier = (int[])e.eventChoiceEventStartChanceModifier.Clone();
     possibleRegions                     = (string[])e.possibleRegions.Clone();
     successChance                       = (int[])e.successChance.Clone();
     increasedConsequencesModifierChance = (int[])e.increasedConsequencesModifierChance.Clone();
     possibleSectors                     = (string[])e.possibleSectors.Clone();
     pickedChoiceNumber                  = e.pickedChoiceNumber;
     pickedChoiceStartYear               = e.pickedChoiceStartYear;
     pickedChoiceStartMonth              = e.pickedChoiceStartMonth;
     lastCompleted                       = e.lastCompleted;
     isIdle                              = e.isIdle;
     idleTurnsLeft                       = e.idleTurnsLeft;
     isActive                            = e.isActive;
     onEventStartMonth                   = e.onEventStartMonth;
     onEventStartYear                    = e.onEventStartYear;
     isFinished                          = e.isFinished;
     consequences                        = new SectorStatistics[3] {
         new SectorStatistics(e.consequences[0]), new SectorStatistics(e.consequences[0]), new SectorStatistics(e.consequences[0])
     };
     afterInvestmentConsequences = new SectorStatistics[3] {
         new SectorStatistics(e.afterInvestmentConsequences[0]), new SectorStatistics(e.afterInvestmentConsequences[0]), new SectorStatistics(e.afterInvestmentConsequences[0])
     };
     temporaryConsequences = new SectorStatistics[3] {
         new SectorStatistics(e.temporaryConsequences[0]), new SectorStatistics(e.temporaryConsequences[0]), new SectorStatistics(e.temporaryConsequences[0])
     };
     afterInvestmentTemporaryConsequences = new SectorStatistics[3] {
         new SectorStatistics(e.afterInvestmentTemporaryConsequences[0]), new SectorStatistics(e.afterInvestmentTemporaryConsequences[0]), new SectorStatistics(e.afterInvestmentTemporaryConsequences[0])
     };
     pickedConsequences = new SectorStatistics[3] {
         new SectorStatistics(e.pickedConsequences[0]), new SectorStatistics(e.pickedConsequences[0]), new SectorStatistics(e.pickedConsequences[0])
     };
     pickedTemporaryConsequences = new SectorStatistics[3] {
         new SectorStatistics(e.pickedTemporaryConsequences[0]), new SectorStatistics(e.pickedTemporaryConsequences[0]), new SectorStatistics(e.pickedTemporaryConsequences[0])
     };
 }
示例#7
0
 /*updates the sector statistics with the consequences of the action, method received both the action and statistics because
  * /the statistics can be either normal consequences or temporary consequences*/
 public void ImplementActionConsequences(RegionAction regionAction, SectorStatistics statistics, bool isAdded, double happiness)
 {
     for (int i = 0; i < regionAction.possibleSectors.Count(); i++)
     {
         if (regionAction.pickedSectors[i])
         {
             foreach (RegionSector sector in sectors)
             {
                 if (sector.sectorName[0] == regionAction.possibleSectors[i])
                 {
                     sector.ImplementStatisticValues(statistics, isAdded, happiness);
                 }
             }
         }
     }
 }
示例#8
0
    public void ImplementStatisticValues(SectorStatistics statistics, bool isAdded, double globalHappiness) //if a statistic is removed for example, isAdded is false
    {
        double modifiedIncome = ModifyIncomeFromBuilding(statistics.income);

        modifiedIncome = ModifyIncomeFromHappiness(modifiedIncome, globalHappiness);
        double modifiedHappiness               = ModifyHappinessFromHappiness(statistics.happiness, globalHappiness);
        double modifiedEcoAwareness            = ModifyEcoAwarenessFromHappiness(statistics.ecoAwareness, globalHappiness);
        double modifiedProsperity              = ModifyProsperityFromHappiness(statistics.prosperity, globalHappiness);
        double modifiedAirPollution            = ModifyAirPollutionFromHappiness(statistics.pollution.airPollution, globalHappiness);
        double modifiedNaturePollution         = ModifyAirPollutionFromHappiness(statistics.pollution.naturePollution, globalHappiness);
        double modifiedWaterPollution          = ModifyAirPollutionFromHappiness(statistics.pollution.waterPollution, globalHappiness);
        double modifiedAirPollutionIncrease    = ModifyAirPollutionFromHappiness(statistics.pollution.airPollutionIncrease, globalHappiness);
        double modifiedNaturePollutionIncrease = ModifyAirPollutionFromHappiness(statistics.pollution.naturePollutionIncrease, globalHappiness);
        double modifiedWaterPollutionIncrease  = ModifyAirPollutionFromHappiness(statistics.pollution.waterPollutionIncrease, globalHappiness);

        if (isAdded)
        {
            this.statistics.ModifyIncome(modifiedIncome);
            this.statistics.ModifyHappiness(modifiedHappiness);
            this.statistics.ModifyEcoAwareness(modifiedEcoAwareness, true);
            this.statistics.ModifyProsperity(modifiedProsperity, true);

            this.statistics.pollution.ChangeAirPollution(modifiedAirPollution);
            this.statistics.pollution.ChangeNaturePollution(modifiedNaturePollution);
            this.statistics.pollution.ChangeWaterPollution(modifiedWaterPollution);

            this.statistics.pollution.ChangeAirPollutionMutation(modifiedAirPollutionIncrease);
            this.statistics.pollution.ChangeNaturePollutionMutation(modifiedNaturePollutionIncrease);
            this.statistics.pollution.ChangeWaterPollutionMutation(modifiedWaterPollutionIncrease);
        }

        else
        {
            this.statistics.ModifyIncome(0 - modifiedIncome);
            this.statistics.ModifyHappiness(0 - modifiedHappiness);
            this.statistics.ModifyEcoAwareness(0 - modifiedEcoAwareness, true);
            this.statistics.ModifyProsperity(0 - modifiedProsperity, true);

            this.statistics.pollution.ChangeAirPollution(0 - modifiedAirPollution);
            this.statistics.pollution.ChangeNaturePollution(0 - modifiedNaturePollution);
            this.statistics.pollution.ChangeWaterPollution(0 - modifiedWaterPollution);

            this.statistics.pollution.ChangeAirPollutionMutation(0 - modifiedAirPollutionIncrease);
            this.statistics.pollution.ChangeNaturePollutionMutation(0 - modifiedNaturePollutionIncrease);
            this.statistics.pollution.ChangeWaterPollutionMutation(0 - modifiedWaterPollutionIncrease);
        }
    }
示例#9
0
 //method used for copying Card without reference
 public Card(Card card)
 {
     cardID = card.cardID;
     name   = new string[2] {
         card.name[0], card.name[1]
     };
     description = new string[2] {
         card.description[0], card.description[1]
     };
     isGlobal = card.isGlobal;
     maximumIncrementsDone     = card.maximumIncrementsDone;
     currentIncrementsDone     = card.currentIncrementsDone;
     sectorConsequencesPerTurn = new SectorStatistics(card.sectorConsequencesPerTurn);
     moneyRewardPerTurn        = card.moneyRewardPerTurn;
     currentSectorConsequences = new SectorStatistics(card.currentSectorConsequences);
     currentMoneyReward        = card.currentMoneyReward;
 }
示例#10
0
 public Card()
 {
     currentSectorConsequences = new SectorStatistics();
 }