Example #1
0
        public bool Attack(Point?target)
        {
            var zone = target == null?AttackZone.Select(x => Position + x).ToList() : new List <Point>
            {
                (Point)target
            };
            var attack   = AttackMethods.AttackConstructor(Type, this, zone);
            var isLethal = GetMap().IsLethalAttack(attack, zone);

            MonsterAttack?.Invoke(this, attack);
            return(isLethal);
        }
Example #2
0
        private void AttackClicked(object sender, EventArgs e)
        {
            var    button = (Button)sender;
            Attack attack = AttackMethods.AttackConstructor(AttackMethods.ConvertFromString(button.Name),
                                                            World.Player);

            if (World.Player.Energy >= attack.Cost)
            {
                World.Player.Energy    -= attack.Cost;
                MainGameView.AttackZone = attack.Zone;
                MainGameView.IsAttacked = true;
                Refresh();
                World.CheckAttackZone(attack, true, World.Player);
                MainGameView.IsAttacked = false;
                Refresh();
            }
            AddIntoLog("Not enough energy for attack", Color.Orange);
        }