예제 #1
0
        public static void Activate(AttackMethod name)
        {
            if (!Actions.ContainsKey(name))
            {
                throw new Exception($"Key {name} does not exist in {nameof(FluentControlActivator)}.");
            }

            var actions = Actions[name];

            foreach (var action in actions)
            {
                if (action.Switch == Switch.Enable)
                {
                    action.Control.Enabled = true;
                }
                else if (action.Switch == Switch.Disable)
                {
                    action.Control.Enabled = false;
                }
                else
                {
                    (action.Control as RadioButton).Checked = true;
                }
            }
        }
예제 #2
0
        public void Nature_does_not_strike_the_rot_via_other_sources()
        {
            GameState gs = new GameState();
            var       cm = new CompoundMap();

            cm.RotMap = new RotMap();
            gs.Map    = cm;

            //var asys = new AttackSystem();
            var asys = SourceMe.The <AttackSystem>();

            asys.GameState = gs;

            var    flameRat = BeingCreator.CreateBeing("flame rat");
            var    am       = new AttackMethod("physical.impact.blunt", "1d3 +2");
            var    rot      = new AreaRot();
            Attack attack   = new Attack
            {
                Attacker      = flameRat,
                AttackMethod  = am,
                Defender      = rot,
                DefenseMethod = rot.GetDefenseMethod(am)
            };

            Assert.That(asys.AttackQueue.Count, Is.EqualTo(0));

            asys.CheckForSpecials(attack);

            Assert.That(asys.AttackQueue.Count, Is.EqualTo(1));
        }
 public int PosterizeLineOfSight(
     LineOfSight LineOfSight, Unit Unit, AttackMethod AttackMethod)
 {
     return(Math.Min(
                LineOfSight.Range * HIGHLIGHT_COLORS.Length / (Unit.Configuration.GetRange(AttackMethod, false) + 1),
                HIGHLIGHT_COLORS.Length - 1));
 }
 protected void SelectUnit(Unit Unit, AttackMethod AttackMethod)
 {
     _Controller.SelectUnit(Unit);
     _Controller.Highlight(
         Unit.GetFieldOfSight(AttackMethod).Select(
             i => new Tuple <Tile, Color>(i.Final, _Controller.GetRangeColor(i, Unit, AttackMethod))));
 }
예제 #5
0
        public OrderInvalidReason CanAttack(
            AttackMethod AttackMethod, bool EnemyArmored, LineOfSight LineOfSight, bool UseSecondaryWeapon)
        {
            var r = CanAttack(AttackMethod);

            if (r != OrderInvalidReason.NONE)
            {
                return(r);
            }

            if (Configuration.GetWeapon(UseSecondaryWeapon).Ammunition > 0 && GetAmmunition(UseSecondaryWeapon) == 0)
            {
                return(OrderInvalidReason.UNIT_NO_AMMUNITION);
            }

            if (AttackMethod == AttackMethod.DIRECT_FIRE)
            {
                return(Configuration.CanDirectFireAt(EnemyArmored, LineOfSight, UseSecondaryWeapon));
            }
            if (AttackMethod == AttackMethod.INDIRECT_FIRE)
            {
                r = Configuration.CanIndirectFireAt(LineOfSight, UseSecondaryWeapon);
                if (r != OrderInvalidReason.NONE)
                {
                    return(r);
                }

                if (Configuration.CanDirectFireAt(
                        EnemyArmored, LineOfSight, UseSecondaryWeapon) != OrderInvalidReason.NONE)
                {
                    if (Army.SightFinder.HasTileSightLevel(LineOfSight.Final, TileSightLevel.SOFT_SPOTTED))
                    {
                        return(OrderInvalidReason.NONE);
                    }
                    return(OrderInvalidReason.ATTACK_NO_SPOTTER);
                }
                return(OrderInvalidReason.NONE);
            }
            if (AttackMethod == AttackMethod.OVERRUN)
            {
                return(Configuration.CanOverrunAt(EnemyArmored));
            }
            if (AttackMethod == AttackMethod.CLOSE_ASSAULT)
            {
                if (!Configuration.CanCloseAssault)
                {
                    return(OrderInvalidReason.UNIT_NO_ATTACK);
                }
            }
            if (AttackMethod == AttackMethod.AIR)
            {
                return(Configuration.CanAirAttackAt(EnemyArmored, UseSecondaryWeapon));
            }
            if (AttackMethod == AttackMethod.ANTI_AIRCRAFT)
            {
                return(Configuration.CanAntiAircraftAt(EnemyArmored, LineOfSight, UseSecondaryWeapon));
            }

            return(OrderInvalidReason.NONE);
        }
