Esempio n. 1
0
        private void PerformFreeAction(object sender, System.EventArgs e)
        {
            Selection.ThisShip.GenerateAvailableActionsList();
            List <ActionsList.GenericAction> actions = Selection.ThisShip.GetAvailableActionsList();

            TargetShip.AskPerformFreeAction(actions, Triggers.FinishTrigger);
        }
Esempio n. 2
0
        private void GrantAction()
        {
            TargetShip.BeforeActionIsPerformed += PayForceCost;

            SelectShipSubPhase.FinishSelectionNoCallback();
            Selection.ThisShip = TargetShip;

            TargetShip.OnCheckCanPerformActionsWhileStressed += ConfirmThatIsPossible;
            TargetShip.OnCanPerformActionWhileStressed       += AlwaysAllow;

            var actions = TargetShip.GetAvailableActions();

            TargetShip.AskPerformFreeAction(
                actions,
                delegate {
                TargetShip.OnCheckCanPerformActionsWhileStressed -= ConfirmThatIsPossible;
                TargetShip.OnCanPerformActionWhileStressed       -= AlwaysAllow;

                Selection.ThisShip = HostShip;
                TargetShip.BeforeActionIsPerformed -= PayForceCost;
                Triggers.FinishTrigger();
            },
                HostShip.PilotInfo.PilotName,
                "You may perform an action, even if you is stressed.",
                HostShip
                );
        }
Esempio n. 3
0
        private void GrantAction()
        {
            TargetShip.BeforeActionIsPerformed += PayForceCost;

            SelectShipSubPhase.FinishSelectionNoCallback();
            Selection.ThisShip = TargetShip;

            var oldValue = TargetShip.CanPerformActionsWhileStressed;

            TargetShip.CanPerformActionsWhileStressed = true;
            var actions = TargetShip.GetAvailableActions();

            TargetShip.AskPerformFreeAction(
                actions,
                delegate {
                TargetShip.CanPerformActionsWhileStressed = oldValue;
                Selection.ThisShip = HostShip;
                TargetShip.BeforeActionIsPerformed -= PayForceCost;
                Triggers.FinishTrigger();
            },
                HostShip.PilotInfo.PilotName,
                "You may perform an action, even if you is stressed.",
                HostShip
                );
        }
Esempio n. 4
0
 protected void AcquireFreeTargetLock(object sender, System.EventArgs e)
 {
     TargetShip.AcquireTargetLock(() =>
     {
         Selection.ThisShip = HostShip;
         Phases.CurrentSubPhase.Resume();
         Triggers.FinishTrigger();
     });
 }
Esempio n. 5
0
 protected virtual void PerformFreeAction(object sender, System.EventArgs e)
 {
     TargetShip.AskPerformFreeAction(
         GetPossibleActions(),
         Triggers.FinishTrigger,
         "Coordinate action",
         "You are coordinated"
         );
 }
Esempio n. 6
0
 private void PerformFreeAction(object sender, System.EventArgs e)
 {
     TargetShip.AskPerformFreeAction(
         Selection.ThisShip.GetAvailablePrintedActionsList(),
         delegate
     {
         Selection.ThisShip = originalShip;
         Triggers.FinishTrigger();
     });
 }
Esempio n. 7
0
        private void TargetIsSelected()
        {
            Messages.ShowInfo("Dalan Oberos: " + TargetShip.PilotInfo.PilotName + " is selected");

            HostShip.SpendCharge();
            TargetShip.LoseShield();
            HostShip.TryRegenShields();

            SelectShipSubPhase.FinishSelection();
        }
Esempio n. 8
0
 private void PerformFreeAction()
 {
     Selection.ThisShip = TargetShip;
     TargetShip.GenerateAvailableActionsList();
     TargetShip.AskPerformFreeAction(TargetShip.GetAvailableActionsList(),
                                     delegate {
         Selection.ThisShip = HostShip;
         SelectShipSubPhase.FinishSelection();
     });
 }
