Ejemplo n.º 1
0
        public void Init()
        {
            var testBehavior = new TalentsBehavior(null);
            var warriorAttribute = new WarriorAttribute();
            var rogueAttribute = new RogueAttribute();
            var mageAttribute = new MageAttribute();
            var damageStat = new DamageStat();
            var attackStat = new AttackStat();

            this.playerThing = new Thing() { Name = "PlayerThing", ID = TestThingID.Generate("testthing") };

            playerThing.Behaviors.Add(testBehavior);

            warriorAttribute.Parent = this.playerThing;
            playerThing.AddAttribute(warriorAttribute);

            mageAttribute.Parent = this.playerThing;
            playerThing.AddAttribute(rogueAttribute);

            rogueAttribute.Parent = this.playerThing;
            playerThing.AddAttribute(mageAttribute);

            warriorAttribute.SetValue(10, playerThing);
            rogueAttribute.SetValue(10, playerThing);
            mageAttribute.SetValue(10, playerThing);

            playerThing.Stats.Add(damageStat.Name, damageStat);
            playerThing.Stats.Add(attackStat.Name, attackStat);
        }
Ejemplo n.º 2
0
        public void Init()
        {
            var testBehavior     = new TalentsBehavior(null);
            var warriorAttribute = new WarriorAttribute();
            var rogueAttribute   = new RogueAttribute();
            var mageAttribute    = new MageAttribute();
            var damageStat       = new DamageStat();

            playerThing = new Thing()
            {
                Name = "PlayerThing", Id = TestThingID.Generate("testthing")
            };

            playerThing.Behaviors.Add(testBehavior);

            warriorAttribute.Parent = playerThing;
            playerThing.AddAttribute(warriorAttribute);

            mageAttribute.Parent = playerThing;
            playerThing.AddAttribute(rogueAttribute);

            rogueAttribute.Parent = playerThing;
            playerThing.AddAttribute(mageAttribute);

            warriorAttribute.SetValue(10, playerThing);
            rogueAttribute.SetValue(10, playerThing);
            mageAttribute.SetValue(10, playerThing);

            playerThing.Stats.Add(damageStat.Name, damageStat);
        }
Ejemplo n.º 3
0
        public void Init()
        {
            this.playerThing = new Thing()
            {
                Name = "PlayerThing", Id = TestThingID.Generate("testthing")
            };

            var testBehavior     = new TalentsBehavior(null);
            var warriorAttribute = new WarriorAttribute();
            var rogueAttribute   = new RogueAttribute();
            var mageAttribute    = new MageAttribute();
            var damageStat       = new DamageStat();
            var attackStat       = new AttackStat();
            var initiativeStat   = new InitiativeStat();
            var awarenessSkill   = new SkillAwareness();

            warriorAttribute.Parent = this.playerThing;
            this.playerThing.AddAttribute(warriorAttribute);

            mageAttribute.Parent = this.playerThing;
            this.playerThing.AddAttribute(rogueAttribute);

            rogueAttribute.Parent = this.playerThing;
            this.playerThing.AddAttribute(mageAttribute);

            warriorAttribute.SetValue(10, this.playerThing);
            rogueAttribute.SetValue(10, this.playerThing);
            mageAttribute.SetValue(10, this.playerThing);

            this.playerThing.Stats.Add(damageStat.Name, damageStat);
            this.playerThing.Stats.Add(attackStat.Name, attackStat);
            this.playerThing.Stats.Add(initiativeStat.Name, initiativeStat);
            this.playerThing.Skills.Add(awarenessSkill.Name, awarenessSkill);
            this.playerThing.Behaviors.Add(testBehavior);
        }
Ejemplo n.º 4
0
        public void AttachTalentsBehaviorToPlayerTest()
        {
            var testBehavior = new TalentsBehavior(null);

            this.playerThing.Behaviors.Add(testBehavior);
            Assert.IsNotNull(this.playerThing.Behaviors.FindFirst <TalentsBehavior>());
            this.playerThing.Behaviors.Remove(testBehavior);
        }
Ejemplo n.º 5
0
        public void AddTalentBeforeBehaviorParentSetTest()
        {
            var testTalent   = new CraftsmanTalent();
            var testBehavior = new TalentsBehavior(null);

            testBehavior.AddTalent(testTalent);
            this.playerThing.Behaviors.Add(testBehavior);
            var behavior = this.playerThing.Behaviors.FindFirst <TalentsBehavior>();

            Assert.IsTrue(behavior.ManagedTalents.Contains(testTalent));
            Assert.IsNotNull(testTalent.PlayerThing);

            behavior.RemoveTalent(testTalent);
            this.playerThing.Behaviors.Remove(testBehavior);
        }
