public void Equip(Game.WeaponName weaponName) { foreach (Weapon w in this.Inventory) { if (w.Name == weaponName) fEquippedWeapon = w; } }
public Form1() { InitializeComponent(); var boundaries = new Rectangle(78, 57, 420, 155); fGame = new Game(boundaries); fPicBoxesWeapons = new List<PictureBox>() { PicBoxBow, PicBoxPotionBlue, PicBoxSword, PicBoxMace, PicBoxPotionRed }; fPicBoxesEnemies = new List<PictureBox>() { PicBoxBat, PicBoxGhost, PicBoxGhoul }; fPicBoxesInventory = new List<PictureBox>() { PicBoxInvBow, PicBoxInvPotionBlue, PicBoxInvSword, PicBoxInvMace, PicBoxInvPotionRed }; UpdateCharacters(); }
public void Attack(Game.Direction direction, Random random) { if (fEquippedWeapon == null) return; else { fEquippedWeapon.Attack(direction, random); if (fEquippedWeapon is IPotion) // might need to make sure some gui stuff gets done after this. fEquippedWeapon = null; } }
protected bool DamageEnemy(Game game, Point playerLocation, Game.Direction direction, int distance, int damage, Random rnd) { foreach (Enemy enemy in game.Enemies) { if (enemy.Nearby(playerLocation, distance, direction)) enemy.TakeHit(damage, rnd); return true; } game.MovePlayer(direction); return false; }
public bool Nearby(Point locationToCheck, int distance, Game.Direction direction) { return true; }
public override void Attack(Game.Direction direction, Random rnd) { throw new NotImplementedException(); }
public abstract void Attack(Game.Direction direction, Random rnd);