コード例 #1
0
    // TWIN ATTACK

    private static void CheckTwinAttack()
    {
        GenericSpecialWeapon chosenSecondaryWeapon = ChosenWeapon as GenericSpecialWeapon;

        if (chosenSecondaryWeapon != null && chosenSecondaryWeapon.WeaponInfo.TwinAttack && !Defender.IsDestroyed)
        {
            if (attacksCounter == 0)
            {
                attacksCounter++;

                //Here start attack
                AttackStep           = CombatStep.Attack;
                Selection.ActiveShip = Attacker;
                ShotStart();
            }
            else
            {
                attacksCounter = 0;
                CheckMissedAttack();
            }
        }
        else
        {
            CheckMissedAttack();
        }
    }
コード例 #2
0
            private void UseJoyRekkoffAbility(object sender, System.EventArgs e)
            {
                GenericSpecialWeapon torpedo = (GenericSpecialWeapon)HostShip.UpgradeBar.GetUpgradesOnlyFaceup().FirstOrDefault(n => n.UpgradeInfo.HasType(UpgradeType.Torpedo) && n.State.Charges > 0);

                torpedo.State.SpendCharge();
                AssignConditionToDefender();
            }
コード例 #3
0
 private void RestoreSpecialWeaponsRestrictions()
 {
     foreach (GenericUpgrade upgrade in HostShip.UpgradeBar.GetSpecialWeaponsAll())
     {
         GenericSpecialWeapon weapon = upgrade as GenericSpecialWeapon;
         weapon.WeaponInfo.ArcRestrictions.Remove(ArcType.Rear);
     }
 }
コード例 #4
0
        public Type GetWeaponAttackRequirement(GenericSpecialWeapon weapon, bool isSilent)
        {
            Type tokenTypeAttackRequirement = weapon.WeaponInfo.RequiresToken;

            GenericShip.OnModifyWeaponAttackRequirementGlobal?.Invoke(this, weapon, ref tokenTypeAttackRequirement, isSilent);
            OnModifyWeaponAttackRequirement?.Invoke(this, weapon, ref tokenTypeAttackRequirement, isSilent);

            return(tokenTypeAttackRequirement);
        }
コード例 #5
0
            protected override bool CanReRollWithWeaponClass()
            {
                if (Combat.ChosenWeapon is GenericSpecialWeapon)
                {
                    GenericSpecialWeapon upgradeWeapon = Combat.ChosenWeapon as GenericSpecialWeapon;
                    return(upgradeWeapon.HasType(UpgradeType.Missile) || upgradeWeapon.HasType(UpgradeType.Torpedo));
                }

                return(false);
            }
コード例 #6
0
        private void ChangeSpecialWeaponsRestrictions()
        {
            HostShip.OnGameStart -= ChangeSpecialWeaponsRestrictions;

            foreach (GenericUpgrade upgrade in HostShip.UpgradeBar.GetSpecialWeaponsAll())
            {
                GenericSpecialWeapon weapon = upgrade as GenericSpecialWeapon;
                weapon.WeaponInfo.ArcRestrictions.Add(ArcType.Rear);
            }
        }
コード例 #7
0
        private void Toggle360Arc(bool isActive)
        {
            GenericSpecialWeapon turret = (GenericSpecialWeapon)HostShip.UpgradeBar.GetUpgradesAll().Find(n => n.HasType(UpgradeType.Turret));

            if (turret != null)
            {
                // TODOREVERT
                //HostShip.ArcsInfo.GetArc<OutOfArc>().ShotPermissions.CanShootTurret = isActive;
                //turret.CanShootOutsideArc = isActive;
            }
        }
コード例 #8
0
 private void CheckAbility(GenericShip ship, GenericSpecialWeapon weapon, ref Type tokenType, bool isSilent)
 {
     if (ConditionsAreMet(tokenType))
     {
         if (!isSilent)
         {
             Messages.ShowInfo(string.Format("{0} ignores attack requirement", ship.PilotInfo.PilotName));
         }
         tokenType = null;
     }
 }
コード例 #9
0
 private void RestoreSpecialWeaponsRestrictions()
 {
     foreach (GenericUpgrade upgrade in HostShip.UpgradeBar.GetSpecialWeaponsAll())
     {
         GenericSpecialWeapon weapon = upgrade as GenericSpecialWeapon;
         if (weapon.HasType(UpgradeType.Cannon))
         {
             weapon.WeaponInfo.ArcRestrictions.Remove(ArcType.FullFront);
         }
     }
 }
