Beispiel #1
0
        public void ActionColorCheck(GenericAction action)
        {
            // Selection.ThisShip is null during tractor beam
            if (action == null || Selection.ThisShip == null)
            {
                return;
            }

            ActionColor color = action.Color;

            color = Selection.ThisShip.CallOnCheckActionComplexity(action, ref color);

            //AI perfroms red actions as white, because it is hard to calculate correct priority of red action
            if (color == ActionColor.Red && !(Selection.ThisShip.Owner is Players.GenericAiPlayer))
            {
                Triggers.RegisterTrigger(new Trigger()
                {
                    Name         = "Stress after red action",
                    TriggerType  = TriggerTypes.OnActionIsPerformed_System,
                    TriggerOwner = Selection.ThisShip.Owner.PlayerNo,
                    EventHandler = GetStress
                });
            }

            if (color == ActionColor.Purple)
            {
                Selection.ThisShip.State.Force--;
            }
        }
Beispiel #2
0
 private void TreatFocusAsRed(GenericAction action, ref ActionColor color)
 {
     if (action is FocusAction)
     {
         color = ActionColor.Red;
         Messages.ShowInfo(HostUpgrade.UpgradeInfo.Name + ": Focus action is treated as red");
     }
 }
Beispiel #3
0
 private void TreatThisCoordinateActionAsRed(GenericAction action, ref ActionColor color)
 {
     if (action is CoordinateAction && color == ActionColor.White)
     {
         color = ActionColor.Red;
         HostShip.OnCheckActionComplexity -= TreatThisCoordinateActionAsRed;
     }
 }
 public Decision(string name, EventHandler effect, string tooltip = null, int count = -1, ActionColor color = ActionColor.White, bool isCentered = false)
 {
     Name       = name;
     Effect     = effect;
     Tooltip    = tooltip;
     Count      = count;
     Color      = color;
     IsCentered = isCentered;
 }
Beispiel #5
0
 private void CheckWhiteActionsWhileStressed(GenericAction action, ref ActionColor color)
 {
     if (AllowedActionTypes.Contains(action.GetType()) &&
         action.Color == ActionColor.White &&
         HostShip.IsStressed)
     {
         Messages.ShowInfo(HostUpgrade.UpgradeInfo.Name + ": Action is treated as red");
         color = ActionColor.Red;
     }
 }
Beispiel #6
0
 private void CheckDecreaseComplexity(GenericAction action, ref ActionColor color)
 {
     if (action is EvadeAction && color == ActionColor.Red)
     {
         if (IsNearObstacle())
         {
             color = ActionColor.White;
         }
     }
 }
Beispiel #7
0
        private void StartSelectTemplateDecision(object sender, System.EventArgs e)
        {
            SelectBoostTemplateDecisionSubPhase selectBoostTemplateDecisionSubPhase = (SelectBoostTemplateDecisionSubPhase)Phases.StartTemporarySubPhaseNew(
                "Select boost template decision",
                typeof(SelectBoostTemplateDecisionSubPhase),
                Triggers.FinishTrigger
                );

            foreach (var move in AvailableBoostMoves)
            {
                ActionColor color = ActionColor.White;
                if (move.IsRed)
                {
                    color = ActionColor.Red;
                }
                else if (move.IsPurple)
                {
                    color = ActionColor.Purple;
                }

                selectBoostTemplateDecisionSubPhase.AddDecision(
                    move.Name,
                    delegate {
                    SelectTemplate(move);
                    DecisionSubPhase.ConfirmDecision();
                },
                    color: color,
                    isCentered: move.Template == ActionsHolder.BoostTemplates.Straight1
                    );
            }

            selectBoostTemplateDecisionSubPhase.DescriptionShort = "Select boost direction";

            selectBoostTemplateDecisionSubPhase.DefaultDecisionName = "Straight 1";

            selectBoostTemplateDecisionSubPhase.RequiredPlayer = TheShip.Owner.PlayerNo;

            selectBoostTemplateDecisionSubPhase.Start();
        }
Beispiel #8
0
 public LinkedActionInfo(Type actionType, Type actionLinkedType, ActionColor linkedColor = ActionColor.Red)
 {
     ActionType       = actionType;
     ActionLinkedType = actionLinkedType;
     LinkedColor      = linkedColor;
 }
Beispiel #9
0
 public ActionInfo(Type actionType, ActionColor color = ActionColor.White, GenericUpgrade source = null)
 {
     ActionType = actionType;
     Color      = color;
     Source     = source;
 }
Beispiel #10
0
        public string AddDecision(string name, EventHandler call, string tooltip = null, int count = -1, ActionColor color = ActionColor.White, bool isCentered = false)
        {
            int    counter = 2;
            string newName = name;

            while (decisions.Exists(n => n.Name == newName))
            {
                newName = name + " #" + counter++;
            }
            decisions.Add(new Decision(newName, call, tooltip, count, color, isCentered));

            return(newName);
        }
 public ActionColor CallOnCheckActionComplexity(GenericAction action, ref ActionColor color)
 {
     OnCheckActionComplexity?.Invoke(action, ref color);
     return(color);
 }
Beispiel #12
0
 public ActionInfo(Type actionType, ActionColor actionColor = ActionColor.White, bool canBePerformedWhileStressed = false)
 {
     ActionType  = actionType;
     ActionColor = actionColor;
     CanBePerformedWhileStressed = canBePerformedWhileStressed;
 }