public abstract string GetUpgradeImageUrl(GenericUpgrade upgrade);
private static void OpenSelectUpgradeMenu(UpgradeSlot slot, GenericUpgrade upgrade) { CurrentUpgradeSlot = slot; MainMenu.CurrentMainMenu.ChangePanel("SelectUpgradePanel"); }
protected void DiscardUpgrade(GenericUpgrade upgrade) { Sounds.PlayShipSound(GetRandomLine()); upgrade.TryDiscard(ConfirmDecision); }
public UpgradeSlotPanel(GenericUpgrade upgrade, UpgradeType slotType, GameObject panel) { Upgrade = upgrade; SlotType = slotType; Panel = panel; }
private void SelectBomb(GenericUpgrade timedBombUpgrade) { BombsManager.CurrentBomb = timedBombUpgrade as GenericTimedBomb; DecisionSubPhase.ConfirmDecision(); }
public void RemoveGrantedAction(Type actionType, GenericUpgrade source) { AddedAction actionToRemove = AddedActions.First(n => n.Action.GetType() == actionType && n.Source == source); AddedActions.Remove(actionToRemove); }
private static void SelectBomb(GenericUpgrade timedBombUpgrade) { CurrentBomb = timedBombUpgrade as GenericTimedBomb; DecisionSubPhase.ConfirmDecision(); }
public virtual void AdaptUpgradeToRules(GenericUpgrade upgrade) { }
public virtual void ActivateGenericUpgradeAbility(GenericUpgrade upgrade) { }
private static void TryToReinstallUpgrade(SquadBuilderShip squadBuilderShip, SquadBuilderUpgrade squadUpgrade, GenericUpgrade oldUpgrade) { if (oldUpgrade.IsAllowedForShip(squadBuilderShip.Ship) && squadUpgrade.Slot.UpgradeIsAllowed(oldUpgrade)) { Dropdown upgradeDropbox = squadUpgrade.Panel.transform.GetComponent <Dropdown>(); string upgradeDropboxName = AllUpgrades.Where(n => n.UpgradeTypeName == oldUpgrade.GetType().ToString()).First().UpgradeNameWithCost; bool isFound = false; for (int i = 0; i < upgradeDropbox.options.Count; i++) { if (upgradeDropbox.options[i].text == upgradeDropboxName) { upgradeDropbox.value = i; if (squadUpgrade.Slot.InstalledUpgrade != null) { squadUpgrade.Slot.RemovePreInstallUpgrade(); } squadUpgrade.Slot.PreInstallUpgrade(oldUpgrade, squadBuilderShip.Ship); isFound = true; break; } } if (!isFound) { upgradeDropbox.value = 0; } } }
private void TractorBeamRemoved(GenericUpgrade upgrade) { TractorBeamSlot.OnRemovePreInstallUpgrade -= TractorBeamRemoved; this.Slot.RemovePreInstallUpgrade(); }
private void UpgradeCardIsSelected(int index, GenericUpgrade illicitUpgrade) { SelectedUpgrades[index] = illicitUpgrade; SelectedUpgradeSlots[index] = illicitUpgrade.Slot; DecisionSubPhase.ConfirmDecision(); }
protected virtual void TrajectorySimulatorTemplate(List <ManeuverTemplate> availableTemplates, GenericUpgrade upgrade) { if (upgrade.UpgradeInfo.SubType != UpgradeSubType.Bomb) { return; } ManeuverTemplate newTemplate = new ManeuverTemplate(ManeuverBearing.Straight, ManeuverDirection.Forward, ManeuverSpeed.Speed5); if (!availableTemplates.Any(t => t.Name == newTemplate.Name)) { availableTemplates.Add(newTemplate); } }
protected override void TrajectorySimulatorTemplate(List <ManeuverTemplate> availableTemplates, GenericUpgrade upgrade) { if (Phases.CurrentPhase.GetType() != typeof(MainPhases.SystemsPhase)) { return; } if (upgrade.UpgradeInfo.SubType != UpgradeSubType.Bomb) { return; } ManeuverTemplate newTemplate = new ManeuverTemplate(ManeuverBearing.Straight, ManeuverDirection.Forward, ManeuverSpeed.Speed5); if (!availableTemplates.Any(t => t.Name == newTemplate.Name)) { availableTemplates.Add(newTemplate); } }
public void AddActionLink(Type actionType, GenericAction link, GenericUpgrade source = null) { LinkedActions.Add(new KeyValuePair <Type, GenericAction>(actionType, link)); }
public static string GetImageUrl(GenericUpgrade upgrade, string filename = null) { return(Edition.Current.GetUpgradeImageUrl(upgrade, filename)); }
public void RemoveActionLink(Type actionType, Type linkedRedAction, GenericUpgrade source = null) { KeyValuePair <Type, GenericAction> linkToRemove = LinkedActions.FirstOrDefault(n => n.Key == actionType && n.Value.GetType() == linkedRedAction && n.Value.Source == source); LinkedActions.Remove(linkToRemove); }
public static string GetImageUrlOld(GenericUpgrade upgrade, string filename = null) { return(GetImageUrlOld(UpgradesPath + FormatUpgradeTypes(upgrade.UpgradeInfo.UpgradeTypes), FormatUpgradeName(upgrade.UpgradeInfo.Name), filename)); }
private void CalculatePriority() { // Local constants const float attackDiceChanceUnmodified = 0.5f; const float attackDiceChanceSingleModification = 0.75f; const float attackDiceChanceFullModification = 0.938f; const float potentialCritsNoReroll = 0.125f; const float potentialCritsWithReroll = 0.1875f; const float defenceDiceChanceUnmodified = 0.375f; const float defenceDiceChanceFocusModification = 0.625f; ShotInfo shotInfo = new ShotInfo(CurrentShip, TargetShip, Weapon); // Attack dice float attackDiceThrown = Weapon.WeaponInfo.AttackValue; if (shotInfo.Range <= 1 && Edition.Current.IsWeaponHaveRangeBonus(Weapon)) { attackDiceThrown++; } float attackDiceModifier = 0; float criticalHitsModifier = potentialCritsNoReroll; if (CurrentShip.Tokens.HasToken <FocusToken>() && ActionsHolder.HasTargetLockOn(CurrentShip, TargetShip)) { attackDiceModifier = attackDiceChanceFullModification; } else if (CurrentShip.Tokens.HasToken <FocusToken>() || ActionsHolder.HasTargetLockOn(CurrentShip, TargetShip)) { attackDiceModifier = attackDiceChanceSingleModification; if (ActionsHolder.HasTargetLockOn(CurrentShip, TargetShip)) { criticalHitsModifier = potentialCritsWithReroll; } } else { attackDiceModifier = attackDiceChanceUnmodified; } float potentialHits = attackDiceThrown * attackDiceModifier; // Defence dice float defenceDiceThrown = TargetShip.State.Agility; if (shotInfo.Range == 3 && !Edition.Current.IsWeaponHaveRangeBonus(Weapon)) { defenceDiceThrown++; } if (shotInfo.IsObstructedByObstacle) { defenceDiceThrown++; } float defenceDiceModifier = 0; if (TargetShip.Tokens.HasToken <FocusToken>()) { defenceDiceModifier = defenceDiceChanceFocusModification; } else { defenceDiceModifier = defenceDiceChanceUnmodified; } float potentialEvades = defenceDiceThrown * defenceDiceModifier; if (TargetShip.Tokens.HasToken <EvadeToken>() && defenceDiceThrown > 0) { potentialEvades = Math.Min(1, potentialEvades); } // Results float potentialDamage = potentialHits - potentialEvades; float potentialCrits = attackDiceThrown * criticalHitsModifier; float shipCost = TargetShip.PilotInfo.Cost; IShipWeapon currentWeapon; GenericUpgrade currentUpgrade = null; // Find the upgrade that matches our current weapon. foreach (GenericUpgrade upgrade in Selection.ThisShip.UpgradeBar.GetSpecialWeaponsActive()) { if (upgrade is GenericSpecialWeapon) { currentWeapon = (upgrade as IShipWeapon); if (currentWeapon.Name == Weapon.Name) { currentUpgrade = upgrade; break; } } } // If our current weapon uses charges and has no charges available, don't use it. if (currentUpgrade != null && Weapon.WeaponInfo.UsesCharges == true && currentUpgrade.State.Charges == 0) { Priority = 0; } else { int priority = (int)(potentialDamage * 1000f + potentialCrits * 100f + shipCost); CurrentShip.Ai.CallGetWeaponPriority(TargetShip, Weapon, ref priority); Priority = priority; } }
public ActionInfo(Type actionType, ActionColor color = ActionColor.White, GenericUpgrade source = null) { ActionType = actionType; Color = color; Source = source; }
private void AddNimbleBomberTemplates(List <ManeuverTemplate> availableTemplates, GenericUpgrade upgrade) { List <ManeuverTemplate> newTemplates = new List <ManeuverTemplate>() { new ManeuverTemplate(ManeuverBearing.Bank, ManeuverDirection.Right, ManeuverSpeed.Speed1, isBombTemplate: true), new ManeuverTemplate(ManeuverBearing.Bank, ManeuverDirection.Left, ManeuverSpeed.Speed1, isBombTemplate: true), }; foreach (ManeuverTemplate newTemplate in newTemplates) { if (!availableTemplates.Any(t => t.Name == newTemplate.Name)) { availableTemplates.Add(newTemplate); } } }
public override string GetUpgradeImageUrl(GenericUpgrade upgrade) { return(RootUrlForImages + "upgrades/" + ImageUrls.FormatUpgradeTypes(upgrade.UpgradeInfo.UpgradeTypes) + "/" + ImageUrls.FormatName(ImageUrls.FormatUpgradeName(upgrade.UpgradeInfo.Name)) + ".png"); }
private static void SelectUpgradeClicked(UpgradeSlot slot, GenericUpgrade upgrade) { InstallUpgrade(slot, upgrade); MainMenu.CurrentMainMenu.ChangePanel("ShipSlotsPanel"); }
private static void SelectBomb(GenericUpgrade device) { CurrentDevice = device; DecisionSubPhase.ConfirmDecision(); }
private void RecoverCharge(GenericUpgrade upgrade) { upgrade.State.RestoreCharge(); ConfirmDecision(); }
public UpgradeRecord(Type type) { Instance = (GenericUpgrade)System.Activator.CreateInstance(type); Edition.Current.AdaptUpgradeToRules(Instance); }
private static void RemoveInstalledUpgrade(UpgradeSlot slot, GenericUpgrade upgrade) { slot.RemovePreInstallUpgrade(); // check if upgrade is multi-slotted ShowPilotWithSlots(); }
public AddedAction(GenericAction action, GenericUpgrade source) { Action = action; Source = source; }
private static void InstallUpgrade(UpgradeSlot slot, GenericUpgrade upgrade) { slot.PreInstallUpgrade(upgrade, CurrentSquadBuilderShip.Instance); }
private void AddEmonAzzameenTemplates(List <ManeuverTemplate> availableTemplates, GenericUpgrade upgrade) { List <ManeuverTemplate> newTemplates = new List <ManeuverTemplate>() { new ManeuverTemplate(ManeuverBearing.Straight, ManeuverDirection.Forward, ManeuverSpeed.Speed3, isBombTemplate: true), new ManeuverTemplate(ManeuverBearing.Turn, ManeuverDirection.Right, ManeuverSpeed.Speed3, isBombTemplate: true), new ManeuverTemplate(ManeuverBearing.Turn, ManeuverDirection.Left, ManeuverSpeed.Speed3, isBombTemplate: true), }; foreach (ManeuverTemplate newTemplate in newTemplates) { if (!availableTemplates.Any(t => t.Name == newTemplate.Name)) { availableTemplates.Add(newTemplate); } } }