示例#1
0
        public DiceRoll GetBonus(GetBonusDto bonusDto)
        {
            var diceRoll   = new DiceRoll();
            var totalBonus = FixedValue.GetValueOrDefault();

            if (AbilityModifyer != null)
            {
                totalBonus += bonusDto.Abilities.First(x => x.Ability.ID == AbilityModifyer.ID).GetCurrentModifier(bonusDto);
            }
            else if (ClassProgression != null && ClassProgression.Any())
            {
                var progressions = ClassProgression.Where(x => x.AtLevel <= bonusDto.Classes.FirstOrDefault(y => y.Class.ID == x.ClassProgression.ID)?.Level).OrderByDescending(x => x.AtLevel).FirstOrDefault();
                if (progressions != null)
                {
                    diceRoll += progressions.Bonues;
                }
            }
            diceRoll.AddFixedAmount(totalBonus);
            if (Dice != null)
            {
                diceRoll.AddDice(Dice.GetDice());
            }

            return(diceRoll);
        }
示例#2
0
 private void CheckAbility(DiceRoll diceroll)
 {
     if (diceroll.Type == DiceKind.Defence && diceroll.CheckType == DiceRollCheckType.Combat && Combat.Attacker.Tokens.HasToken <JamToken>())
     {
         Messages.ShowInfo("Captain Feroph is being attacked by a Jammed attacker and gains +1 Evade result");
         diceroll.AddDice(DieSide.Success).ShowWithoutRoll();
         diceroll.OrganizeDicePositions();
     }
 }
示例#3
0
 private void CheckAbility(DiceRoll diceroll)
 {
     if (diceroll.Type == DiceKind.Defence && diceroll.CheckType == DiceRollCheckType.Combat && Combat.Attacker.Tokens.HasToken <JamToken>())
     {
         Messages.ShowInfo("Captain Feroph: Evade result is added");
         diceroll.AddDice(DieSide.Success).ShowWithoutRoll();
         diceroll.OrganizeDicePositions();
         diceroll.UpdateDiceCompareHelperPrediction();
     }
 }
示例#4
0
        private void ModifyDice(DiceRoll roll)
        {
            int enemyShipsAtRangeOne = BoardTools.Board.GetShipsAtRange(Combat.Defender, new Vector2(0, 1), Team.Type.Enemy).Count;

            if (Combat.AttackStep == CombatStep.Defence && Combat.Defender == HostShip && enemyShipsAtRangeOne > 0)
            {
                Messages.ShowInfo("Norra Wexley: add evade dice enemy range 1.");
                roll.AddDice(DieSide.Success).ShowWithoutRoll();
                roll.OrganizeDicePositions();
            }
        }
 protected virtual void ApplyReinforceEffect(DiceRoll diceroll)
 {
     if (diceroll.Type == DiceKind.Defence && diceroll.CheckType == DiceRollCheckType.Combat)
     {
         if (RuleSets.RuleSet.Instance.ReinforceEffectCanBeUsed(Facing))
         {
             Messages.ShowInfo("Reinforce: Evade result is added");
             diceroll.AddDice(DieSide.Success).ShowWithoutRoll();
             diceroll.OrganizeDicePositions();
         }
     }
 }
 protected virtual void ApplyReinforceEffect(DiceRoll diceroll)
 {
     if (diceroll.Type == DiceKind.Defence && diceroll.CheckType == DiceRollCheckType.Combat)
     {
         if (Editions.Edition.Current.ReinforceEffectCanBeUsed(Facing))
         {
             Messages.ShowInfo("Reinforce has added an Evade result");
             diceroll.AddDice(DieSide.Success).ShowWithoutRoll();
             diceroll.OrganizeDicePositions();
         }
     }
 }
示例#7
0
    public void ShowCancelled(DiceRoll defenceDiceRoll)
    {
        DiceRoll diceRollForTesting = new DiceRoll(DiceKind.Attack, 0, DiceRollCheckType.Virtual);

        foreach (Die realDie in AttackDiceroll.DiceList)
        {
            Die newDie = diceRollForTesting.AddDice(realDie.Side);
            newDie.IsUncancelable = realDie.IsUncancelable;
        }
        ;

        Dictionary <string, int> results = diceRollForTesting.CancelHitsByDefence(defenceDiceRoll.Successes, true); //Dry run to calculate results
        int cancelledRegularHits         = results["hits"];
        int cancelledCriticalHits        = results["crits"];

        List <GameObject> reversedDiceIcons = new List <GameObject>(diceIcons);

        reversedDiceIcons.Reverse();

        foreach (var diceIcon in reversedDiceIcons)
        {
            ToggleDisableDice(diceIcon, true);
        }

        foreach (var diceIcon in reversedDiceIcons)
        {
            switch (diceIcon.name)
            {
            case "Hit":
                if (cancelledRegularHits > 0)
                {
                    ToggleDisableDice(diceIcon, false);
                    cancelledRegularHits--;
                }
                ;
                break;

            case "Crit":
                if (cancelledCriticalHits > 0)
                {
                    ToggleDisableDice(diceIcon, false);
                    cancelledCriticalHits--;
                }
                ;
                break;

            default:
                break;
            }
        }
    }