예제 #6
0
 //private Color red = new Color(1.0f, 0.0f, 0.0f);
 public void shootAttack(AttackMethod attack, Vector3 startPosition, Quaternion angle)
 {
     Debug.Log(projecticle.name + ", " + startPosition.x.ToString() + ", " + angle.w.ToString());
     Rigidbody shot = (Rigidbody)Instantiate(projecticle, startPosition, angle);
     shot.velocity = transform.forward * speed;
     // You can also acccess other components / scripts of the clone
     //projecticle = shot.GetComponent<Rigidbody>();
 }
예제 #7
0
        public OrderInvalidReason CanBeAttackedBy(Army Army, AttackMethod AttackMethod, bool IgnoreConcealment = false)
        {
            IgnoreConcealment |= AttackMethod == AttackMethod.INDIRECT_FIRE;
            if (Position == null)
            {
                return(OrderInvalidReason.ILLEGAL);
            }

            if (AttackMethod == AttackMethod.MINEFIELD)
            {
                if (Configuration.ImmuneToMines)
                {
                    return(OrderInvalidReason.TARGET_IMMUNE);
                }
                if (Position.Units.Where(i => i.Configuration.UnitClass == UnitClass.MINEFIELD)
                    == HasInteraction <ClearMinefieldInteraction>(i => true)?.Object)
                {
                    return(OrderInvalidReason.TARGET_IMMUNE);
                }
                if (!Configuration.IsNeutral())
                {
                    return(OrderInvalidReason.NONE);
                }
            }

            if (Configuration.IsAircraft() && AttackMethod != AttackMethod.ANTI_AIRCRAFT)
            {
                return(OrderInvalidReason.TARGET_IMMUNE);
            }

            if (Army.Configuration.Team == this.Army.Configuration.Team ||
                (Configuration.IsNeutral() && !Configuration.MustBeAttackedAlone()))
            {
                return(OrderInvalidReason.TARGET_TEAM);
            }
            if (Position == null)
            {
                return(OrderInvalidReason.ILLEGAL);
            }
            if (Configuration.MustBeAttackedAlone())
            {
                if (Position.Units.Any(
                        i => i != this && i.CanBeAttackedBy(Army, AttackMethod) == OrderInvalidReason.NONE))
                {
                    return(OrderInvalidReason.TARGET_COVERED);
                }
            }
            if (!IgnoreConcealment && !Army.SightFinder.IsSighted(this))
            {
                return(OrderInvalidReason.TARGET_CONCEALED);
            }
            if (Carrier != null || Position.Units.Any(i => i.Covers(this)))
            {
                return(OrderInvalidReason.TARGET_COVERED);
            }
            return(OrderInvalidReason.NONE);
        }
예제 #8
0
 public IEnumerable <LineOfSight> GetFieldOfSight(AttackMethod AttackMethod, Tile Tile)
 {
     if (Configuration.CanAttack(AttackMethod) == OrderInvalidReason.NONE)
     {
         return(GetFieldOfSight(
                    Configuration.GetRange(AttackMethod, false), Tile, AttackMethod));
     }
     return(Enumerable.Empty <LineOfSight>());
 }
        private void RadioButtonAttackMethod_CheckedChanged(object sender, EventArgs e)
        {
            var button = sender as RadioButton;

            if (button.Checked)
            {
                _Protocol = (AttackMethod)button.Tag;
            }
        }
