Exemple #1
0
    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);
    }
Exemple #2
0
        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);
        }
Exemple #3
0
        public void StatsTotalUpAdjustments()
        {
            var stat = new BasicStat("TestStat", 10);

            stat.AddModifier(new ValueStatModifier(5));
            Assert.Equal(15, stat.TotalValue);
        }
Exemple #4
0
        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); }
                    )
                );
        }
Exemple #5
0
    public void StatsTotalUpAdjustments()
    {
        var stat = new BasicStat(10);

        stat.AddModifier(new BasicStatModifier(5, "Foo"));
        Assert.AreEqual(15, stat.TotalValue);
    }
Exemple #6
0
        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"));
        }
Exemple #7
0
    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"));
    }
Exemple #8
0
        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"));
        }
Exemple #9
0
        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);
        }
Exemple #10
0
        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"));
        }
Exemple #11
0
        public void StatsCanHaveAMinimumValueThatClampTheResult()
        {
            var stat = new BasicStat("Stat!");

            stat.Minimum = 3;
            var mod = new ValueStatModifier(-20);

            stat.AddModifier(mod);
            Assert.Equal(stat.TotalValue, 3);
        }
Exemple #12
0
    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());
    }
Exemple #13
0
    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);
    }
Exemple #14
0
 public void AddModifier(IStatisticModifier modifier)
 {
     baseRangeAttackBonus.AddModifier(modifier);
 }
Exemple #15
0
 public void AddModifier(IStatisticModifier modifier)
 {
     amount.AddModifier(modifier);
 }