Ejemplo n.º 6
0
        public void AddBehaviorBeforeTalentParentSetTest()
        {
            var testTalent = new CraftsmanTalent();
            var testBehavior = new TalentsBehavior(null);

            playerThing.Behaviors.Add(testBehavior);

            var behavior = playerThing.Behaviors.FindFirst<TalentsBehavior>();

            testBehavior.AddTalent(testTalent);

            Verify.IsTrue(behavior.ManagedTalents.Contains(testTalent));
            Verify.IsNotNull(testTalent.PlayerThing);

            behavior.RemoveTalent(testTalent);

            playerThing.Behaviors.Remove(testBehavior);
        }
Ejemplo n.º 7
0
        public void AddTalentWithRulesBeforeBehaviorParentSetTest()
        {
            var testBehavior     = new TalentsBehavior(null);
            var warriorAttribute = new WarriorAttribute();
            var rogueAttribute   = new RogueAttribute();
            var mageAttribute    = new MageAttribute();
            var damageStat       = new DamageStat();
            var attackStat       = new AttackStat();

            warriorAttribute.Parent = this.playerThing;
            playerThing.AddAttribute(warriorAttribute);

            mageAttribute.Parent = this.playerThing;
            playerThing.AddAttribute(rogueAttribute);

            rogueAttribute.Parent = this.playerThing;
            playerThing.AddAttribute(mageAttribute);

            warriorAttribute.SetValue(10, playerThing);
            rogueAttribute.SetValue(10, playerThing);
            mageAttribute.SetValue(10, playerThing);

            playerThing.Stats.Add(damageStat.Name, damageStat);
            playerThing.Stats.Add(attackStat.Name, attackStat);

            var testTalent = new ChampionTalent();

            playerThing.Behaviors.Add(testBehavior);

            var behavior = playerThing.Behaviors.FindFirst <TalentsBehavior>();

            behavior.AddTalent(testTalent);

            Verify.IsTrue(behavior.ManagedTalents.Contains(testTalent));
            Verify.IsNotNull(testTalent.PlayerThing);

            behavior.RemoveTalent(testTalent);

            playerThing.Behaviors.Remove(testBehavior);
        }
Ejemplo n.º 8
0
        public void AddBehaviorBeforeTalentWithRulesParentSetTest()
        {
            var testBehavior = new TalentsBehavior(null);
            var warriorAttribute = new WarriorAttribute();
            var rogueAttribute = new RogueAttribute();
            var mageAttribute = new MageAttribute();
            var damageStat = new DamageStat();
            var attackStat = new AttackStat();

            warriorAttribute.Parent = this.playerThing;
            playerThing.AddAttribute(warriorAttribute);

            mageAttribute.Parent = this.playerThing;
            playerThing.AddAttribute(rogueAttribute);

            rogueAttribute.Parent = this.playerThing;
            playerThing.AddAttribute(mageAttribute);

            warriorAttribute.SetValue(10, playerThing);
            rogueAttribute.SetValue(10, playerThing);
            mageAttribute.SetValue(10, playerThing);

            playerThing.Stats.Add(damageStat.Name, damageStat);
            playerThing.Stats.Add(attackStat.Name, attackStat);

            var testTalent = new ChampionTalent();

            playerThing.Behaviors.Add(testBehavior);

            var behavior = playerThing.Behaviors.FindFirst<TalentsBehavior>();

            testBehavior.AddTalent(testTalent);

            Verify.IsTrue(behavior.ManagedTalents.Contains(testTalent));
            Verify.IsNotNull(testTalent.PlayerThing);

            behavior.RemoveTalent(testTalent);

            playerThing.Behaviors.Remove(testBehavior);
        }
Ejemplo n.º 9
0
        public void AttachTalentsBehaviorToPlayerTest()
        {
            var testBehavior = new TalentsBehavior(null);

            playerThing.Behaviors.Add(testBehavior);

            Verify.IsNotNull(playerThing.Behaviors.FindFirst<TalentsBehavior>());

            playerThing.Behaviors.Remove(testBehavior);
        }