예제 #10
0
    public int enduranceCost; //How much endurance this options costs

    #endregion Fields

    #region Constructors

    public AttackOption(string attackName, AttackMethod attackMethod, ActionGroup attackGroup, int baseDamage, int enduranceCost, string attackDescription)
    {
        this.attackName = attackName;
        this.attackMethod = attackMethod;
        this.attackGroup = attackGroup;
        this.basePower = baseDamage;
        this.enduranceCost = enduranceCost;
        this.attackDescription = attackDescription;
    }
예제 #11
0
    //private Color red = new Color(1.0f, 0.0f, 0.0f);

    public void shootAttack(AttackMethod attack, Vector3 startPosition, Quaternion angle)
    {
        Debug.Log(projecticle.name + ", " + startPosition.x.ToString() + ", " + angle.w.ToString());
        Rigidbody shot = (Rigidbody)Instantiate(projecticle, startPosition, angle);

        shot.velocity = transform.forward * speed;
        // You can also acccess other components / scripts of the clone
        //projecticle = shot.GetComponent<Rigidbody>();
    }
예제 #12
0
        public FluentControlActivator(AttackMethod name)
        {
            if (Actions.ContainsKey(name))
            {
                throw new Exception($"Key already exists in {nameof(FluentControlActivator)}.");
            }

            Name = name;
            Actions.Add(name, new List <Data>());
        }
예제 #13
0
 private void Awake()
 {
     line      = GetComponent <LineDraw>();
     audio     = GetComponent <AudioSource>();
     handle    = FindObjectOfType <AttackMethod>();
     handle2   = FindObjectOfType <Beejea_Verbase_Setting>();
     Player    = FindObjectOfType <PlayerState>();
     deltaTime = Time.deltaTime;
     collider  = GetComponent <Collider>();
 }
예제 #14
0
        public void Nature_strikes_neighboring_rot_through_our_hero()
        {
            var    player = BeingCreator.CreateBeing("Suvail");
            var    am     = new AttackMethod("physical.impact.blunt", "1d3 +2");
            var    rot    = new AreaRot();
            Attack attack = new Attack
            {
                Attacker      = player,
                AttackMethod  = am,
                Defender      = rot,
                DefenseMethod = rot.GetDefenseMethod(am)
            };

            RotMap rotMap = new RotMap();
            //...add two neighbor ABs, and one further away
            var nbor_1   = new AreaRot();
            var nbor_2   = new AreaRot();
            var stranger = new AreaRot();

            rotMap.Add(rot, (2, 2));
            rotMap.Add(nbor_1, (2, 3));
            rotMap.Add(nbor_2, (3, 1));
            rotMap.Add(stranger, (8, 2));

            GameState gs = new GameState();
            var       cm = new CompoundMap();

            cm.RotMap = rotMap;
            gs.Map    = cm;

            var asys = new AttackSystem {
                GameState = gs
            };

            SourceMe.InjectProperties(asys);

            Assert.That(asys.AttackQueue.Count, Is.EqualTo(0));

            asys.CheckForSpecials(attack);

            Assert.That(asys.AttackQueue.Count, Is.EqualTo(4));

            var splashBack = asys.AttackQueue.Dequeue();

            Assert.NotNull(splashBack);

            var newAttack = asys.AttackQueue.Dequeue();

            Assert.That(newAttack.Defender, Is.EqualTo(rot));

            newAttack = asys.AttackQueue.Dequeue();
            Assert.That(newAttack.Defender, Is.EqualTo(nbor_2));
            newAttack = asys.AttackQueue.Dequeue();
            Assert.That(newAttack.Defender, Is.EqualTo(nbor_1));
        }
