Inheritance: Items.Character
示例#1
0
 public void GoblinHpBelowZeroResultsInUnActive()
 {
     var testBasicFighter = new BasicFighter("TestFighter");
     var testGoblin = new Goblin();
     Assert.That(testGoblin.IsActive, Is.True);
     while (testGoblin.CurrentHp > 0)
     {
         testBasicFighter.Attack(testGoblin);
     }
     Assert.That(testGoblin.IsActive, Is.False);
 }
示例#2
0
        public void BasicFighterHpBelowZeroResultsInUnActive()
        {

            var testBasicFighter = new BasicFighter("TestFighter");
            var testTarget = new BasicFighter("TestTarget");
            Assert.That(testTarget.IsActive, Is.True);
            while (testTarget.CurrentHp > 0)
            {
                testBasicFighter.Attack(testTarget);
            }
            Assert.That(testTarget.IsActive, Is.False);
        }
示例#3
0
 public void BasicFighterCanAttack()
 {
     //Brittle test, can fail if unlucky with dices
     var testFighter = new BasicFighter("TestFighter");
     var testGoblin = new Goblin();
     var hpBefore = testGoblin.CurrentHp;
     Console.WriteLine($"Initial Hp: {hpBefore}");
     for (var i = 0; i < 8; i++)
     {
         testFighter.Attack(testGoblin);
         Console.WriteLine($"Post Attack {i} Hp: {testGoblin.CurrentHp}");
     }
     Assert.That(testGoblin.CurrentHp, Is.LessThan(hpBefore));
 }
示例#4
0
 private void InitParty()
 {
     string[] names = {"Urban", "Jurgen", "Adylf"};
     var i = 2f;
     foreach (var name in names)
     {
         var bs = new BasicFighter(name) {ScreenObject = new ScreenObject("basicFighter.png")};
         bs.ScreenObject.Image.MouseDown += UIElement_OnMouseDown;
         bs.ScreenObject.Image.MouseEnter += Image_MouseEnter;
         bs.Position = new Vector2(i += .5f, 3f);
         ((ICommandable) bs).PlayerControlled = true;
         _gm.Register(bs);
     }
 }
示例#5
0
        public MainWindowVm()
        {
            DoBattleButtonCommand = new DoBattleCommand(this);
            Game.OnGameLoggedEntry += UpdateGameLog;

            GameEngine = new GameManager();
            var bs = new BasicFighter("Urban den förskräcklige");
            var bs2 = new BasicFighter("Jürgen den oförskräcklige");

            bs.Target = bs2;
            bs2.Target = bs;

            bs.AddCommand(CommandHandler.enums.Commands.MeleeAttack);
            bs2.AddCommand(CommandHandler.enums.Commands.MeleeAttack);

            GameEngine.Register(bs);
            GameEngine.Register(bs2);

            FirstCombatant = GameEngine.GameObjects.First() as IEntity;
            SecondCombatant = GameEngine.GameObjects.ElementAt(1) as IEntity;
            RaisePropertyChanged(nameof(FirstCombatantHp));
            RaisePropertyChanged(nameof(SecondCombatantHp));
            RaisePropertyChanged(nameof(FirstCombatantAc));
            RaisePropertyChanged(nameof(SecondCombatantAc));
        }
示例#6
0
 public void BasicFighterProperlyInitialized()
 {
     var testFighter=new BasicFighter("TestFighter");
     Assert.That(testFighter.IsActive,Is.True);
 }
示例#7
0
 public void CanCreateBasicFighter()
 {
     Assert.DoesNotThrow(() => { var testFighter = new BasicFighter("TestFighter"); });
 }