public void AlwaysRoundDownStats() { var stat = new BasicStat(2); stat.AddModifier(new BasicStatModifier(-1, "Food")); stat.AddModifier(new BasicStatModifier(0.667f, "Because")); Assert.AreEqual(-1, stat.SumBasicModifiers); Assert.AreEqual(1, stat.TotalValue); }
public void AlwaysRoundDownStats() { var stat = new BasicStat("TestStat", 2); stat.AddModifier(new ValueStatModifier(-1)); stat.AddModifier(new ValueStatModifier(0.667f)); Assert.Equal(-1, stat.SumBasicModifiers()); Assert.Equal(1, stat.TotalValue); }
public void StatsTotalUpAdjustments() { var stat = new BasicStat("TestStat", 10); stat.AddModifier(new ValueStatModifier(5)); Assert.Equal(15, stat.TotalValue); }
public void Initialize(ComponentContainer components) { this.components = components; var abilityScores = components.Get <AbilityScores>(); roundsPerDay.AddModifier(abilityScores.GetStatModifier(AbilityScoreTypes.Charisma)); var bardLevel = components.Get <ClassLevel>(); roundsPerDay.AddModifier( new DelegateStatModifier( roundsPerDay.Name, "level-up", () => { return((bardLevel.Level - 1) * 2); } ) ); }
public void StatsTotalUpAdjustments() { var stat = new BasicStat(10); stat.AddModifier(new BasicStatModifier(5, "Foo")); Assert.AreEqual(15, stat.TotalValue); }
public void FormatNiceStringVersionOfStat() { var stat = new BasicStat("TestStat", 20); IValueStatModifier mod = new ConditionalStatModifier(new ValueStatModifier("Attack Bonus", 3, "bonus"), "vs. Thor"); stat.AddModifier(mod); Assert.Equal("Fight +20 (+23 vs. Thor)", stat.ToString("Fight")); }
public void FormatNiceStringVersionOfStat() { var stat = new BasicStat(20); BasicStatModifier mod = new ConditionalStatModifier("vs. Thor", "Attack Bonus", 3, "bonus", "Food"); stat.AddModifier(mod); Assert.AreEqual("Fight +20 (+23 vs. Thor)", stat.ToString("Fight")); }
public void StatsCanHaveAListOfConditionalModifiers() { var stat = new BasicStat("TestStat", 10); stat.AddModifier( new ConditionalStatModifier(new ValueStatModifier("Skill", 3, "bonus"), "vs. Corgis") ); stat.AddModifier( new ConditionalStatModifier(new ValueStatModifier("Skill", 3, "bonus"), "vs. Corgis") ); stat.AddModifier( new ConditionalStatModifier(new ValueStatModifier("Skill", 3, "bonus"), "Trapfinding") ); Assert.Equal(2, stat.GetConditions().Count()); Assert.True(stat.GetConditions().Any(x => x == "vs. Corgis")); Assert.True(stat.GetConditions().Any(x => x == "Trapfinding")); }
public void StatsCanHaveMaximumValuesThatClampTheResult() { var stat = new BasicStat("Stat 1"); stat.Maximum = 29; var mod = new ValueStatModifier(30); stat.AddModifier(mod); Assert.Equal(stat.TotalValue, 29); }
public void CastingDoesntBreakConditionalModifiers() { var stat = new BasicStat("TestStat", 10); IValueStatModifier mod = new ConditionalStatModifier(new ValueStatModifier("Attack Bonus", 3, "bonus"), "vs. Thor"); stat.AddModifier(mod); Assert.Equal(1, stat.GetConditions().Count()); Assert.Equal(10, stat.TotalValue); Assert.Equal(13, stat.GetConditionalValue("vs. Thor")); }
public void StatsCanHaveAMinimumValueThatClampTheResult() { var stat = new BasicStat("Stat!"); stat.Minimum = 3; var mod = new ValueStatModifier(-20); stat.AddModifier(mod); Assert.Equal(stat.TotalValue, 3); }
public void StatModifiersCanHaveConditionalModifiers() { var stat = new BasicStat(10); var mod = new ConditionalStatModifier("vs. Giants", "Skill", 5, "bonus", "Feat"); stat.AddModifier(mod); Assert.AreEqual(10, stat.TotalValue); Assert.AreEqual(15, stat.GetConditionalValue("vs. Giants")); Assert.AreEqual(1, stat.GetConditions().Count()); Assert.AreEqual("vs. Giants", stat.GetConditions().First()); }
public void StatsRaiseModifiedEventWhenAdjustmentAdded() { var stat = new BasicStat(20); var changeCalled = false; stat.Modified += (object sender, BasicStatModifiedEventArgs e) => { changeCalled = true; }; stat.AddModifier(new BasicStatModifier()); Assert.True(changeCalled); }
public void AddModifier(IStatisticModifier modifier) { baseRangeAttackBonus.AddModifier(modifier); }
public void AddModifier(IStatisticModifier modifier) { amount.AddModifier(modifier); }