예제 #15
0
 public static void Set(AttackMethod name, bool state)
 {
     if (state)
     {
         Activate(name);
     }
     else
     {
         Deactivate(name);
     }
 }
예제 #16
0
        public AttackFactorCalculation(
            Unit Unit,
            AttackMethod AttackMethod,
            bool EnemyArmored,
            LineOfSight LineOfSight,
            bool UseSecondaryWeapon)
        {
            if (Unit.CanAttack(AttackMethod, EnemyArmored, LineOfSight, UseSecondaryWeapon) != OrderInvalidReason.NONE)
            {
                Attack  = 0;
                Factors = new List <AttackFactorCalculationFactor> {
                    AttackFactorCalculationFactor.CANNOT_ATTACK
                };
                return;
            }

            switch (AttackMethod)
            {
            case AttackMethod.DIRECT_FIRE:
                GetNormalAttack(Unit, EnemyArmored, LineOfSight, UseSecondaryWeapon, true);
                break;

            case AttackMethod.INDIRECT_FIRE:
                GetNormalAttack(Unit, EnemyArmored, LineOfSight, UseSecondaryWeapon, false);
                Attack /= 4;
                Factors.Add(AttackFactorCalculationFactor.INDIRECT_FIRE);
                break;

            case AttackMethod.AIR:
                GetAirAttack(Unit, EnemyArmored, UseSecondaryWeapon);
                break;

            case AttackMethod.ANTI_AIRCRAFT:
                GetAntiAirAttack(Unit, LineOfSight, UseSecondaryWeapon);
                break;

            default:
                if (Unit.CanAttack(
                        AttackMethod, EnemyArmored, LineOfSight, UseSecondaryWeapon) != OrderInvalidReason.NONE)
                {
                    Attack  = 0;
                    Factors = new List <AttackFactorCalculationFactor>
                    {
                        AttackFactorCalculationFactor.CANNOT_ATTACK
                    };
                }
                Attack  = Unit.Configuration.GetWeapon(UseSecondaryWeapon).Attack;
                Factors = new List <AttackFactorCalculationFactor>();
                break;
            }
        }
예제 #17
0
        public void SetUp()
        {
            BeingCreator = SourceMe.The <IBeingCreator>();
            Basis.ConnectIDGenerator();

            // Torch as club, crunch and burn
            tac        = new AttackMethod();
            tac_impact = new AttackEffect
            {
                Type        = "physical.impact.blunt",
                DamageRange = "1d5"
            };
            tac_flame = new AttackEffect
            {
                Type        = "energetic.fire",
                DamageRange = "1d3 - 1"
            };
            tac.AttackEffects.Add(tac_impact);
            tac.AttackEffects.Add(tac_flame);

            // Brekka-onu's Flame Hammer, bigger crunch, bigger burn
            bfh        = new AttackMethod();
            bfh_impact = new AttackEffect
            {
                Type        = "physical.impact.blunt",
                DamageRange = "2d6 + 4"
            };
            bfh_flame = new AttackEffect
            {
                Type        = "energetic.fire",
                DamageRange = "1d4 + 2"
            };
            bfh.AttackEffects.Add(bfh_impact);
            bfh.AttackEffects.Add(bfh_flame);

            leather_armor = new DefenseMethod();
            leather_armor.Resistances["physical.impact.blunt"] = "1/4 ..4";
            leather_armor.Resistances["physical"]  = "1/2 ..4";
            leather_armor.Resistances["energetic"] = "2/3 ..4";
            leather_armor.Resistances["magical"]   = "1/3 ..1";
            leather_armor.Resistances["vital"]     = "1/3 ..2";
            //leather_armor.Resistances["default"] = "1/3 ..3";  //not needed with all branches covered

            ring_armor = new DefenseMethod();
            ring_armor.Resistances["physical.impact.blunt"] = "1/2 ..6";
            ring_armor.Resistances["physical"]       = "2/3 ..8";
            ring_armor.Resistances["energetic.fire"] = "2/3 ..5";
            ring_armor.Resistances["default"]        = "1/2 ..5";

            //0.2: Keep the tree of damage types in data, and type-check attacks/defenses at load time...
        }