Esempio n. 9
0
 private void GrantFreeFocusAction()
 {
     TargetShip.AskPerformFreeAction(
         new FocusAction()
     {
         Host = TargetShip
     },
         SelectShipSubPhase.FinishSelection
         );
 }
Esempio n. 10
0
 private void PerformFreeAction(object sender, System.EventArgs e)
 {
     TargetShip.AskPerformFreeAction(
         TargetShip.GetAvailablePrintedActionsList(),
         delegate {
         Selection.ThisShip = HostShip;
         Phases.CurrentSubPhase.Resume();
         Triggers.FinishTrigger();
     });
 }
Esempio n. 11
0
        private void TargetIsSelected()
        {
            Messages.ShowInfo("Dalan Oberos: " + TargetShip.PilotName + " is selected");

            HostShip.SpendCharge(delegate { }); // Empty delegate is safe - Sandrem
            TargetShip.LoseShield();
            HostShip.TryRegenShields();

            SelectShipSubPhase.FinishSelection();
        }
Esempio n. 12
0
        protected virtual void PerformFreeAction()
        {
            Selection.ThisShip = TargetShip;

            TargetShip.AskPerformFreeAction(
                TargetShip.GetAvailableActions(),
                delegate {
                Selection.ThisShip = HostShip;
                SelectShipSubPhase.FinishSelection();
            });
        }
Esempio n. 13
0
        private void SelectGarvenDreisAbilityTarget()
        {
            MovementTemplates.ReturnRangeRuler();

            TargetShip.AssignToken(
                new Tokens.FocusToken(),
                delegate {
                Phases.FinishSubPhase(typeof(GarvenDreisAbilityTargetSubPhase));
                CallBack();
            });
        }
Esempio n. 14
0
 private void GrantFreeFocusAction()
 {
     Selection.ThisShip = TargetShip;
     TargetShip.AskPerformFreeAction(
         new FocusAction()
     {
         HostShip = TargetShip
     },
         AfterFreeFocusAction
         );
 }
Esempio n. 15
0
        private void PerformFreeAction(object sender, System.EventArgs e)
        {
            List <GenericAction> actions = Selection.ThisShip.GetAvailableActions();

            TargetShip.AskPerformFreeAction(
                actions,
                Triggers.FinishTrigger,
                SquadLeaderUpgrade.UpgradeInfo.Name,
                "You may immediately perform 1 free action",
                SquadLeaderUpgrade
                );
        }
Esempio n. 16
0
 protected void AcquireFreeTargetLock(object sender, System.EventArgs e)
 {
     TargetShip.ChooseTargetToAcquireTargetLock(() =>
     {
         Selection.ThisShip = HostShip;
         Phases.CurrentSubPhase.Resume();
         Triggers.FinishTrigger();
     },
                                                HostUpgrade.Name,
                                                HostUpgrade.ImageUrl
                                                );
 }
Esempio n. 17
0
        protected override void PerformFreeAction(object sender, System.EventArgs e)
        {
            List <GenericAction> actions = TargetShip.GetAvailableActions();

            TargetShip.AskPerformFreeAction(
                actions,
                delegate {
                Selection.ThisShip = HostShip;
                Phases.CurrentSubPhase.Resume();
                Triggers.FinishTrigger();
            });
        }
Esempio n. 18
0
        protected virtual void PerformFreeAction(object sender, System.EventArgs e)
        {
            List <GenericAction> actions          = TargetShip.GetAvailableActions();
            List <GenericAction> actionBarActions = actions.Where(n => n.IsInActionBar).ToList();

            TargetShip.AskPerformFreeAction(
                actionBarActions,
                delegate {
                Selection.ThisShip = HostShip;
                Phases.CurrentSubPhase.Resume();
                Triggers.FinishTrigger();
            });
        }
