public void Test_Builder_Inits_To_Zero_With_WithStat(int value) { //arrange var builder = ImmutableStatsContainerBuilder <TStatType> .Factory.Create(); ImmutableStatsContainer <TStatType> container = null; //act foreach (TStatType statType in Enum.GetValues(typeof(TStatType))) { builder.WithStat(statType, value); } container = BuildForGeneric(builder); foreach (TStatType statType in Enum.GetValues(typeof(TStatType))) { //assert: That all values are present and zero IStatProvider <TStatType> provider = container[statType]; Assert.NotNull(provider); Assert.AreEqual(value, provider.Value); } }
public void Default_Ctor_Should_Not_Throw_On_Invalid_Stat_Access_Should_Also_Be_Null(TStatType stat) { //arrange TImmutableContainerType container = Activator.CreateInstance <TImmutableContainerType>(); //act IStatProvider <TStatType> value = container[stat]; //assert Assert.IsNull(value); }
public void Test_Builder_Inits_To_Zero_With_Defaults() { //arrange ImmutableStatsContainer <TStatType> container = BuildForGeneric(ImmutableStatsContainerBuilder <TStatType> .Factory.Create().WithDefaults()); foreach (TStatType statType in Enum.GetValues(typeof(TStatType))) { //assert: That all values are present and zero IStatProvider <TStatType> provider = container[statType]; Assert.NotNull(provider); Assert.AreEqual(0, provider.Value); } }
public FComment(string label, string valType, IFormFactory formFactory, IStatProvider statProvider, IErrorOutput errorOutput, IIlsProvider ilsProvider, IConfigManager configManager, NotificationManager notify, IOperationProgress operationProgress, ChangeTracker changeTracker) { this.configManager = configManager; this.valType = valType; this.label = label; InitializeComponent(); this.notify = notify; this.operationProgress = operationProgress; this.statProvider = statProvider; this.changeTracker = changeTracker; notify.ParentForm = this; this.formFactory = formFactory; this.errorOutput = errorOutput; this.ilsProvider = ilsProvider; FormClosing += FComment_FormClosing; Closed += FComment_Closed; }
/// <summary> /// Generates a resistance multiplier for <paramref name="resistType"/>. /// </summary> /// <param name="resistType">Type of resistance.</param> /// <returns>Float values (1.0 if no resist) that acts as a multiplier for resistance.</returns> public IMultiplierProvider ResistanceMultiplier(ResistanceStatType resistType) { //This is a simple linear multiplier increase based on resistance value. //As far as I know this is the default behaviour and can be seen described: http://azurepso.webs.com/psostatistics.htm //Where tech damage is: Damage x (1 - RES) //Check the resist container for resist values IStatProvider <ResistanceStatType> valueProvider = resistanceContainer[resistType]; //If there is no provider then we need to provide a default resist provider if (valueProvider == null) { return(new LinearResistanceMultiplierProvider()); //return default provider } //If we have a value we should compute the multiplier from it described by the 1 - (RES / 100) formula return(new LinearResistanceMultiplierProvider(valueProvider.Value)); }
public MeleeDamageResultStrategy(IStatProvider <CombatStatType> finalATP, IStatProvider <CombatStatType> targetDFP, IMultiplierProvider attackMultiplier) { if (finalATP.StatType != CombatStatType.AttackPower) { throw new ArgumentException($"Final ATP must have ATP units in {nameof(CombatStatType.AttackPower)} but had {finalATP.StatType} instead", nameof(finalATP)); } if (targetDFP.StatType != CombatStatType.DefensivePower) { throw new ArgumentException($"Target DFP must have DFP units in {nameof(CombatStatType.DefensivePower)} but had {targetDFP.StatType} instead", nameof(targetDFP)); } //CombatDamage = ((UserATP - TargetDEF) / 5) * AttackTypeMultiplier //http://www.freewebs.com/azurepso/psostatistics.htm Value = (int)(((finalATP.Value - targetDFP.Value) / 5.0f) * attackMultiplier.Multiplier); }
public MinimumBoundATPCalculationStrategy(IStatProvider <CombatStatType> baseATP, IStatProvider <CombatStatType> minimumWeaponBoundATP) { if (baseATP.StatType != CombatStatType.AttackPower) { throw new ArgumentException($"Base ATP must have ATP units in {nameof(CombatStatType.AttackPower)} but had {baseATP.StatType} instead", nameof(baseATP)); } if (minimumWeaponBoundATP.StatType != CombatStatType.AttackPower) { throw new ArgumentException($"Minimum weapon bound ATP must have ATP units in {nameof(CombatStatType.AttackPower)} but had {minimumWeaponBoundATP.StatType} instead", nameof(baseATP)); } //CombatATP = BaseATP + MimWeaponATP //Can be seen here: http://www.freewebs.com/azurepso/psostatistics.htm Value = baseATP.Value + minimumWeaponBoundATP.Value; }
public FDesktop(IFormFactory formFactory, IStatProvider statProvider, IErrorOutput errorOutput, IIlsProvider ilsProvider, IConfigManager configManager, NotificationManager notify, IOperationProgress operationProgress, ChangeTracker changeTracker) { this.configManager = configManager; InitializeComponent(); this.notify = notify; this.operationProgress = operationProgress; this.statProvider = statProvider; this.changeTracker = changeTracker; notify.ParentForm = this; this.formFactory = formFactory; this.errorOutput = errorOutput; this.ilsProvider = ilsProvider; statUser = new StatUser(); locations = new List <Location>(); apiStatWrapper = new ApiStatsWrapper(errorOutput, configManager, formFactory); FormClosing += FDesktop_FormClosing; Closed += FDesktop_Closed; }
public MonsterEntityGenerator(INamer aMonsterNamer, IStatProvider aStatProvider) { monsterNamer = aMonsterNamer; monsterStatProvider = aStatProvider; }