예제 #18
0
    void Start()
    {
        //Добавить проерку на null - отсутствие аттак
        if (PassiveAttack != null && PassiveAttack.Length != 0)
        {
            CurrentPassiveAttack = PassiveAttack[0];
        }


        if (ActiveAttacks != null && ActiveAttacks.Length != 0)
        {
            CurrentActiveAttack = ActiveAttacks[0];
        }
    }
예제 #19
0
 void attackInput(AttackMethod attackSlot)
 {
     if (attackSlot != null)
     {
         if (attackSlot.AttackInput())
         {
             attackSlot.OnFire(CurrentCharacter.stats);
         }
         else
         {
             attackSlot.ClearAttackEffects();
         }
     }
 }
        public void InvokeAction(EnviromentEventArgument args)
        {
            base.InvokeAction(args);

            if (Victim == null)
            {
                return; // cancel or failure to select.
            }
            AttackMethod.InvokeAction(new EnviromentEventArgument(
                                          args,
                                          args.Invokee,
                                          new GameObject[] { Victim },
                                          args.Frame
                                          ));
        }
예제 #21
0
    int changeAttack(AttackMethod attackSlot, AttackMethod[] possibleAttacks, KeyCode key, int attackIndex)
    {
        if (Input.GetKeyDown(key))
        {
            attackIndex++;

            if (attackIndex >= possibleAttacks.Length)
            {
                attackIndex = 0;
            }
        }



        return(attackIndex);
    }
예제 #22
0
 public OrderInvalidReason CanBeAttacked(AttackMethod AttackMethod)
 {
     if (AttackMethod == AttackMethod.OVERRUN)
     {
         if (Units.Any(i => i.Configuration.IsEmplaceable()))
         {
             return(OrderInvalidReason.TARGET_IMMUNE);
         }
         if (!GetBaseRules().IsClear ||
             GetEdgeRules().Any(i => !i?.IsClear ?? false) ||
             GetPathOverlayRules().Any(i => !i?.IsClear ?? false))
         {
             return(OrderInvalidReason.OVERRUN_TERRAIN);
         }
     }
     return(OrderInvalidReason.NONE);
 }
예제 #23
0
        public void Nature_strikes_the_rot_through_our_hero()
        {
            GameState gs = new GameState();
            var       cm = new CompoundMap();

            cm.RotMap = new RotMap();
            gs.Map    = cm;

            var asys = new AttackSystem();

            asys.GameState = gs;
            SourceMe.InjectProperties(asys);

            var    player = BeingCreator.CreateBeing("Suvail");
            var    am     = new AttackMethod("physical.impact.blunt", "1d3 +2");
            var    rot    = new AreaRot();
            Attack attack = new Attack
            {
                Attacker      = player,
                AttackMethod  = am,
                Defender      = rot,
                DefenseMethod = rot.GetDefenseMethod(am)
            };

            Assert.That(asys.AttackQueue.Count, Is.EqualTo(0));

            asys.CheckForSpecials(attack);

            Assert.That(asys.AttackQueue.Count, Is.EqualTo(2));

            var splashBack = asys.AttackQueue.Dequeue();

            Assert.NotNull(splashBack);

            var newAttack = asys.AttackQueue.Dequeue();
            var newAM     = newAttack.AttackMethod;
            var newAE     = newAM.AttackEffects[0];

            Assert.That(newAE.Type, Is.EqualTo("vital.nature.itself"));
            Assert.That(newAttack.Defender, Is.EqualTo(rot));
            Assert.That(newAttack.Attacker, Is.EqualTo(player));
        }