示例#8
0
        private void AssaultMissilesHitEffect()
        {
            var ships = Roster.AllShips.Select(x => x.Value).ToList();

            foreach (Ship.GenericShip ship in ships)
            {
                // null refs?
                if (ship.Model == null || Combat.Defender == null || Combat.Defender.Model == null)
                {
                    continue;
                }

                // Defending ship shouldn't suffer additional damage
                if (ship.Model == Combat.Defender.Model)
                {
                    continue;
                }

                Board.ShipDistanceInformation shotInfo = new Board.ShipDistanceInformation(Combat.Defender, ship);

                if (shotInfo.Range == 1)
                {
                    //Messages.ShowErrorToHuman(string.Format("{0} is within range 1 of {1}; assault missile deals 1 damage!", ship.PilotName, Combat.Defender.PilotName));

                    var diceRoll = new DiceRoll(DiceKind.Attack, 0, DiceRollCheckType.Combat);
                    diceRoll.AddDice(DieSide.Success);
                    var hitDie = diceRoll.DiceList [0];
                    ship.AssignedDamageDiceroll.DiceList.Add(hitDie);

                    Triggers.RegisterTrigger(new Trigger()
                    {
                        Name         = "Suffer Assault Missile Damage",
                        TriggerType  = TriggerTypes.OnDamageIsDealt,
                        TriggerOwner = ship.Owner.PlayerNo,
                        EventHandler = ship.SufferDamage,
                        Skippable    = true,
                        EventArgs    = new DamageSourceEventArgs()
                        {
                            Source     = "Assault Missile",
                            DamageType = DamageTypes.CardAbility
                        }
                    });
                }
            }

            Triggers.ResolveTriggers(TriggerTypes.OnDamageIsDealt, Triggers.FinishTrigger);
        }
示例#9
0
        private void DoSplashDamage(GenericShip harpoonedShip, Action callback)
        {
            Messages.ShowInfo("\"Harpooned!\" condition deals splash damage");

            var ships = Roster.AllShips.Select(x => x.Value).ToList();

            foreach (GenericShip ship in ships)
            {
                // Defending ship shouldn't suffer additional damage
                if (ship.ShipId == harpoonedShip.ShipId)
                {
                    continue;
                }

                BoardTools.DistanceInfo distanceInfo = new BoardTools.DistanceInfo(harpoonedShip, ship);

                if (distanceInfo.Range == 1)
                {
                    var diceRoll = new DiceRoll(DiceKind.Attack, 0, DiceRollCheckType.Combat);
                    diceRoll.AddDice(DieSide.Success);
                    var hitDie = diceRoll.DiceList[0];
                    ship.AssignedDamageDiceroll.DiceList.Add(hitDie);

                    Triggers.RegisterTrigger(new Trigger()
                    {
                        Name         = "Suffer \"Harpooned!\" condition damage",
                        TriggerType  = TriggerTypes.OnDamageIsDealt,
                        TriggerOwner = ship.Owner.PlayerNo,
                        EventHandler = ship.SufferDamage,
                        Skippable    = true,
                        EventArgs    = new DamageSourceEventArgs()
                        {
                            Source     = "\"Harpooned!\" condition",
                            DamageType = DamageTypes.CardAbility
                        }
                    });
                }
            }

            Triggers.ResolveTriggers(TriggerTypes.OnDamageIsDealt, callback);
        }
示例#10
0
        private void sufferDamage()
        {
            DiceRoll damage = new DiceRoll(DiceKind.Attack, 0, DiceRollCheckType.Virtual);

            damage.AddDice(DieSide.Success);

            HostShip.AssignedDamageDiceroll.DiceList.AddRange(damage.DiceList);

            Triggers.RegisterTrigger(new Trigger()
            {
                Name         = "Suffer damage from Electronic Baffle",
                TriggerType  = TriggerTypes.OnDamageIsDealt,
                TriggerOwner = HostShip.Owner.PlayerNo,
                EventHandler = HostShip.SufferDamage,
                EventArgs    = new DamageSourceEventArgs()
                {
                    Source     = "ElectronicBaffle",
                    DamageType = DamageTypes.CardAbility
                }
            });

            Triggers.ResolveTriggers(TriggerTypes.OnDamageIsDealt, DecisionSubPhase.ConfirmDecision);
        }
示例#11
0
        private void SufferDamage(object sender, System.EventArgs e)
        {
            DiceRoll damage = new DiceRoll(DiceKind.Attack, 0, DiceRollCheckType.Virtual);

            damage.AddDice(DieSide.Success);

            Selection.ThisShip.AssignedDamageDiceroll.DiceList.AddRange(damage.DiceList);

            Triggers.RegisterTrigger(new Trigger()
            {
                Name         = "Suffer Torani Kulda's ability damage",
                TriggerType  = TriggerTypes.OnDamageIsDealt,
                TriggerOwner = Selection.ThisShip.Owner.PlayerNo,
                EventHandler = Selection.ThisShip.SufferDamage,
                Skippable    = true,
                EventArgs    = new DamageSourceEventArgs()
                {
                    Source     = "Torani Kulda",
                    DamageType = DamageTypes.CardAbility
                }
            });

            Triggers.ResolveTriggers(TriggerTypes.OnDamageIsDealt, ConfirmDecision);
        }
示例#12
0
 public override void EvadeDiceModification(DiceRoll diceRoll)
 {
     diceRoll.AddDice(DieSide.Success).ShowWithoutRoll();
 }
示例#13
0
 private void AddEvadeDie(DiceRoll diceroll)
 {
     Messages.ShowInfo("C-3PO: added evade for correct guess");
     diceroll.AddDice(DieSide.Success).ShowWithoutRoll();
     diceroll.OrganizeDicePositions();
 }