Example #1
0
 public void AddAvailableActionEffect(ActionsList.GenericAction action)
 {
     if (CanUseActionEffect(action))
     {
         AvailableActionEffects.Add(action);
     }
 }
Example #2
0
 public void AddAvailableFreeAction(ActionsList.GenericAction action)
 {
     if (CanPerformAction(action))
     {
         AvailableFreeActionsList.Add(action);
     }
 }
Example #3
0
 public void CanPerformActions(ActionsList.GenericAction action, ref bool result)
 {
     if (Selection.ThisShip.IsAlreadyExecutedAction(action.GetType()))
     {
         result = false;
     }
 }
Example #4
0
 private void OnlyCancelCritActions(GenericShip ship, ActionsList.GenericAction action, ref bool result)
 {
     if (!action.IsCritCancelAction)
     {
         result = false;
     }
 }
Example #5
0
 public void CanPerformActions(ActionsList.GenericAction action, ref bool result)
 {
     if (Selection.ThisShip.GetToken(typeof(Tokens.StressToken)) != null)
     {
         result = false;
     }
 }
Example #6
0
 private void RegisterBurnoutSlamAbility(ActionsList.GenericAction action)
 {
     if (action != null && action.GetType() == typeof(ActionsList.SlamAction))
     {
         RegisterAbilityTrigger(TriggerTypes.OnActionIsPerformed, DiscardThisUpgrade);
     }
 }
Example #7
0
 public void CallActionIsTaken(ActionsList.GenericAction action)
 {
     if (OnActionIsPerformed != null)
     {
         OnActionIsPerformed(action);
     }
 }
Example #8
0
 private void UseHomingMissilesRestriction(ActionsList.GenericAction action, ref bool canBeUsed)
 {
     if (action.IsSpendEvade)
     {
         Messages.ShowErrorToHuman("Homing Missiles: Cannot spend evade");
         canBeUsed = false;
     }
 }
Example #9
0
 public void RemoveActionbarAction(System.Type type)
 {
     ActionsList.GenericAction action = ActionbarActions.Find(n => n.GetType() == type);
     if (action != null)
     {
         ActionbarActions.Remove(action);
     }
 }
Example #10
0
 public void AddActionbarAction(ActionsList.GenericAction action, bool isPrinted)
 {
     ActionbarActions.Add(action);
     if (isPrinted)
     {
         PrintedActionsbaActions.Add(action);
     }
 }
Example #11
0
 private void UseFennRauRestriction(ActionsList.GenericAction action, ref bool canBeUsed)
 {
     if (Combat.Attacker == affectedShip && !action.IsOpposite && action.TokensSpend.Count > 0)
     {
         Messages.ShowErrorToHuman("Fenn Rau: Cannot use dice modification\n" + action.Name);
         canBeUsed = false;
     }
 }
Example #12
0
 private void FinishTractorBeamMovement(ActionsList.GenericAction action)
 {
     TheShip.CallActionIsTaken(action, delegate {
         // ^ CallActionIsTaken to support interaction with black one, etc
         Rules.AsteroidHit.CheckDamage(TheShip);
         Triggers.ResolveTriggers(TriggerTypes.OnShipMovementFinish, Next);
     });
 }
Example #13
0
 private void UseHomingMissilesRestriction(ActionsList.GenericAction action, ref bool canBeUsed)
 {
     if (action.TokensSpend.Contains(typeof(Tokens.EvadeToken)))
     {
         Messages.ShowErrorToHuman("Homing Missiles: Cannot spend evade");
         canBeUsed = false;
     }
 }
Example #14
0
 private void Use4LOMRestriction(GenericShip ship, ActionsList.GenericAction action, ref bool canBeUsed)
 {
     if (action.TokensSpend.Any(t => NamedTokenTypes.Contains(t)))
     {
         Messages.ShowErrorToHuman("4-LOM: Cannot spend " + NamedToken);
         canBeUsed = false;
     }
 }
Example #15
0
        public void CallActionIsTaken(ActionsList.GenericAction action, Action callBack)
        {
            if (OnActionIsPerformed != null)
            {
                OnActionIsPerformed(action);
            }

            Triggers.ResolveTriggers(TriggerTypes.OnActionIsPerformed, callBack);
        }
Example #16
0
 public virtual ActionsList.GenericAction GetAvailableEffects()
 {
     ActionsList.GenericAction result = null;
     if ((Action != null) && (CanBeUsed))
     {
         result = Action;
     }
     return(result);
 }
Example #17
0
 private void AfterPerformingActionRollForStress(ActionsList.GenericAction action)
 {
     Triggers.RegisterTrigger(new Trigger()
     {
         Name         = "#" + Host.ShipId + ": Wounded Pilot Crit",
         TriggerOwner = Host.Owner.PlayerNo,
         TriggerType  = TriggerTypes.OnActionIsPerformed,
         EventHandler = RollForStress
     });
 }
Example #18
0
        public bool CanPerformAction(ActionsList.GenericAction action)
        {
            bool result = action.IsActionAvailable();

            if (OnTryAddAvailableAction != null)
            {
                OnTryAddAvailableAction(action, ref result);
            }

            return(result);
        }
