public void TestInitializer() { Trace.WriteLine("Creating default map..."); map = new Map(new Size(5, 5), 1, MapGenerator.Grass); Trace.WriteLine("Creating default player..."); player = new Player(map.Layers.First(), new Point(5)); Trace.WriteLine("Creating default mob..."); sword = new Item("Test sword", 5, 10, 1.5, 1, EquipSlot.Attack); Assert.IsInstanceOfType(map, typeof(Map), "Failed to initialize map."); Assert.IsInstanceOfType(player, typeof(Player), "Failed to initialize player."); Assert.IsInstanceOfType(sword, typeof(Item), "Failed to initialize item."); }
public void TestInitializer() { Trace.WriteLine("Creating default map..."); map = new Map(new Size(100, 100), 1, MapGenerator.Grass); Trace.WriteLine("Creating default player..."); player = new Player(map.Layers.First(), new Point(50, 50)); Trace.WriteLine("Creating default mob..."); mob = new Mob("TestMob", map.Layers.First(), new Point(1, 1), null, null, 2, 1, 0, 15, 'M', ConsoleColor.Black, MobType.Orc); Assert.IsInstanceOfType(map, typeof(Map), "Failed to initialize the map."); Assert.IsInstanceOfType(player, typeof(Player), "Failed to initiaze the player."); Assert.IsInstanceOfType(mob, typeof(Mob), "Failed to initialize the mob."); }
/// <summary> /// Attacks the specified player. /// </summary> /// <param name="player">Attacked player</param> /// <param name="attackStrength">Strength of the attack</param> /// <returns>True if the attack killed the player</returns> public Tuple<int, bool> AttackPlayer(Player player, int attackStrength) { return Tuple.Create(player.ReceiveDamage(attackStrength + (int) Math.Floor(this.AttackStat * (this.OffensiveSlot == null ? 1 : this.OffensiveSlot.AttackMultiplier))), player.Health < 1); }