private bool AttackIfValid(UnitCell unit, HexCoordinates coords) { if (!game.IsCurrentPlayer(player) || unit.HasAttacked) { return(false); } var target = game.Cells.GetCellAtPosition(coords); var isValid = game.Cells.IsValidAttackTarget(unit, target, player.ID); if (isValid) { state = States.None; indicator.Clear(); var damage = ValidatedAttack.GetDamage(unit, target); var validatedAttack = new ValidatedAttack(player.GetNewActionID(), unit, target, damage); game.CommandValidator.RegisterAttack(validatedAttack); unit.ShowAttack(target, validatedAttack.OnAttackLanded); player.CmdAttackCell( (Int16)player.ID, validatedAttack.ID, (Int16)unit.ID, (Int16)target.ID ); } return(isValid); }