Exemple #1
0
        private void CreateGroup(string[] input)
        {
            string pattern = @"create\((\d+),\s(\d+),\s(.+),\s(.+)\)";
            Regex  regex   = new Regex(pattern);

            foreach (var command in input)
            {
                if (regex.IsMatch(command))
                {
                    Match match = regex.Match(command);

                    string attack = match.Groups[4].ToString();
                    string effect = match.Groups[3].ToString();

                    string name = input[0];

                    int health = int.Parse(match.Groups[1].ToString());
                    int damage = int.Parse(match.Groups[2].ToString());

                    WarEffect  warEffect  = (WarEffect)Enum.Parse(typeof(WarEffect), effect);
                    AttackType attackType = (AttackType)Enum.Parse(typeof(AttackType), attack);

                    var newGroup =
                        this.factory.CreateGroup(name, health, damage, warEffect, attackType);
                    this.groups.Add(newGroup);
                }
            }
        }
Exemple #2
0
        public HackGroup(string name, int health, int damage, WarEffect warEffect, AttackTypes groupAttackType)
        {
            this.Name            = name;
            this.Health          = health;
            this.Damage          = damage;
            this.WarEffect       = warEffect;
            this.GroupAttackType = groupAttackType;

            this.InitialHealth = this.Health;
            this.initialDamage = damage;
        }
 public MilitantGroup(string name, int health, int damage, WarEffect warEffect, AttackType attackType) : base(name, health, damage)
 {
     this.WarEffect             = warEffect;
     this.AttackType            = attackType;
     this.WarEffectHasTriggered = false;
 }
 public IMilitantGroup CreateGroup(string name, int health, int damage, WarEffect warEffect, AttackType attackType)
 {
     return(new MilitantGroup(name, health, damage, warEffect, attackType));
 }