Beispiel #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);
        }
Beispiel #2
0
 public bool IsActive(GetBonusDto bonus)
 {
     if (ParentAbility != null)
     {
         return(ParentAbility.IsActive(bonus));
     }
     return(true);
 }
Beispiel #3
0
        public virtual DiceRoll GetBonus(GetBonusDto bonusDto)
        {
            if (ParentAbility != null && ParentAbility.IsActive(bonusDto) && ParentAbility.IsChargeItem())
            {
                if (ParentAbility.Limit != null && ParentAbility.Limit.Amount != null &&
                    (ParentAbility.Limit.Amount.ActionRequired == RoundAction.AutoOnHit ||
                     ParentAbility.Limit.Amount.ActionRequired == RoundAction.AutoOnTakeDamage))
                {
                    return(BonusValue.GetBonus(bonusDto));
                }
                var activeAbi = bonusDto.Round.ActivatedAbilities.First(x => x.AbilityId == ParentAbility.ID);
                var charge    = ParentAbility.BonusFromCharges.First(x => x.NumberOfChargesForBonus == activeAbi.Charges);
                return(charge.Bonus);
            }
            if (ParentAbility != null && ParentAbility.IsActive(bonusDto) && ParentAbility.IsTradeOff())
            {
                var activeAbi = bonusDto.Round.ActivatedAbilities.First(x => x.AbilityId == ParentAbility.ID);

                var toTrade = 0;
                if (ParentAbility.Limit.Amount.TradeWith == this)
                {
                    toTrade = -activeAbi.Charges;
                }
                else
                {
                    toTrade = (int)(activeAbi.Charges * activeAbi.Multiplier);
                }

                return(new DiceRoll
                {
                    FixedAmount = toTrade
                });
            }


            return(BonusValue.GetBonus(bonusDto));
        }