Exemplo n.º 1
0
 public abstract string GetUpgradeImageUrl(GenericUpgrade upgrade);
Exemplo n.º 2
0
 private static void OpenSelectUpgradeMenu(UpgradeSlot slot, GenericUpgrade upgrade)
 {
     CurrentUpgradeSlot = slot;
     MainMenu.CurrentMainMenu.ChangePanel("SelectUpgradePanel");
 }
Exemplo n.º 3
0
 protected void DiscardUpgrade(GenericUpgrade upgrade)
 {
     Sounds.PlayShipSound(GetRandomLine());
     upgrade.TryDiscard(ConfirmDecision);
 }
Exemplo n.º 4
0
 public UpgradeSlotPanel(GenericUpgrade upgrade, UpgradeType slotType, GameObject panel)
 {
     Upgrade  = upgrade;
     SlotType = slotType;
     Panel    = panel;
 }
Exemplo n.º 5
0
 private void SelectBomb(GenericUpgrade timedBombUpgrade)
 {
     BombsManager.CurrentBomb = timedBombUpgrade as GenericTimedBomb;
     DecisionSubPhase.ConfirmDecision();
 }
Exemplo n.º 6
0
        public void RemoveGrantedAction(Type actionType, GenericUpgrade source)
        {
            AddedAction actionToRemove = AddedActions.First(n => n.Action.GetType() == actionType && n.Source == source);

            AddedActions.Remove(actionToRemove);
        }
Exemplo n.º 7
0
 private static void SelectBomb(GenericUpgrade timedBombUpgrade)
 {
     CurrentBomb = timedBombUpgrade as GenericTimedBomb;
     DecisionSubPhase.ConfirmDecision();
 }
Exemplo n.º 8
0
 public virtual void AdaptUpgradeToRules(GenericUpgrade upgrade)
 {
 }
Exemplo n.º 9
0
 public virtual void ActivateGenericUpgradeAbility(GenericUpgrade upgrade)
 {
 }
Exemplo n.º 10
0
    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;
            }
        }
    }
Exemplo n.º 11
0
 private void TractorBeamRemoved(GenericUpgrade upgrade)
 {
     TractorBeamSlot.OnRemovePreInstallUpgrade -= TractorBeamRemoved;
     this.Slot.RemovePreInstallUpgrade();
 }
Exemplo n.º 12
0
 private void UpgradeCardIsSelected(int index, GenericUpgrade illicitUpgrade)
 {
     SelectedUpgrades[index]     = illicitUpgrade;
     SelectedUpgradeSlots[index] = illicitUpgrade.Slot;
     DecisionSubPhase.ConfirmDecision();
 }
Exemplo n.º 13
0
        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);
            }
        }
Exemplo n.º 14
0
        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);
            }
        }
Exemplo n.º 15
0
 public void AddActionLink(Type actionType, GenericAction link, GenericUpgrade source = null)
 {
     LinkedActions.Add(new KeyValuePair <Type, GenericAction>(actionType, link));
 }
Exemplo n.º 16
0
 public static string GetImageUrl(GenericUpgrade upgrade, string filename = null)
 {
     return(Edition.Current.GetUpgradeImageUrl(upgrade, filename));
 }
Exemplo n.º 17
0
        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);
        }
Exemplo n.º 18
0
 public static string GetImageUrlOld(GenericUpgrade upgrade, string filename = null)
 {
     return(GetImageUrlOld(UpgradesPath + FormatUpgradeTypes(upgrade.UpgradeInfo.UpgradeTypes), FormatUpgradeName(upgrade.UpgradeInfo.Name), filename));
 }
Exemplo n.º 19
0
        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;
            }
        }
Exemplo n.º 20
0
 public ActionInfo(Type actionType, ActionColor color = ActionColor.White, GenericUpgrade source = null)
 {
     ActionType = actionType;
     Color      = color;
     Source     = source;
 }
Exemplo n.º 21
0
        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);
                }
            }
        }
Exemplo n.º 22
0
 public override string GetUpgradeImageUrl(GenericUpgrade upgrade)
 {
     return(RootUrlForImages + "upgrades/" + ImageUrls.FormatUpgradeTypes(upgrade.UpgradeInfo.UpgradeTypes) + "/" + ImageUrls.FormatName(ImageUrls.FormatUpgradeName(upgrade.UpgradeInfo.Name)) + ".png");
 }
Exemplo n.º 23
0
        private static void SelectUpgradeClicked(UpgradeSlot slot, GenericUpgrade upgrade)
        {
            InstallUpgrade(slot, upgrade);

            MainMenu.CurrentMainMenu.ChangePanel("ShipSlotsPanel");
        }
Exemplo n.º 24
0
 private static void SelectBomb(GenericUpgrade device)
 {
     CurrentDevice = device;
     DecisionSubPhase.ConfirmDecision();
 }
Exemplo n.º 25
0
 private void RecoverCharge(GenericUpgrade upgrade)
 {
     upgrade.State.RestoreCharge();
     ConfirmDecision();
 }
Exemplo n.º 26
0
 public UpgradeRecord(Type type)
 {
     Instance = (GenericUpgrade)System.Activator.CreateInstance(type);
     Edition.Current.AdaptUpgradeToRules(Instance);
 }
Exemplo n.º 27
0
 private static void RemoveInstalledUpgrade(UpgradeSlot slot, GenericUpgrade upgrade)
 {
     slot.RemovePreInstallUpgrade();
     // check if upgrade is multi-slotted
     ShowPilotWithSlots();
 }
Exemplo n.º 28
0
 public AddedAction(GenericAction action, GenericUpgrade source)
 {
     Action = action;
     Source = source;
 }
Exemplo n.º 29
0
 private static void InstallUpgrade(UpgradeSlot slot, GenericUpgrade upgrade)
 {
     slot.PreInstallUpgrade(upgrade, CurrentSquadBuilderShip.Instance);
 }
Exemplo n.º 30
0
        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);
                }
            }
        }