/// <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 static int ToKey(this ResistanceStatType stat) { return((int)stat); }
public static void Resistance_Container_With_200_Resist_Causes_0_And_Not_Negative_Values(ResistanceStatType resist) { //arrange LinearResistanceMultiplierStrategy strat = new LinearResistanceMultiplierStrategy(new ImmutableResistanceStatsContainer(ResistContainerValuesWith200())); //assert: That no resistances should produce 1.0f multipliers Assert.AreEqual(0.0f, strat.ResistanceMultiplier(resist).Multiplier); }
public static void Resistance_Container_With_Hundred_Resist_Causes_All_Zero_Values(ResistanceStatType resist) { //arrange LinearResistanceMultiplierStrategy strat = new LinearResistanceMultiplierStrategy(new ImmutableResistanceStatsContainer(ResistContainerValuesWithHundreds())); //assert: That no resistances should produce 1.0f multipliers Assert.AreEqual(0.0f, strat.ResistanceMultiplier(resist).Multiplier); }
public static void Empty_Resistance_Container_Causes_All_Default_Multipliers_To_Be_Produce(ResistanceStatType resist) { //arrange LinearResistanceMultiplierStrategy strat = new LinearResistanceMultiplierStrategy(new ImmutableResistanceStatsContainer()); //assert: That no resistances should produce 1.0f multipliers Assert.AreEqual(1.0f, strat.ResistanceMultiplier(resist).Multiplier); }