コード例 #10
0
        public override bool IsDiceModificationAvailable()
        {
            bool result = false;
            GenericSpecialWeapon weapon = Combat.ChosenWeapon as GenericSpecialWeapon;

            if (Combat.AttackStep == CombatStep.Defence && weapon.State.UsesCharges && weapon.State.Charges > 0)
            {
                result = true;
            }

            return(result);
        }
コード例 #11
0
        private void AllowLaunchesByTargetLock(ref bool result)
        {
            GenericSpecialWeapon secondaryWeapon = Combat.ChosenWeapon as GenericSpecialWeapon;

            if (secondaryWeapon != null)
            {
                if ((secondaryWeapon.HasType(UpgradeType.Torpedo) || secondaryWeapon.HasType(UpgradeType.Missile)) && ActionsHolder.HasTargetLockOn(Selection.ThisShip, Selection.AnotherShip))
                {
                    result = false;
                }
            }
        }
コード例 #12
0
        private void AllowLowCostCannons(ref bool result)
        {
            GenericSpecialWeapon secondaryWeapon = Combat.ChosenWeapon as GenericSpecialWeapon;

            if (secondaryWeapon != null)
            {
                if (secondaryWeapon.HasType(UpgradeType.Cannon) && secondaryWeapon.UpgradeInfo.Cost <= 2)
                {
                    result = false;
                }
            }
        }
コード例 #13
0
ファイル: TIED.cs プロジェクト: jychuah/FlyCasual
        private bool IsAttackWithCannonUpgradeCost3OrFewer()
        {
            bool result = false;

            GenericSpecialWeapon secondaryWeapon = Combat.ChosenWeapon as GenericSpecialWeapon;

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

            return(result);
        }
コード例 #14
0
        private void ChangeSpecialWeaponsRestrictions()
        {
            HostShip.OnGameStart -= ChangeSpecialWeaponsRestrictions;

            foreach (GenericUpgrade upgrade in HostShip.UpgradeBar.GetSpecialWeaponsAll())
            {
                GenericSpecialWeapon weapon = upgrade as GenericSpecialWeapon;
                if (weapon.HasType(UpgradeType.Cannon))
                {
                    weapon.WeaponInfo.ArcRestrictions.Add(ArcType.FullFront);
                }
            }
        }
コード例 #15
0
        public override void ActionEffect(System.Action callBack)
        {
            GenericSpecialWeapon weapon = Combat.ChosenWeapon as GenericSpecialWeapon;

            weapon.State.SpendCharge();
            DiceRerollManager diceRerollManager = new DiceRerollManager
            {
                NumberOfDiceCanBeRerolled = 2,
                IsOpposite = true,
                CallBack   = callBack
            };

            diceRerollManager.Start();
        }
コード例 #16
0
ファイル: Outrider.cs プロジェクト: vitreuz/FlyCasual
        private void ToggleOutriderAbility(bool isActive)
        {
            GenericSpecialWeapon cannon = (GenericSpecialWeapon)HostShip.UpgradeBar.GetInstalledUpgrade(UpgradeType.Cannon);

            if (cannon != null)
            {
                /*HostShip.ArcsInfo.GetArc<ArcPrimary>().ShotPermissions.CanShootPrimaryWeapon = !isActive;
                 *
                 * HostShip.ArcsInfo.GetArc<OutOfArc>().ShotPermissions.CanShootPrimaryWeapon = !isActive;
                 * HostShip.ArcsInfo.GetArc<OutOfArc>().ShotPermissions.CanShootCannon = isActive;*/

                // TODOREVERT
                //cannon.CanShootOutsideArc = isActive;
            }
        }
コード例 #17
0
 private void CheckAbility(GenericShip ship, GenericSpecialWeapon weapon, ref Type tokenType, bool isSilent)
 {
     if (tokenType == typeof(BlueTargetLockToken) &&
         ship.Owner.PlayerNo == HostShip.Owner.PlayerNo &&
         IsInRangeFromOneToTwo(HostShip, ship) &&
         ActionsHolder.HasTargetLockOn(HostShip, Selection.AnotherShip)
         )
     {
         if (!isSilent)
         {
             Messages.ShowInfo(string.Format("{0}: {1} ignores attack requirement", HostUpgrade.UpgradeInfo.Name, ship.PilotInfo.PilotName));
         }
         tokenType = null;
     }
 }
