Ejemplo n.º 1
0
            private void UseJoyRekkoffAbility(object sender, System.EventArgs e)
            {
                GenericSecondaryWeapon torpedo = (GenericSecondaryWeapon)HostShip.UpgradeBar.GetUpgradesOnlyFaceup().FirstOrDefault(n => n.Types.Contains(UpgradeType.Torpedo) && n.Charges > 0);

                torpedo.SpendCharge();
                AssignConditionToDefender();
            }
Ejemplo n.º 2
0
 public void CallUpdateWeaponRange(GenericSecondaryWeapon weapon, ref int minRange, ref int maxRange)
 {
     if (OnUpdateWeaponRange != null)
     {
         OnUpdateWeaponRange(weapon, ref minRange, ref maxRange);
     }
 }
Ejemplo n.º 3
0
 private void Toggle360Arc(bool isActive)
 {
     GenericSecondaryWeapon turret = (GenericSecondaryWeapon)HostShip.UpgradeBar.GetUpgradesAll().Find(n => n.HasType(UpgradeType.Turret));
     if (turret != null)
     {
         HostShip.ArcInfo.GetArc<OutOfArc>().ShotPermissions.CanShootTurret = isActive;
         turret.CanShootOutsideArc = isActive;
     }
 }
Ejemplo n.º 4
0
            protected override bool CanReRollWithWeaponClass()
            {
                if (Combat.ChosenWeapon is GenericSecondaryWeapon)
                {
                    GenericSecondaryWeapon upgradeWeapon = Combat.ChosenWeapon as GenericSecondaryWeapon;
                    return(upgradeWeapon.HasType(UpgradeType.Missile) || upgradeWeapon.HasType(UpgradeType.Torpedo));
                }

                return(false);
            }
Ejemplo n.º 5
0
        private void AllowLaunchesByTargetLock(ref bool result)
        {
            GenericSecondaryWeapon secondaryWeapon = Combat.ChosenWeapon as GenericSecondaryWeapon;

            if (secondaryWeapon != null)
            {
                if ((secondaryWeapon.hasType(UpgradeType.Torpedo) || secondaryWeapon.hasType(UpgradeType.Missile)) && Actions.HasTargetLockOn(Selection.ThisShip, Selection.AnotherShip))
                {
                    result = false;
                }
            }
        }
Ejemplo n.º 6
0
        private void AllowLowCostCannons(ref bool result)
        {
            GenericSecondaryWeapon secondaryWeapon = Combat.ChosenWeapon as GenericSecondaryWeapon;

            if (secondaryWeapon != null)
            {
                if (secondaryWeapon.Type == UpgradeType.Cannon && secondaryWeapon.Cost <= 2)
                {
                    result = true;
                }
            }
        }
Ejemplo n.º 7
0
 private void ToggleAbility(bool isActive)
 {
     HostShip.ArcInfo.OutOfArcShotPermissions.CanShootTorpedoes = isActive;
     foreach (GenericUpgrade torpedo in HostShip.UpgradeBar.GetInstalledUpgrades(UpgradeType.Torpedo))
     {
         GenericSecondaryWeapon torpedoWeapon = torpedo as GenericSecondaryWeapon;
         if (torpedoWeapon != null)
         {
             torpedoWeapon.CanShootOutsideArc = isActive;
         }
     }
 }
Ejemplo n.º 8
0
        private bool IsAttackWithCannonUpgradeCost3OrFewer()
        {
            bool result = false;

            GenericSecondaryWeapon secondaryWeapon = Combat.ChosenWeapon as GenericSecondaryWeapon;

            if (secondaryWeapon != null && secondaryWeapon.HasType(UpgradeType.Cannon) && secondaryWeapon.Cost <= 3)
            {
                result = true;
            }

            return(result);
        }
Ejemplo n.º 9
0
        private void ToggleOutriderAbility(bool isActive)
        {
            GenericSecondaryWeapon cannon = (GenericSecondaryWeapon)Host.UpgradeBar.GetUpgradesAll().Find(n => n.Type == UpgradeType.Cannon);

            if (cannon != null)
            {
                Host.ArcInfo.OutOfArcShotPermissions.CanShootPrimaryWeapon = !isActive;
                Host.ArcInfo.GetPrimaryArc().ShotPermissions.CanShootPrimaryWeapon = !isActive;

                Host.ArcInfo.OutOfArcShotPermissions.CanShootCannon = isActive;
                cannon.CanShootOutsideArc = isActive;
            }
        }
