private void SpendBlankForEffect(DieSide side) { Combat.DiceRollAttack.RemoveType(side); DefenderSuffersDamage(); }
private void SpendDieForRemoveShieldEffect(DieSide side) { DecisionSubPhase.ConfirmDecisionNoCallback(); Combat.DiceRollAttack.RemoveType(side); DefenderSuffersDamage(); }
private void SpendDieForExposeDamageCardEffect(DieSide side) { DecisionSubPhase.ConfirmDecisionNoCallback(); Combat.DiceRollAttack.RemoveType(side); DefenderExposesDamageCard(); }
private void DontUseEmperorPalpatine() { PalpatineDieChoice = DieSide.Unknown; Messages.ShowInfo("Emperor Palpatine was not used"); }
public void SetSide(DieSide side) { Side = side; }
public void ChangeWorstResultTo(DieSide newSide) { ChangeDice(WorstResult, newSide, true); UpdateDiceCompareHelperPrediction(); }
private void CancelResultAndFinish(DieSide dieSide) { Combat.DiceRollAttack.RemoveType(dieSide); Phases.CurrentSubPhase.CallBack(); Phases.CurrentSubPhase.Resume(); }
/// <summary> /// Adds available dice modification /// </summary> protected void AddDiceModification( string name, Func <bool> isAvailable, Func <int> aiPriority, DiceModificationType modificationType, Func <int> getCount, List <DieSide> sidesCanBeSelected = null, DieSide sideCanBeChangedTo = DieSide.Unknown, DiceModificationTimingType timing = DiceModificationTimingType.Normal, bool isGlobal = false, Action <Action <bool> > payAbilityCost = null, Action payAbilityPostCost = null, bool isTrueReroll = true, bool isForcedFullReroll = false, bool isForcedModification = false ) { if (sidesCanBeSelected == null) { sidesCanBeSelected = new List <DieSide>() { DieSide.Blank, DieSide.Focus, DieSide.Success, DieSide.Crit } } ; GenericShip.EventHandlerShip DiceModification = (ship) => { CustomDiceModification diceModification = new CustomDiceModification() { Name = name, DiceModificationName = name, ImageUrl = HostImageUrl, DiceModificationTiming = timing, HostShip = HostShip, Source = HostUpgrade, CheckDiceModificationAvailable = isAvailable, GenerateDiceModificationAiPriority = aiPriority, IsForced = isForcedModification, DoDiceModification = (Action callback) => { if (payAbilityCost == null) { payAbilityCost = payCallback => payCallback(true); } payAbilityCost(success => { if (success) { GenericDiceModification( delegate { if (payAbilityPostCost != null) { payAbilityPostCost(); } callback(); }, modificationType, getCount, sidesCanBeSelected, sideCanBeChangedTo, timing, isTrueReroll, isForcedFullReroll, isForcedModification ); } else { callback(); } }); }, IsReroll = modificationType == DiceModificationType.Reroll, }; if (!isGlobal) { ship.AddAvailableDiceModificationOwn(diceModification); } else { ship.AddAvailableDiceModification(diceModification, HostShip); } }; if (!isGlobal) { switch (timing) { case DiceModificationTimingType.AfterRolled: HostShip.OnGenerateDiceModificationsAfterRolled += DiceModification; DiceModificationRemovers.Add(() => HostShip.OnGenerateDiceModificationsAfterRolled -= DiceModification); break; case DiceModificationTimingType.Normal: HostShip.OnGenerateDiceModifications += DiceModification; DiceModificationRemovers.Add(() => HostShip.OnGenerateDiceModifications -= DiceModification); break; case DiceModificationTimingType.Opposite: HostShip.OnGenerateDiceModificationsOpposite += DiceModification; DiceModificationRemovers.Add(() => HostShip.OnGenerateDiceModificationsOpposite -= DiceModification); break; case DiceModificationTimingType.CompareResults: HostShip.OnGenerateDiceModificationsCompareResults += DiceModification; DiceModificationRemovers.Add(() => HostShip.OnGenerateDiceModificationsCompareResults -= DiceModification); break; default: break; } } else { switch (timing) { case DiceModificationTimingType.AfterRolled: GenericShip.OnGenerateDiceModificationsAfterRolledGlobal += DiceModification; DiceModificationRemovers.Add(() => GenericShip.OnGenerateDiceModificationsAfterRolledGlobal -= DiceModification); break; case DiceModificationTimingType.Normal: GenericShip.OnGenerateDiceModificationsGlobal += DiceModification; DiceModificationRemovers.Add(() => GenericShip.OnGenerateDiceModificationsGlobal -= DiceModification); break; case DiceModificationTimingType.Opposite: GenericShip.OnGenerateDiceModificationsOppositeGlobal += DiceModification; DiceModificationRemovers.Add(() => GenericShip.OnGenerateDiceModificationsOppositeGlobal -= DiceModification); break; case DiceModificationTimingType.CompareResults: GenericShip.OnGenerateDiceModificationsCompareResultsGlobal += DiceModification; DiceModificationRemovers.Add(() => GenericShip.OnGenerateDiceModificationsCompareResultsGlobal -= DiceModification); break; default: break; } } }
private void DiceModificationChange(Action callback, Func <int> getCount, List <DieSide> sidesCanBeSelected, DieSide newSide) { //TODO: Change to select dice manager DieSide oldSide = DieSide.Unknown; foreach (DieSide side in sidesCanBeSelected) { if (DiceRoll.CurrentDiceRoll.HasResult(side)) { oldSide = side; break; } } if (oldSide != DieSide.Unknown) { Combat.CurrentDiceRoll.Change(oldSide, newSide, getCount()); callback(); } else { callback(); } }
/// <summary> /// Adds available dice modification /// </summary> protected void AddDiceModification(string name, Func <bool> isAvailable, Func <int> aiPriority, DiceModificationType modificationType, int count, List <DieSide> sidesCanBeSelected = null, DieSide sideCanBeChangedTo = DieSide.Unknown, DiceModificationTimingType timing = DiceModificationTimingType.Normal, bool isGlobal = false, Action <Action <bool> > payAbilityCost = null, Action payAbilityPostCost = null, bool isTrueReroll = true) { AddDiceModification( name, isAvailable, aiPriority, modificationType, delegate { return(count); }, sidesCanBeSelected, sideCanBeChangedTo, timing, isGlobal, payAbilityCost, payAbilityPostCost, isTrueReroll ); }
private void GenericDiceModification(Action callback, DiceModificationType modificationType, Func <int> getCount, List <DieSide> sidesCanBeSelected, DieSide newSide, DiceModificationTimingType timing, bool isTrueReroll = true) { switch (modificationType) { case DiceModificationType.Reroll: DiceModificationReroll(callback, getCount, sidesCanBeSelected, timing, isTrueReroll); break; case DiceModificationType.Change: DiceModificationChange(callback, getCount, sidesCanBeSelected, newSide); break; case DiceModificationType.Cancel: DiceModificationCancel(callback, sidesCanBeSelected, timing); break; case DiceModificationType.Add: DiceModificationAdd(callback, getCount, newSide); break; default: break; } }
private void ModifyDice(DieSide oldDieSide, DieSide newDieSide, int count) { DiceRoll.CurrentDiceRoll.Change(oldDieSide, newDieSide, count); }
public Die(DieSide side, bool is_selected = false) { Side = side; Selected = is_selected; }
public void ChangeOne(DieSide oldSide, DieSide newSide, bool cannotBeRerolled = false) { ChangeDice(oldSide, newSide, true, cannotBeRerolled); UpdateDiceCompareHelperPrediction(); }
private void Skip() { NamedResult = DieSide.Unknown; }
public void ChangeAll(DieSide oldSide, DieSide newSide) { ChangeDice(oldSide, newSide, false); UpdateDiceCompareHelperPrediction(); }
public bool HasResult(DieSide side) { return(DiceList.Any(n => n.Side == side)); }
public DieSide FindDieToChange(DieSide destinationSide) { if (DiceList.Count <= 0) { Messages.ShowErrorToHuman("No dice in this roll to change."); return(DieSide.Unknown); } if (destinationSide != DieSide.Blank) { if (Blanks > 0) { return(DieSide.Blank); } if (Focuses > 0) { return(DieSide.Focus); } if (Successes > 0) { return(DieSide.Success); } if (CriticalSuccesses > 0) { return(DieSide.Crit); } } else { // Asking for blanks. We could put a switch case here to account for different CheckType situations. // This currently handles CheckType == Check well, which is I think where most people would ask for a blank. if (Type == DiceKind.Attack) { if (CriticalSuccesses > 0) { return(DieSide.Crit); } if (Successes > 0) { return(DieSide.Success); } if (Focuses > 0) { return(DieSide.Focus); } if (Blanks > 0) { return(DieSide.Blank); } } else { if (Focuses > 0) { return(DieSide.Focus); } if (Successes > 0) { return(DieSide.Success); } if (Blanks > 0) { return(DieSide.Blank); } } } return(DieSide.Unknown); // We never should get here }
public void ChangeAll(DieSide oldSide, DieSide newSide, bool cannotBeRerolled = false, bool cannotBeModified = false) { ChangeDice(oldSide, newSide, false, cannotBeRerolled, cannotBeModified); UpdateDiceCompareHelperPrediction(); }
private void DontUseEmperorPalpatine(object sender, System.EventArgs e) { PalpatineDieChoice = DieSide.Unknown; Messages.ShowInfo("Emperor Palpatine not used"); DecisionSubPhase.ConfirmDecision(); }