// 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(); } }
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(); }
private void RestoreSpecialWeaponsRestrictions() { foreach (GenericUpgrade upgrade in HostShip.UpgradeBar.GetSpecialWeaponsAll()) { GenericSpecialWeapon weapon = upgrade as GenericSpecialWeapon; weapon.WeaponInfo.ArcRestrictions.Remove(ArcType.Rear); } }
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); }
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); }
private void ChangeSpecialWeaponsRestrictions() { HostShip.OnGameStart -= ChangeSpecialWeaponsRestrictions; foreach (GenericUpgrade upgrade in HostShip.UpgradeBar.GetSpecialWeaponsAll()) { GenericSpecialWeapon weapon = upgrade as GenericSpecialWeapon; weapon.WeaponInfo.ArcRestrictions.Add(ArcType.Rear); } }
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; } }
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; } }
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); } } }
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); }
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; } } }
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; } } }
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); }
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); } } }
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(); }
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; } }
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; } }
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); }
private bool IsCannonAttack() { bool result = false; GenericSpecialWeapon secondaryWeapon = Combat.ChosenWeapon as GenericSpecialWeapon; if (secondaryWeapon != null) { if (secondaryWeapon.HasType(UpgradeType.Cannon)) { result = true; } } return(result); }
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); } } }
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); }
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 }); } } }
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(); } }
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); }
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); }