コード例 #18
0
        private bool IsMissilesOrTorpedoesAttack()
        {
            bool result = false;

            GenericSpecialWeapon secondaryWeapon = Combat.ChosenWeapon as GenericSpecialWeapon;

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

            return(result);
        }
コード例 #19
0
        private bool IsCannonAttack()
        {
            bool result = false;

            GenericSpecialWeapon secondaryWeapon = Combat.ChosenWeapon as GenericSpecialWeapon;

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

            return(result);
        }
コード例 #20
0
        private void RegisterSaturationSalvoAbility(GenericShip host)
        {
            GenericSpecialWeapon weapon = Combat.ChosenWeapon as GenericSpecialWeapon;

            if (weapon != null)
            {
                if (weapon.HasType(UpgradeType.Torpedo) || weapon.HasType(UpgradeType.Missile))
                {
                    ActionsList.GenericAction newAction = new ActionsList.SaturationSalvoActionEffect()
                    {
                        ImageUrl = HostUpgrade.ImageUrl,
                        HostShip = host
                    };
                    host.AddAvailableDiceModification(newAction);
                }
            }
        }
コード例 #21
0
        public override bool IsDiceModificationAvailable()
        {
            bool result = false;

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

            return(result);
        }
コード例 #22
0
ファイル: SaturationSalvo.cs プロジェクト: jychuah/FlyCasual
        private void RegisterSaturationSalvoAbility()
        {
            GenericSpecialWeapon weapon = Combat.ChosenWeapon as GenericSpecialWeapon;

            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
                    });
                }
            }
        }
コード例 #23
0
        public void ShowAttackAnimationAndSound()
        {
            GenericSpecialWeapon chosenSecondaryWeapon = Combat.ChosenWeapon as GenericSpecialWeapon;

            if (chosenSecondaryWeapon == null || chosenSecondaryWeapon.HasType(UpgradeType.Cannon) || chosenSecondaryWeapon.HasType(UpgradeType.Illicit))
            { // Primary Weapons, Cannons, and Illicits (HotShotBlaster)
                Sounds.PlayShots(SoundInfo.ShotsName, SoundInfo.ShotsCount);
                AnimatePrimaryWeapon();
            }
            else if (chosenSecondaryWeapon.HasType(UpgradeType.Torpedo) || chosenSecondaryWeapon.HasType(UpgradeType.Missile))
            { // Torpedos and Missiles
                Sounds.PlayShots("Proton-Torpedoes", 1);
                AnimateMunitionsShot();
            }
            else if (chosenSecondaryWeapon.HasType(UpgradeType.Turret))
            { // Turrets
                Sounds.PlayShots(SoundInfo.ShotsName, SoundInfo.ShotsCount);
                AnimateTurretWeapon();
            }
        }
コード例 #24
0
ファイル: IG88B.cs プロジェクト: jychuah/FlyCasual
        private bool IsCannonShot(GenericShip defender, IShipWeapon weapon, bool isSilent)
        {
            bool result = false;

            GenericSpecialWeapon upgradeWeapon = weapon as GenericSpecialWeapon;

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

            return(result);
        }
コード例 #25
0
        private IShipWeapon GetWeaponByName(string weaponName)
        {
            GenericShip attacker = Roster.GetShipById("ShipId:" + int.Parse(GetString("id")));

            foreach (IShipWeapon weapon in attacker.GetAllWeapons().Where(n => n.Name == weaponName))
            {
                if (weapon.WeaponType == WeaponTypes.PrimaryWeapon)
                {
                    return(weapon);
                }
                else
                {
                    GenericSpecialWeapon secUpgrade = weapon as GenericSpecialWeapon;

                    if (secUpgrade == null)
                    {
                        continue;
                    }

                    if (!secUpgrade.State.IsFaceup)
                    {
                        continue;
                    }
                    if (secUpgrade.State.UsesCharges && secUpgrade.State.Charges == 0)
                    {
                        continue;
                    }

                    if (secUpgrade.UpgradeInfo.Name == weaponName)
                    {
                        return(weapon);
                    }
                }
            }

            return(null);
        }