private static Roll CreateTacticalActRoll(int dice, int count, int modifierValue) { if (modifierValue == 0) { return(new Roll(dice, count)); } var modifier = new RollModifiers(modifierValue); return(new Roll(dice, count, modifier)); }
private ITacticalAct CreateTacticalAct(ITacticalActScheme scheme, EffectCollection effects, Equipment equipment) { var greaterSurvivalEffect = effects.Items.OfType <SurvivalStatHazardEffect>() .OrderByDescending(x => x.Level).FirstOrDefault(); if (greaterSurvivalEffect == null) { return(new TacticalAct(scheme, scheme.Stats.Efficient, new Roll(6, 1), equipment)); } else { var effecientBuffRule = greaterSurvivalEffect.Rules .FirstOrDefault(x => x.RollType == RollEffectType.Efficient); var toHitBuffRule = greaterSurvivalEffect.Rules .FirstOrDefault(x => x.RollType == RollEffectType.ToHit); var efficientRoll = scheme.Stats.Efficient; if (effecientBuffRule != null) { var modifiers = new RollModifiers(-1); efficientRoll = new Roll(efficientRoll.Dice, efficientRoll.Count, modifiers); } Roll toHitRoll; if (toHitBuffRule == null) { toHitRoll = new Roll(6, 1); } else { var modifiers = new RollModifiers(-1); toHitRoll = new Roll(6, 1, modifiers); } return(new TacticalAct(scheme, efficientRoll, toHitRoll, equipment)); } }