public void AddAvailableActionEffect(ActionsList.GenericAction action) { if (CanUseActionEffect(action)) { AvailableActionEffects.Add(action); } }
public void AddAvailableFreeAction(ActionsList.GenericAction action) { if (CanPerformAction(action)) { AvailableFreeActionsList.Add(action); } }
public void CanPerformActions(ActionsList.GenericAction action, ref bool result) { if (Selection.ThisShip.IsAlreadyExecutedAction(action.GetType())) { result = false; } }
private void OnlyCancelCritActions(GenericShip ship, ActionsList.GenericAction action, ref bool result) { if (!action.IsCritCancelAction) { result = false; } }
public void CanPerformActions(ActionsList.GenericAction action, ref bool result) { if (Selection.ThisShip.GetToken(typeof(Tokens.StressToken)) != null) { result = false; } }
private void RegisterBurnoutSlamAbility(ActionsList.GenericAction action) { if (action != null && action.GetType() == typeof(ActionsList.SlamAction)) { RegisterAbilityTrigger(TriggerTypes.OnActionIsPerformed, DiscardThisUpgrade); } }
public void CallActionIsTaken(ActionsList.GenericAction action) { if (OnActionIsPerformed != null) { OnActionIsPerformed(action); } }
private void UseHomingMissilesRestriction(ActionsList.GenericAction action, ref bool canBeUsed) { if (action.IsSpendEvade) { Messages.ShowErrorToHuman("Homing Missiles: Cannot spend evade"); canBeUsed = false; } }
public void RemoveActionbarAction(System.Type type) { ActionsList.GenericAction action = ActionbarActions.Find(n => n.GetType() == type); if (action != null) { ActionbarActions.Remove(action); } }
public void AddActionbarAction(ActionsList.GenericAction action, bool isPrinted) { ActionbarActions.Add(action); if (isPrinted) { PrintedActionsbaActions.Add(action); } }
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; } }
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); }); }
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; } }
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; } }
public void CallActionIsTaken(ActionsList.GenericAction action, Action callBack) { if (OnActionIsPerformed != null) { OnActionIsPerformed(action); } Triggers.ResolveTriggers(TriggerTypes.OnActionIsPerformed, callBack); }
public virtual ActionsList.GenericAction GetAvailableEffects() { ActionsList.GenericAction result = null; if ((Action != null) && (CanBeUsed)) { result = Action; } return(result); }
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 }); }
public bool CanPerformAction(ActionsList.GenericAction action) { bool result = action.IsActionAvailable(); if (OnTryAddAvailableAction != null) { OnTryAddAvailableAction(action, ref result); } return(result); }
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; } } }
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; } }
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; } }
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, }); } }
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(); } }
private bool IsOppositeActionEffectAlreadyExecuted(ActionsList.GenericAction action) { bool result = false; foreach (var alreadyExecuedOppositeAction in AlreadyExecutedOppositeActionEffects) { if (alreadyExecuedOppositeAction.GetType() == action.GetType()) { result = true; break; } } return(result); }
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; }
// 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(); } }
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); }
public void RemoveAlreadyExecutedOppositeActionEffect(ActionsList.GenericAction action) { AlreadyExecutedOppositeActionEffects.RemoveAll(a => a.GetType() == action.GetType()); }
public void AddAlreadyExecutedOppositeActionEffect(ActionsList.GenericAction action) { AlreadyExecutedOppositeActionEffects.Add(action); }
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); }