예제 #24
0
 // Update is called once per frame
 void Update()
 {
     if (ActiveAttacks != null && ActiveAttacks.Length != 0)
     {
         int newIndex = changeAttack(CurrentActiveAttack, ActiveAttacks, KeyCode.Tab, currentActiveIndex);
         if (newIndex != currentActiveIndex)
         {
             currentActiveIndex          = newIndex;
             CurrentActiveAttack.enabled = false;
             CurrentActiveAttack         = ActiveAttacks[currentActiveIndex];
             CurrentActiveAttack.enabled = true;
         }
     }
     if (PassiveAttack != null && PassiveAttack.Length != 0)
     {
         currentPassiveIndex  = changeAttack(CurrentPassiveAttack, PassiveAttack, KeyCode.LeftControl, currentPassiveIndex);
         CurrentPassiveAttack = PassiveAttack[currentPassiveIndex];
     }
     attackInput(CurrentActiveAttack);
     attackInput(CurrentPassiveAttack);
 }
예제 #25
0
        public int GetRange(AttackMethod AttackMethod, bool UseSecondaryWeapon)
        {
            switch (AttackMethod)
            {
            case AttackMethod.OVERRUN: return(0);

            case AttackMethod.DIRECT_FIRE: return(CanDirectFire ? GetAdjustedRange(UseSecondaryWeapon) : 0);

            case AttackMethod.INDIRECT_FIRE: return(CanIndirectFire ? GetAdjustedRange(UseSecondaryWeapon) : 0);

            case AttackMethod.CLOSE_ASSAULT: return(CanCloseAssault ? 1 : 0);

            case AttackMethod.MINEFIELD: return(0);

            case AttackMethod.AIR: return(CanAirAttack ? 1 : 0);

            case AttackMethod.ANTI_AIRCRAFT: return(CanAntiAircraft ? GetAdjustedRange(UseSecondaryWeapon) : 0);
            }
            // Should not end up here.
            return(0);
        }
예제 #26
0
        public void Physical_impact_on_Rot_causes_splashback_damage(string damageType, bool willSplashBack)
        {
            // Anyone directly physically assaulting rot is
            // hit with immediate vital.rot.toxin damage.
            var asys = SourceMe.The <AttackSystem>();

            var    flameRat = BeingCreator.CreateBeing("flame rat");
            var    am       = new AttackMethod(damageType, "1d3 +2");
            var    rot      = new AreaRot();
            Attack attack   = new Attack
            {
                Attacker      = flameRat,
                AttackMethod  = am,
                Defender      = rot,
                DefenseMethod = rot.GetDefenseMethod(am)
            };

            Assert.That(asys.AttackQueue.Count, Is.EqualTo(0));

            asys.CheckForSpecials(attack);

            int newAttackCount = willSplashBack ? 1 : 0;

            Assert.That(asys.AttackQueue.Count, Is.EqualTo(newAttackCount));
            if (!willSplashBack)
            {
                return;
            }

            var newAttack = asys.AttackQueue.Dequeue();
            var newAM     = newAttack.AttackMethod;
            var newAE     = newAM.AttackEffects[0];

            Assert.That(newAE.Type, Is.EqualTo("vital.rot.toxin"));
            Assert.That(newAttack.Defender, Is.EqualTo(flameRat));
            Assert.That(newAttack.Attacker, Is.EqualTo(rot));
        }
예제 #27
0
 public OrderInvalidReason CanAttack(AttackMethod AttackMethod)
 {
     if (Position == null || Fired || MovedMoreThanOneTile || Carrier != null)
     {
         return(OrderInvalidReason.UNIT_NO_ACTION);
     }
     if (Status != UnitStatus.ACTIVE)
     {
         if (Configuration.UnitClass == UnitClass.MINEFIELD && AttackMethod == AttackMethod.MINEFIELD)
         {
             return(OrderInvalidReason.NONE);
         }
         return(OrderInvalidReason.UNIT_NO_ACTION);
     }
     if (AttackMethod != AttackMethod.CLOSE_ASSAULT && Moved)
     {
         return(OrderInvalidReason.UNIT_NO_ACTION);
     }
     if (MustMove())
     {
         return(OrderInvalidReason.UNIT_MUST_MOVE);
     }
     return(Configuration.CanAttack(AttackMethod));
 }
