public void ActivePlayerUsingSkillWhenNonActiveThrows()
        {
            GameState state = Factory.DefaultGameState;

            state = state.UpdateCharacter(state.Party[0].WithCT(50));
            state = state.WithActivePlayerID(state.Party[0].ID);

            Skill skill = Factory.TestSkill;

            TestSkillEngine skillEngine = new TestSkillEngine();
            GameEngine      engine      = Factory.CreateGameEngine(state, skillEngine: skillEngine);

            Assert.Throws <InvalidOperationException> (() => engine.ProcessActivePlayerAction(new TargettedSkill(skill, TargettingInfo.Empty)));
        }
        public void ActiveCharacterCanUseSkill()
        {
            GameState state = Factory.DefaultGameState;

            state = state.UpdateCharacter(state.Party[0].WithCT(Time.ActionAmount));
            state = state.WithActivePlayerID(state.Party[0].ID);

            Skill skill = Factory.TestSkill;

            TestSkillEngine skillEngine       = new TestSkillEngine();
            GameEngine      engine            = Factory.CreateGameEngine(state, skillEngine: skillEngine);
            Skill           skillReportedUsed = null;

            engine.SkillUsed += (o, s) => skillReportedUsed = s.Skill;

            engine.ProcessActivePlayerAction(new TargettedSkill(skill, TargettingInfo.Self(state.Party[0])));

            Assert.Single(skillEngine.SkillsUsed);
            Assert.Contains(skillEngine.SkillsUsed, x => x.ID == skill.ID);
            Assert.Equal(skillReportedUsed, skillEngine.SkillsUsed.First());
        }
        public void CharacterBehavior_ReturnsSkill_GivenToSkillEngine()
        {
            GameState state = Factory.DefaultGameState;

            state = state.UpdateCharacter(state.Party[0].WithCT(99));

            Skill skill = Factory.TestSkill;

            TestCharacterBehavior characterBehavior = new TestCharacterBehavior();

            characterBehavior.SkillToReturn = new TargettedSkill(skill, TargettingInfo.Self(state.Party[0]));

            TestSkillEngine skillEngine = new TestSkillEngine();
            GameEngine      engine      = Factory.CreateGameEngine(state, characterBehavior, skillEngine);

            Skill skillReportedUsed = null;

            engine.SkillUsed += (o, s) => skillReportedUsed = s.Skill;
            engine.Process();

            Assert.Single(skillEngine.SkillsUsed);
            Assert.Contains(skillEngine.SkillsUsed, x => x.ID == skill.ID);
            Assert.Equal(skillReportedUsed, skillEngine.SkillsUsed.First());
        }