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); }
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); }
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)); }
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); } }
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)); }
public void BasicFighterProperlyInitialized() { var testFighter=new BasicFighter("TestFighter"); Assert.That(testFighter.IsActive,Is.True); }
public void CanCreateBasicFighter() { Assert.DoesNotThrow(() => { var testFighter = new BasicFighter("TestFighter"); }); }