Exemple #1
0
        public void Greater_Default()
        {
            // Arrange
            var enchantment = new Slick(SlickStrength.Greater);

            // Assert
            Assert.AreEqual("Greater Slick", enchantment.Name.Text);
            Assert.AreEqual(0, enchantment.SpecialAbilityBonus);
            Assert.AreEqual(33750, enchantment.Cost);
            Assert.AreEqual(15, enchantment.CasterLevel);
            Assert.That(enchantment.GetSchools(),
                        Has.Exactly(1).Matches <School>(s => School.Conjuration == s));
            Assert.Throws <ArgumentNullException>(() => enchantment.ApplyTo(null));
        }
Exemple #2
0
        public void Improved_ApplyTo()
        {
            // Arrange
            var competenceBonusTracker = Mock.Of <IModifierTracker>();
            var mockCharacter          = new Mock <ICharacter>();

            mockCharacter.Setup(c => c.Skills.EscapeArtist.CompetenceBonuses)
            .Returns(competenceBonusTracker);
            var enchantment = new Slick(SlickStrength.Improved);

            // Act
            enchantment.ApplyTo(mockCharacter.Object);

            // Assert
            Mock.Get(competenceBonusTracker)
            .Verify(er => er.Add(It.Is <Func <byte> >(calc => 10 == calc())),
                    "Improved Slick should give a +10 competence bonus to a character's Escape Artist skill.");
        }
Exemple #3
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            spriteBatch.Begin();

            if (CurrentScreen == GameScreen.TITLE)
            {
                spriteBatch.DrawString(Font, "Press 1 or X to play with 1 player!", new Vector2(20, 20), Color.Black);
                spriteBatch.DrawString(Font, "Press 2 or Y to play with 2 players!", new Vector2(20, 40), Color.Black);
            }
            if (CurrentScreen == GameScreen.PLAYING)
            {
                PlayerCar1.Draw(spriteBatch);
                PlayerCar2.Draw(spriteBatch);

                PlayerCar1.MoveAndWrap(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
                PlayerCar2.MoveAndWrap(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);

                PlayerCar1.CheckBump(PlayerCar2, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
                PlayerCar2.CheckBump(PlayerCar1, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);

                DogeCoin.Draw(spriteBatch);

                foreach (Sprite Slick in OilSlickList)
                {
                    Slick.Draw(spriteBatch);

                    if (Slick.IsCollided(PlayerCar1))
                    {
                        PlayerCar1.SetSpeedAndDirection(0.25, PlayerCar1.GetDirectionAngle());
                    }
                    if (Slick.IsCollided(PlayerCar2))
                    {
                        PlayerCar2.SetSpeedAndDirection(0.25, PlayerCar2.GetDirectionAngle());
                    }
                }

                if (!HockeyPlayer)
                {
                    if (DogeCoin.IsCollided(PlayerCar1))
                    {
                        CoinSound.Play();

                        PlayerCar1.Score++;

                        PlaceDogeCoin();
                    }
                }

                if (DogeCoin.IsCollided(PlayerCar2))
                {
                    CoinSound.Play();

                    PlayerCar2.Score++;

                    PlaceDogeCoin();
                }

                if (HockeyPlayer)
                {
                    spriteBatch.DrawString(Font, PlayerCar2.Score.ToString(), new Vector2(385, 20), Color.Black);
                }
                else
                {
                    spriteBatch.DrawString(Font, PlayerCar1.Score.ToString(), new Vector2(20, 20), Color.Black);
                    spriteBatch.DrawString(Font, PlayerCar2.Score.ToString(), new Vector2(770, 20), Color.Black);
                }
            }
            if (CurrentScreen == GameScreen.GAMEOVER)
            {
                spriteBatch.DrawString(Font, "GAME OVER", new Vector2(20, 20), Color.Black);

                if (HockeyPlayer)
                {
                    spriteBatch.DrawString(Font, "You win!", new Vector2(20, 40), Color.Black);
                }
                if (AIPlayer)
                {
                    if (Winner == 1)
                    {
                        spriteBatch.DrawString(Font, "You win!", new Vector2(20, 40), Color.Black);
                    }
                    else
                    {
                        spriteBatch.DrawString(Font, "You lose!", new Vector2(20, 40), Color.Black);
                    }
                }
                if (MultiPlayer)
                {
                    spriteBatch.DrawString(Font, "Player " + Winner + " Wins!", new Vector2(20, 40), Color.Black);
                }

                spriteBatch.DrawString(Font, "Press ESCAPE or START to return to the menu!", new Vector2(20, 60), Color.Black);
                spriteBatch.DrawString(Font, "Or just use 1 or X to play again with 1 player!", new Vector2(20, 80), Color.Black);
                spriteBatch.DrawString(Font, "Or use 2 or Y for 2 players!", new Vector2(20, 100), Color.Black);
            }


            spriteBatch.End();

            base.Draw(gameTime);
        }