Esempio n. 19
0
        internal override void ExecuteOrder()
        {
            List <string> result = new List <string>();

            result.Add(string.Format("Attempting to execute order: {0}", this.ToString()));

            if (WeaponToFire.HasFiredThisRound) // has already fired
            {
                result.Add(string.Format("{0} has already fired this round!", WeaponToFire.Name));
                OnMessageResult?.Invoke(this, new MessageEventArgs(result));
            }
            else if (WeaponToFire.IsDestroyed) // weapon is destroyed
            {
                result.Add(string.Format("{0} is destroyed and cannot be fired!", WeaponToFire.Name));
                OnMessageResult?.Invoke(this, new MessageEventArgs(result));
            }
            else if (!WeaponToFire.IsLoaded) // weapon not reloaded
            {
                result.Add(string.Format("{0} will be reloaded in {1} turns", WeaponToFire.Name, WeaponToFire.Reload()));
                OnMessageResult?.Invoke(this, new MessageEventArgs(result));
            }
            else if (TargetShip.HP.Current <= 0) // target is dead
            {
                result.Add("Target Already Defeated");
                OnMessageResult?.Invoke(this, new MessageEventArgs(result));
            }
            else
            {
                double distanceToTarget = CurrentShip.Position.DistanceTo(TargetShip.Position);

                if (distanceToTarget >= WeaponToFire.Range + 1) // target out of range
                {
                    result.Add("Target Out Of Range");
                    OnMessageResult?.Invoke(this, new MessageEventArgs(result));
                }
                else
                {
                    WeaponToFire.Target = TargetShip;
                    AttackResult attackResult = WeaponToFire.Fire();
                    result = result.Concat(attackResult.Messages).ToList <string>();
                    OnWeaponFired?.Invoke(this, new WeaponFiredEventArgs(CurrentShip.ID, TargetShip.ID, attackResult.IsHit, attackResult.IsCrit, WeaponToFire.FiringType, result));
                    if (attackResult.TargetDestroyed)
                    {
                        OnTargetDestroyed?.Invoke(this, new ShipEventArgs(TargetShip.ID, new List <string>()
                        {
                            string.Format("{0} was destroyed by this attack!", TargetShip.ToString())
                        }));
                    }
                }
            }
        }
Esempio n. 20
0
        private void RemoveTargetDevice()
        {
            SelectShipSubPhase.FinishSelectionNoCallback();

            HostUpgrade.State.SpendCharge();

            HostShip.Tokens.AssignToken(typeof(Tokens.DepleteToken), () =>
            {
                Sounds.PlayShipSound("R2D2-Proud");
                Messages.ShowInfo(HostName + " removes " + TargetShip.PilotInfo.PilotName);

                TargetShip.DestroyShipForced(Triggers.FinishTrigger);
            });
        }
Esempio n. 21
0
        protected virtual void PerformFreeAction()
        {
            Selection.ThisShip = TargetShip;

            TargetShip.AskPerformFreeAction(
                TargetShip.GetAvailableActions(),
                delegate {
                Selection.ThisShip = HostShip;
                SelectShipSubPhase.FinishSelection();
            },
                HostShip.PilotInfo.PilotName,
                "You may perform 1 free action",
                HostShip
                );
        }
Esempio n. 22
0
 private void GrantFreeFocusAction()
 {
     SelectShipSubPhase.FinishSelectionNoCallback();
     Selection.ThisShip = TargetShip;
     TargetShip.AskPerformFreeAction(
         new FocusAction()
     {
         HostShip = TargetShip
     },
         AfterFreeFocusAction,
         HostShip.PilotInfo.PilotName,
         "You may perform a Focus action",
         HostShip
         );
 }
Esempio n. 23
0
        protected override void PerformFreeAction()
        {
            Selection.ThisShip = TargetShip;

            TargetShip.AskPerformFreeAction(
                TargetShip.GetAvailableActionsAsRed(),
                delegate {
                Selection.ThisShip = HostShip;
                SelectShipSubPhase.FinishSelection();
            },
                HostShip.PilotInfo.PilotName,
                "You may perform an action, treating it as red",
                HostShip
                );
        }
