public static TroopTemplate GetRefreshedTemplate(CharacterObject troop)
        {
            TroopTemplate template = new TroopTemplate(troop);

            CachedTemplates[troop.Id] = template;
            return(template);
        }
示例#2
0
 public TroopState(PartyState _partyState, CharacterObject _troop, int count = 1)
 {
     troop        = _troop;
     partyState   = _partyState;
     IsHero       = troop.IsHero;
     TotalCount   = count;
     MaxHitPoints = troop.MaxHitPoints();
     if (SubModule.Settings.Battle_SendAllTroops_DetailedCombatModel)
     {
         var template = troop.IsHero ? TroopTemplate.GetRefreshedTemplate(troop) : TroopTemplate.GetTroopTemplate(troop);
         foreach (var weapon in template.Weapons)
         {
             Weapons.Add(weapon.Clone());
         }
         if (template.Shield != null)
         {
             Shield = template.Shield.Clone();
         }
         if (template.Horse != null && !partyState.mapEventState.IsSiege)
         {
             Horse     = template.Horse.Clone();
             IsMounted = true;
         }
         Atheletics  = template.Atheletics;
         ArmorPoints = template.ArmorPoints;
         Strength    = template.Strength;
     }
     else
     {
         Strength = troop.GetPower();
     }
 }
        //private static System.IO.StreamWriter templateFile = new System.IO.StreamWriter(@"D:\TroopTemplates.txt");

        public static TroopTemplate GetTroopTemplate(CharacterObject troop)
        {
            if (!CachedTemplates.TryGetValue(troop.Id, out TroopTemplate template))
            {
                template = new TroopTemplate(troop);
                CachedTemplates[troop.Id] = template;
            }
            return(template);
        }