Example #19
0
 private void CheckCarnorJaxRestriction(GenericShip ship, ActionsList.GenericAction action, ref bool isAllowed)
 {
     if (ship.Owner != HostShip.Owner && action.TokensSpend.Any(token => token == typeof(FocusToken) || token == typeof(EvadeToken)))
     {
         BoardTools.DistanceInfo positionInfo = new BoardTools.DistanceInfo(ship, HostShip);
         if (positionInfo.Range <= 1)
         {
             Messages.ShowErrorToHuman("Carnor Jax: Cannot perform focus or evade actions, or spend focus or evade tokens");
             isAllowed = false;
         }
     }
 }
Example #20
0
 private void UseDarkCurseRestriction(GenericShip ship, ActionsList.GenericAction action, ref bool canBeUsed)
 {
     if (action.TokensSpend.Contains(typeof(Tokens.FocusToken)))
     {
         Messages.ShowErrorToHuman("Dark Curse: Cannot spend focus");
         canBeUsed = false;
     }
     if (action.IsReroll)
     {
         Messages.ShowErrorToHuman("Dark Curse: Cannot reroll");
         canBeUsed = false;
     }
 }
Example #21
0
 private void UseDarkCurseRestriction(ActionsList.GenericAction action, ref bool result)
 {
     if (action.IsSpendFocus)
     {
         Messages.ShowErrorToHuman("Dark Curse: Cannot spend focus");
         result = false;
     }
     if (action.IsReroll)
     {
         Messages.ShowErrorToHuman("Dark Curse: Cannot reroll");
         result = false;
     }
 }
Example #22
0
 private void RegisterDoDamageIfStressed(ActionsList.GenericAction action)
 {
     if (HostShip.Tokens.HasToken(typeof(StressToken)) && (action != null))
     {
         Triggers.RegisterTrigger(new Trigger()
         {
             Name         = "Check damage from \"Chopper\"",
             TriggerType  = TriggerTypes.OnActionIsPerformed,
             TriggerOwner = HostShip.Owner.PlayerNo,
             EventHandler = DoDamage,
         });
     }
 }
Example #23
0
 public override void PerformFreeAction()
 {
     if (Selection.ThisShip.GetAvailableFreeActionsList().Count > 0)
     {
         ActionsList.GenericAction action = Selection.ThisShip.GetAvailableFreeActionsList()[0];
         Selection.ThisShip.AddAlreadyExecutedAction(action);
         action.ActionTake();
     }
     else
     {
         Phases.Next();
     }
 }
Example #24
0
        private bool IsOppositeActionEffectAlreadyExecuted(ActionsList.GenericAction action)
        {
            bool result = false;

            foreach (var alreadyExecuedOppositeAction in AlreadyExecutedOppositeActionEffects)
            {
                if (alreadyExecuedOppositeAction.GetType() == action.GetType())
                {
                    result = true;
                    break;
                }
            }

            return(result);
        }
Example #25
0
        private void PerformCloak(Ship.GenericShip ship)
        {
            //TODO: filter action in window instead

            ActionsList.GenericAction cloakAction = null;
            foreach (var action in ship.BuiltInActions)
            {
                if (action.GetType() == typeof(ActionsList.CloakAction))
                {
                    cloakAction = action;
                    break;
                }
            }
            ship.BuiltInActions.Remove(cloakAction);

            ship.ChangeAgilityBy(+2);
            ship.OnTryPerformAttack       += CannotAttackWhileCloaked;
            Phases.OnActivationPhaseStart += RegisterAskDecloak;
        }
Example #26
0
        // ACTION EFFECTS

        public void GenerateAvailableActionEffectsList()
        {
            AvailableActionEffects = new List <ActionsList.GenericAction>();;

            foreach (var token in Tokens.GetAllTokens())
            {
                ActionsList.GenericAction action = token.GetAvailableEffects();
                if (action != null)
                {
                    AddAvailableActionEffect(action);
                }
            }

            if (AfterGenerateAvailableActionEffectsList != null)
            {
                AfterGenerateAvailableActionEffectsList(this);
            }

            if (AfterGenerateAvailableActionEffectsListGlobal != null)
            {
                AfterGenerateAvailableActionEffectsListGlobal();
            }
        }
Example #27
0
        public bool CanUseOppositeActionEffect(ActionsList.GenericAction action)
        {
            bool result = true;

            if (!action.IsActionEffectAvailable())
            {
                result = false;
            }

            if (IsOppositeActionEffectAlreadyExecuted(action))
            {
                result = false;
            }

            if (result)
            {
                if (OnTryAddAvailableOppositeActionEffect != null)
                {
                    OnTryAddAvailableOppositeActionEffect(action, ref result);
                }
            }

            return(result);
        }
Example #28
0
 public void RemoveAlreadyExecutedOppositeActionEffect(ActionsList.GenericAction action)
 {
     AlreadyExecutedOppositeActionEffects.RemoveAll(a => a.GetType() == action.GetType());
 }
Example #29
0
 public void AddAlreadyExecutedOppositeActionEffect(ActionsList.GenericAction action)
 {
     AlreadyExecutedOppositeActionEffects.Add(action);
 }
Example #30
0
 private bool NotAlreadyAddedSameActionEffect(ActionsList.GenericAction action)
 {
     // Return true if AvailableActionEffects doesn't contain action of the same type
     return(AvailableActionEffects.FirstOrDefault(n => n.GetType() == action.GetType()) == null);
 }