Ejemplo n.º 10
0
        private void ToggleOutriderAbility(bool isActive)
        {
            GenericSecondaryWeapon cannon = (GenericSecondaryWeapon)HostShip.UpgradeBar.GetInstalledUpgrade(UpgradeType.Cannon);

            if (cannon != null)
            {
                HostShip.ArcInfo.GetArc <ArcPrimary>().ShotPermissions.CanShootPrimaryWeapon = !isActive;

                HostShip.ArcInfo.GetArc <OutOfArc>().ShotPermissions.CanShootPrimaryWeapon = !isActive;
                HostShip.ArcInfo.GetArc <OutOfArc>().ShotPermissions.CanShootCannon        = isActive;

                cannon.CanShootOutsideArc = isActive;
            }
        }
Ejemplo n.º 11
0
 private void CheckAbility(GenericSecondaryWeapon weapon, ref int minRange, ref int maxRange)
 {
     if (weapon.Types.Contains(UpgradeType.Missile) || weapon.Types.Contains(UpgradeType.Torpedo))
     {
         if (minRange > 0)
         {
             minRange--;
         }
         if (maxRange < 3)
         {
             maxRange++;
         }
     }
 }
Ejemplo n.º 12
0
        public override bool IsActionEffectAvailable()
        {
            bool result = false;

            if (Combat.AttackStep == CombatStep.Attack && !(Source as UpgradesList.GuidanceChips).isUsed)
            {
                GenericSecondaryWeapon secondaryWeapon = (Combat.ChosenWeapon as GenericSecondaryWeapon);
                if (secondaryWeapon.Type == UpgradeType.Torpedo || secondaryWeapon.Type == UpgradeType.Missile)
                {
                    result = true;
                }
            }

            return(result);
        }
Ejemplo n.º 13
0
        private bool IsCannonAttack()
        {
            bool result = false;

            GenericSecondaryWeapon secondaryWeapon = Combat.ChosenWeapon as GenericSecondaryWeapon;

            if (secondaryWeapon != null)
            {
                if (secondaryWeapon.HasType(UpgradeType.Cannon))
                {
                    result = true;
                }
            }

            return(result);
        }
Ejemplo n.º 14
0
        private bool IsMissilesOrTorpedoesAttack()
        {
            bool result = false;

            GenericSecondaryWeapon secondaryWeapon = Combat.ChosenWeapon as GenericSecondaryWeapon;

            if (secondaryWeapon != null)
            {
                if (secondaryWeapon.HasType(UpgradeType.Torpedo) || secondaryWeapon.HasType(UpgradeType.Missile))
                {
                    result = true;
                }
            }

            return(result);
        }
Ejemplo n.º 15
0
        private bool IsCannonShot(GenericShip defender, IShipWeapon weapon)
        {
            bool result = false;

            GenericSecondaryWeapon upgradeWeapon = weapon as GenericSecondaryWeapon;

            if (upgradeWeapon != null && upgradeWeapon.HasType(UpgradeType.Cannon))
            {
                result = true;
            }
            else
            {
                Messages.ShowError("Attack must be performed from Cannon");
            }

            return(result);
        }
Ejemplo n.º 16
0
        public override bool IsActionEffectAvailable()
        {
            bool result = false;

            if (Combat.AttackStep == CombatStep.Attack && !(Source.UpgradeAbilities[0] as GuidanceChipsAbility).IsGuidanceChipsAbilityUsed())
            {
                GenericSecondaryWeapon secondaryWeapon = (Combat.ChosenWeapon as GenericSecondaryWeapon);
                if (secondaryWeapon != null)
                {
                    if (secondaryWeapon.HasType(UpgradeType.Torpedo) || secondaryWeapon.HasType(UpgradeType.Missile))
                    {
                        result = true;
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 17
0
        private void RegisterSaturationSalvoAbility()
        {
            GenericSecondaryWeapon weapon = Combat.ChosenWeapon as GenericSecondaryWeapon;

            if (weapon != null)
            {
                if (weapon.HasType(UpgradeType.Torpedo) || weapon.HasType(UpgradeType.Missile))
                {
                    Triggers.RegisterTrigger(
                        new Trigger()
                    {
                        Name         = "Saturation Salvo",
                        TriggerType  = TriggerTypes.OnAttackMissed,
                        TriggerOwner = HostShip.Owner.PlayerNo,
                        EventHandler = SaturationSalvoDamage
                    });
                }
            }
        }