Esempio n. 24
0
 private void AskPerformBoostAction(object sender, System.EventArgs e)
 {
     TargetShip.AskPerformFreeAction(
         new List <GenericAction>()
     {
         new BoostAction()
         {
             Color = ActionColor.Red
         }
     },
         Triggers.FinishTrigger,
         HostShip.PilotInfo.PilotName,
         "You perform a red Boost action",
         HostShip
         );
 }
Esempio n. 25
0
        private void TargetIsSelected()
        {
            SelectShipSubPhase.FinishSelectionNoCallback();

            HostShip.State.Force--;

            Selection.ChangeActiveShip(TargetShip);

            TargetShip.AskPerformFreeAction(
                new FocusAction()
            {
                Color = Actions.ActionColor.Red, CanBePerformedWhileStressed = true
            },
                FinishAbility,
                descriptionShort: HostUpgrade.UpgradeInfo.Name,
                descriptionLong: "You may perfrom a red Focus action even while stressed",
                imageHolder: HostUpgrade,
                isForced: true
                );
        }
Esempio n. 26
0
        private void SelectColonelJendonAbilityTarget()
        {
            if (TargetShip.HasToken(typeof(Tokens.BlueTargetLockToken), '*'))
            {
                Messages.ShowErrorToHuman("Only ships without blue target lock tokens can be selected");
                return;
            }

            MovementTemplates.ReturnRangeRuler();

            var token = HostShip.GetToken(typeof(Tokens.BlueTargetLockToken), '*') as Tokens.BlueTargetLockToken;

            HostShip.ReassignTargetLockToken(
                typeof(Tokens.BlueTargetLockToken),
                token.Letter,
                TargetShip,
                delegate {
                Phases.FinishSubPhase(Phases.CurrentSubPhase.GetType());
                DecisionSubPhase.ConfirmDecision();
            });
        }
Esempio n. 27
0
        private void CheckAssignStress()
        {
            ShipShotDistanceInformation shotInfo = new ShipShotDistanceInformation(HostShip, TargetShip);

            if (shotInfo.InMobileArc && shotInfo.Range >= 1 && shotInfo.Range <= 2)
            {
                Messages.ShowError(HostShip.PilotName + " assigns Stress Token\nto " + TargetShip.PilotName);
                TargetShip.AssignToken(new Tokens.StressToken(), SelectShipSubPhase.FinishSelection);
            }
            else
            {
                if (!shotInfo.InMobileArc)
                {
                    Messages.ShowError("Target is not inside Mobile Arc");
                }
                else if (shotInfo.Distance >= 3)
                {
                    Messages.ShowError("Target is outside range 2");
                }
            }
        }
Esempio n. 28
0
        private void AskToPerformRedEvadeAction()
        {
            SelectShipSubPhase.FinishSelectionNoCallback();

            Selection.ChangeActiveShip(TargetShip);

            HostShip.State.SpendForce(
                1,
                delegate
            {
                TargetShip.AskPerformFreeAction(
                    new EvadeAction()
                {
                    Color = ActionColor.Red
                },
                    Triggers.FinishTrigger,
                    descriptionShort: "Kit Fisto",
                    descriptionLong: "You must perform red Evade action",
                    imageHolder: HostUpgrade,
                    isForced: true
                    );
            }
                );
        }
Esempio n. 29
0
 protected void DecreaseAgilityValue()
 {
     TargetShip.ChangeAgilityBy(-1);
     Phases.Events.OnEndPhaseStart_NoTriggers -= DecreaseAgilityValue;
 }
Esempio n. 30
0
 protected virtual void PerformFreeAction(object sender, System.EventArgs e)
 {
     TargetShip.AskPerformFreeAction(GetPossibleActions(), Triggers.FinishTrigger);
 }