コード例 #1
0
        /// <summary>
        /// Advance the battlefront pairing on lock of a pairing (or start of the server).
        /// Pairings logic is (if nothing active, set random T1 pairing), otherwise select next T1 pair
        /// </summary>
        public RacialPair AdvancePairing()
        {
            var activePairing = GetActivePairing();

            _logger.Debug($"About to Advance Pairing. Currently Active Pair : {activePairing.ToString()}");

            // If nothing is active, return T1 Emp/Chaos
            if (activePairing == null)
            {
                return(SetActivePairing(RacialPairManager.GetByPair(Pairing.PAIRING_EMPIRE_CHAOS, 1)));
            }
            else
            {
                switch (activePairing.Pairing)
                {
                case Pairing.PAIRING_ELVES_DARKELVES:
                    return(SetActivePairing(RacialPairManager.GetByPair(Pairing.PAIRING_GREENSKIN_DWARVES, 1)));

                case Pairing.PAIRING_EMPIRE_CHAOS:
                    return(SetActivePairing(RacialPairManager.GetByPair(Pairing.PAIRING_ELVES_DARKELVES, 1)));

                case Pairing.PAIRING_GREENSKIN_DWARVES:
                    return(SetActivePairing(RacialPairManager.GetByPair(Pairing.PAIRING_EMPIRE_CHAOS, 1)));
                }

                return(SetActivePairing(RacialPairManager.GetByPair(Pairing.PAIRING_EMPIRE_CHAOS, 1)));
            }
        }
        /// <summary>
        /// Advance the battlefront pairing on lock of a pairing (or start of the server).
        /// Pairings logic is (if nothing active, set random T2 pairing), otherwise follow the racial pairings (eg T2 Chaos -> T3 Chaos -> T4 Chaos).
        /// On lock of T4 select random T2 pairing.
        /// </summary>
        public RacialPair AdvancePairing()
        {
            // Current pairing that has just locked.
            var activePairing = GetActivePairing();

            _logger.Debug($"About to Advance Pairing. Currently Active Pair : {activePairing?.ToString()}");

            // If nothing is active, return T2 Emp/Chaos
            if (activePairing == null)
            {
                return(SetActivePairing(RacialPairManager.GetByPair(Pairing.PAIRING_EMPIRE_CHAOS, 2)));
            }
            else
            {
                var nextTier = GetNextTier(activePairing.Tier);
                _logger.Debug($"Next Tier = {nextTier} ");

                if (nextTier == 5)
                {
                    return(SetActivePairing(this.RacialPairManager.GetByPair(Pairing.PAIRING_LAND_OF_THE_DEAD, nextTier)));
                }
                else
                {
                    // This racial group
                    var activeRacialPairing = activePairing.Pairing;
                    // If Tier 5 has locked, start a random Tier 2.
                    if ((nextTier == 2) && (activePairing.Tier == 5))
                    {
                        var race = this.RacialPairManager.GetRandomRace(activeRacialPairing);
                        _logger.Debug($"T4->T2 race : {race} ");
                        _logger.Debug($"New Active Pair : {this.RacialPairManager.GetByPair(race, nextTier).ToString()}");
                        return(SetActivePairing(this.RacialPairManager.GetByPair(race, nextTier)));
                    }
                }

                return(SetActivePairing(this.RacialPairManager.GetByPair(Pairing.PAIRING_EMPIRE_CHAOS, nextTier)));
            }
        }
 public RacialPair SetInitialPairActive()
 {
     return(SetActivePairing(RacialPairManager.GetByPair(Pairing.PAIRING_EMPIRE_CHAOS, 2)));
 }