예제 #28
0
 public IEnumerable <LineOfSight> GetFieldOfSight(AttackMethod AttackMethod)
 {
     return(GetFieldOfSight(AttackMethod, Position));
 }
예제 #29
0
 //Adds an attack option to this profile
 public void AddAttackOption(string attackName, AttackMethod attackMethod, ActionGroup attackGroup, int baseDamage, int enduranceCost, string attackDescription)
 {
     AttackOption atkOpt = new AttackOption(attackName, attackMethod, attackGroup, baseDamage, enduranceCost, attackDescription);
     attackList.Add(atkOpt);
 }
예제 #30
0
 // Use this for initialization
 private void Awake()
 {
     dellsound    = gameObject.transform.parent.GetComponent <AudioSource>();
     attackMethod = gameObject.transform.parent.parent.parent.parent.GetComponent <AttackMethod>();
 }
예제 #31
0
 public IEnumerable <LineOfSight> GetFieldOfSight(int Range, Tile Tile, AttackMethod AttackMethod)
 {
     return(GetLinesOfSight(Range, Tile)
            .Where(i => CanAttack(AttackMethod, false, i, false) == OrderInvalidReason.NONE));
 }
 public Color GetRangeColor(
     LineOfSight LineOfSight, Unit Unit, AttackMethod AttackMethod)
 {
     return(HIGHLIGHT_COLORS[PosterizeLineOfSight(LineOfSight, Unit, AttackMethod)]);
 }
예제 #33
0
        public void HandleCombatResult(CombatResult CombatResult, AttackMethod AttackMethod, Army AttackingArmy)
        {
            if (Position == null)
            {
                return;
            }
            if (Passenger != null)
            {
                Passenger.HandleCombatResult(CombatResult, AttackMethod, AttackingArmy);
            }
            foreach (var unit in Position.Units.Where(i => Covers(i)).ToList())
            {
                unit.HandleCombatResult(CombatResult, AttackMethod, AttackingArmy);
            }

            switch (CombatResult)
            {
            case CombatResult.MISS:
                return;

            case CombatResult.DESTROY:
                if (Army.Match.Scenario.Rules.AllowCloseAssaultCapture &&
                    AttackMethod == AttackMethod.CLOSE_ASSAULT &&
                    Configuration.CloseAssaultCapture)
                {
                    Capture(AttackingArmy);
                }
                else
                {
                    Status = UnitStatus.DESTROYED;
                    OnDestroy?.Invoke(this, EventArgs.Empty);
                    Remove();
                }
                return;

            case CombatResult.DAMAGE:
                Status = UnitStatus.DAMAGED;
                Remove();
                return;

            case CombatResult.DISRUPT:
                Status = UnitStatus.DISRUPTED;
                if (Configuration.UnloadsWhenDisrupted && Passenger != null)
                {
                    Unload(false);
                }
                OnDisrupt?.Invoke(this, EventArgs.Empty);
                return;

            case CombatResult.DOUBLE_DISRUPT:
                if (Status == UnitStatus.DISRUPTED)
                {
                    HandleCombatResult(CombatResult.DESTROY, AttackMethod, AttackingArmy);
                }
                else
                {
                    Status = UnitStatus.DISRUPTED;
                    if (Configuration.UnloadsWhenDisrupted && Passenger != null)
                    {
                        Unload(false);
                    }
                    OnDisrupt?.Invoke(this, EventArgs.Empty);
                }
                return;
            }
        }