コード例 #1
0
 public SPAgentOrigin(SPCombatant combatant, SPSpawnableCharacter character, IEnhancedBattleTestTroopSupplier troopSupplier, BattleSideEnum side, int rank = -1, UniqueTroopDescriptor uniqueNo = default)
     : base(combatant.Combatant, troopSupplier, side, rank, uniqueNo)
 {
     SPCharacter      = character;
     CultureCombatant = combatant;
     PartyAgentOrigin = new PartyAgentOrigin(combatant.Combatant, character.CharacterObject, rank,
                                             uniqueNo);
 }
コード例 #2
0
        public static SPCombatant CreateParty(PartyBase party, BattleSideEnum side, BasicCultureObject culture,
                                              TeamConfig teamConfig, bool isPlayerTeam)
        {
            party.Owner = null;
            if (teamConfig.HasGeneral)
            {
                var characterObject = (teamConfig.General as SPCharacterConfig)?.ActualCharacterObject;
                if (characterObject?.IsHero ?? false)
                {
                    party.Owner = characterObject.HeroObject;
                }
            }
            Utility.FillPartyMembers(party, side, culture, teamConfig, isPlayerTeam);
            bool isAttacker = side == BattleSideEnum.Attacker;
            var  combatant  = new SPCombatant(party, side, teamConfig.TacticLevel, culture,
                                              new Tuple <uint, uint>(teamConfig.Color1, teamConfig.Color2),
                                              teamConfig.Banner);

            if (teamConfig.HasGeneral)
            {
                if (teamConfig.General is SPCharacterConfig general)
                {
                    combatant.AddCharacter(
                        new SPSpawnableCharacter(general, (int)general.CharacterObject.DefaultFormationGroup,
                                                 general.FemaleRatio > 0.5, isPlayerTeam), 1);
                }
            }
            for (int i = 0; i < teamConfig.Troops.Troops.Length; ++i)
            {
                var troopConfig = teamConfig.Troops.Troops[i];
                if (troopConfig.Character is SPCharacterConfig spCharacter)
                {
                    var femaleCount = (int)(troopConfig.Number * spCharacter.FemaleRatio + 0.49);
                    var maleCount   = troopConfig.Number - femaleCount;
                    combatant.AddCharacter(new SPSpawnableCharacter(spCharacter, i, true), femaleCount);
                    combatant.AddCharacter(new SPSpawnableCharacter(spCharacter, i, false), maleCount);
                }
            }

            return(combatant);
        }
コード例 #3
0
 public SPTroopSupplier(IEnhancedBattleTestCombatant combatant)
 {
     _combatant = combatant as SPCombatant;
     ArrangePriorities();
 }
コード例 #4
0
 public SPTroopSupplier(IEnhancedBattleTestCombatant combatant, bool isPlayerSide)
 {
     _combatant    = combatant as SPCombatant;
     _isPlayerSide = isPlayerSide;
     ArrangePriorities();
 }